Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ql/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ql/extractor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tree-sitter = ">= 0.23.0"
tree-sitter-ql = { git = "https://github.com/tree-sitter/tree-sitter-ql.git", rev = "c73c31c89cb0019ef56fe8bc1723e7c36e0be607"}
tree-sitter = ">= 0.26.0"
tree-sitter-ql = { git = "https://github.com/tree-sitter/tree-sitter-ql.git", rev = "5b8ee9adaa1f2a1ea958064b61f8feb0a5a886c0"}
Comment thread
owen-mc marked this conversation as resolved.
tree-sitter-ql-dbscheme = { git = "https://github.com/tree-sitter/tree-sitter-ql-dbscheme.git", rev = "1980b4b6998a1138d326f863e6168f0f2c0c544d"}
tree-sitter-blame = {path = "../buramu/tree-sitter-blame"}
tree-sitter-json = {git = "https://github.com/tree-sitter/tree-sitter-json.git", rev = "8bfdb43f47ad805bb1ce093203cfcbaa8ed2c571"}
Expand Down
6 changes: 5 additions & 1 deletion ql/ql/src/codeql_ql/ast/Ast.qll
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,11 @@ class Module extends TModule, ModuleDeclaration {

Module() { this = TModule(mod) }

override Location getLocation() { result = mod.asLeft().getName().getLocation() }
override Location getLocation() {
result = mod.asLeft().getName().getLocation()
or
not exists(mod.asLeft().getName()) and result = mod.asLeft().getLocation()
}

override string getAPrimaryQlClass() { result = "Module" }

Expand Down
3 changes: 2 additions & 1 deletion ql/ql/src/codeql_ql/ast/internal/Module.qll
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ module ModConsistency {

query predicate noName(AstNode mod) {
mod instanceof Module and
not exists(mod.(Module).getName())
not exists(mod.(Module).getName()) and
not mod.getParent() instanceof TopLevel
or
mod instanceof ModuleExpr and
not exists(mod.(ModuleExpr).getName())
Expand Down
4 changes: 2 additions & 2 deletions ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ module QL {
final F::SignatureExpr getAnImplements() { result = this.getImplements(_) }

/** Gets the node corresponding to the field `name`. */
final F::ModuleName getName() { ql_module_def(this, result) }
final F::ModuleName getName() { ql_module_name(this, result) }

/** Gets the node corresponding to the field `parameter`. */
final F::ModuleParam getParameter(int i) { ql_module_parameter(this, i, result) }
Expand All @@ -824,7 +824,7 @@ module QL {
/** Gets a field or child node of this node. */
final override F::AstNode getAFieldOrChild() {
ql_module_implements(this, _, result) or
ql_module_def(this, result) or
ql_module_name(this, result) or
ql_module_parameter(this, _, result) or
ql_module_child(this, _, result)
}
Expand Down
8 changes: 6 additions & 2 deletions ql/ql/src/ql.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,11 @@ ql_module_implements(
unique int implements: @ql_signature_expr ref
);

ql_module_name(
unique int ql_module: @ql_module ref,
unique int name: @ql_module_name ref
);

#keyset[ql_module, index]
ql_module_parameter(
int ql_module: @ql_module ref,
Expand All @@ -572,8 +577,7 @@ ql_module_child(
);

ql_module_def(
unique int id: @ql_module,
int name: @ql_module_name ref
unique int id: @ql_module
);

ql_module_alias_body_def(
Expand Down
Loading
Loading