Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion ql/Cargo.lock

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

2 changes: 1 addition & 1 deletion ql/extractor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"

[dependencies]
tree-sitter = ">= 0.26.0"
tree-sitter-ql = { git = "https://github.com/tree-sitter/tree-sitter-ql.git", rev = "5b8ee9adaa1f2a1ea958064b61f8feb0a5a886c0"}
tree-sitter-ql = { git = "https://github.com/tree-sitter/tree-sitter-ql.git", rev = "d9d6c853caf0f882e6371e4d4da5817c48c8a8d8"}
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
22 changes: 17 additions & 5 deletions ql/ql/src/codeql_ql/ast/Ast.qll
Original file line number Diff line number Diff line change
Expand Up @@ -2530,13 +2530,25 @@ private class AnnotationArg extends TAnnotationArg, AstNode {

AnnotationArg() { this = TAnnotationArg(arg) }

private predicate isOptional() {
arg.getLocation().getEndLine() != arg.getChild().getLocation().getEndLine()
Comment thread
kaspersv marked this conversation as resolved.
or
arg.getLocation().getEndColumn() != arg.getChild().getLocation().getEndColumn()
}

/** Gets the name of this argument. */
string getValue() {
result =
[
arg.getChild().(QL::SimpleId).getValue(), arg.getChild().(QL::Result).getValue(),
arg.getChild().(QL::This).getValue()
]
exists(string value |
value =
[
arg.getChild().(QL::SimpleId).getValue(), arg.getChild().(QL::Result).getValue(),
arg.getChild().(QL::This).getValue()
]
|
result = value and not this.isOptional()
or
result = value + "?" and this.isOptional()
)
}

override string toString() { result = this.getValue() }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
| Test.qll:1:1:1:15 | overlay[local?] | overlay[local?] |
| Test.qll:9:1:9:15 | overlay[caller] | overlay[caller] |
| Test.qll:16:1:16:16 | overlay[caller?] | overlay[caller?] |
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import ql

from Annotation a
where
a instanceof OverlayCaller or
a instanceof OverlayCallerQ or
a instanceof OverlayLocal or
a instanceof OverlayLocalQ
select a, a.toString()
Loading