mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Swift: add BraceStmt.getVariable(_) child with logic in QL.
This commit is contained in:
@@ -11,4 +11,23 @@ class BraceStmt extends Generated::BraceStmt {
|
||||
}
|
||||
|
||||
override string toString() { result = "{ ... }" }
|
||||
|
||||
override AstNode getImmediateElement(int index) {
|
||||
result =
|
||||
rank[index + 1](AstNode element, int i |
|
||||
element = super.getImmediateElement(i) and
|
||||
not element instanceof VarDecl
|
||||
|
|
||||
element order by i
|
||||
)
|
||||
}
|
||||
|
||||
override VarDecl getVariable(int index) {
|
||||
result =
|
||||
rank[index + 1](VarDecl variable, int i |
|
||||
variable = super.getImmediateElement(i)
|
||||
|
|
||||
variable order by i
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -935,6 +935,7 @@ class StmtCondition(AstNode):
|
||||
elements: list[ConditionElement] | child
|
||||
|
||||
class BraceStmt(Stmt):
|
||||
variables: list[VarDecl] | child | doc("variable declared in the scope of this brace statement")
|
||||
elements: list[AstNode] | child
|
||||
|
||||
class BreakStmt(Stmt):
|
||||
|
||||
Reference in New Issue
Block a user