Skip to content

Commit 2f7545c

Browse files
committed
PS: Fixup the corresponding QL to match the state of the dbscheme.
1 parent 581254e commit 2f7545c

File tree

14 files changed

+30
-28
lines changed

14 files changed

+30
-28
lines changed

powershell/ql/lib/semmle/code/powershell/Ast.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import powershell
33
class Ast extends @ast {
44
string toString() { none() }
55

6-
Ast getParent() { parent(this, result) } // TODO: Flip parent and child in relation in the extractor
6+
Ast getParent() { parent(this, result) }
77

88
Location getLocation() { none() }
99
}

powershell/ql/lib/semmle/code/powershell/CatchClause.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ class CatchClause extends @catch_clause, Ast {
55

66
override string toString() { result = "catch {...}" }
77

8-
StmtBlock getBody() { catch_clause(this, result, _) } // TODO: Change @ast to @stmt_block in dbscheme
8+
StmtBlock getBody() { catch_clause(this, result, _) }
99

10-
TypeConstraint getCatchType(int i) { catch_clause_catch_type(this, i, result) } // TODO: Change @ast to @type_constraint in dbscheme
10+
TypeConstraint getCatchType(int i) { catch_clause_catch_type(this, i, result) }
11+
12+
int getNumberOfCatchTypes() { result = count(this.getACatchType()) }
1113

1214
TypeConstraint getACatchType() { result = this.getCatchType(_) }
1315

14-
predicate isCatchAll() { catch_clause(this, _, true) } // TODO: Should be equivalent to not exists(this.getACatchType())
16+
predicate isCatchAll() { not exists(this.getACatchType()) }
1517

1618
TryStmt getTryStmt() { result.getACatchClause() = this }
1719
}

powershell/ql/lib/semmle/code/powershell/Configuration.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class Configuration extends @configuration_definition, Stmt {
55

66
override string toString() { result = "Configuration" }
77

8-
Expr getName() { configuration_definition(this, _, _, result) } // TODO: Change @ast to @expression in dbscheme
8+
Expr getName() { configuration_definition(this, _, _, result) }
99

10-
ScriptBlockExpr getBody() { configuration_definition(this, result, _, _) } // TODO: Change @ast to @script_block in dbscheme
10+
ScriptBlockExpr getBody() { configuration_definition(this, result, _, _) }
1111

1212
predicate isMeta() { configuration_definition(this, _, 1, _) }
1313

powershell/ql/lib/semmle/code/powershell/DataStmt.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ class DataStmt extends @data_statement, Stmt {
1111

1212
Expr getACmdAllowed() { result = this.getCmdAllowed(_) }
1313

14-
StmtBlock getBody() { data_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme
14+
StmtBlock getBody() { data_statement(this, result) }
1515
}

powershell/ql/lib/semmle/code/powershell/DoUntilStmt.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class DoUntilStmt extends @do_until_statement, LoopStmt {
55

66
override string toString() { result = "DoUntil" }
77

8-
PipelineBase getCondition() { do_until_statement_condition(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme
8+
PipelineBase getCondition() { do_until_statement_condition(this, result) }
99

10-
final override StmtBlock getBody() { do_until_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme
10+
final override StmtBlock getBody() { do_until_statement(this, result) }
1111
}

powershell/ql/lib/semmle/code/powershell/DoWhileStmt.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class DoWhileStmt extends @do_while_statement, LoopStmt {
55

66
override string toString() { result = "DoWhile" }
77

8-
PipelineBase getCondition() { do_while_statement_condition(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme
8+
PipelineBase getCondition() { do_while_statement_condition(this, result) }
99

10-
final override StmtBlock getBody() { do_while_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme
10+
final override StmtBlock getBody() { do_while_statement(this, result) }
1111
}

powershell/ql/lib/semmle/code/powershell/ExitStmt.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ExitStmt extends @exit_statement, Stmt {
66
override string toString() { if this.hasPipeline() then result = "exit ..." else result = "exit" }
77

88
/** ..., if any. */
9-
PipelineBase getPipeline() { exit_statement_pipeline(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme
9+
PipelineBase getPipeline() { exit_statement_pipeline(this, result) }
1010

1111
predicate hasPipeline() { exists(this.getPipeline()) }
1212
}

powershell/ql/lib/semmle/code/powershell/ForEachStmt.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ class ForEachStmt extends @foreach_statement, LoopStmt {
55

66
override string toString() { result = "forach(... in ...)" }
77

8-
final override StmtBlock getBody() { foreach_statement(this, _, _, result, _) } // TODO: Change @ast to @stmt_block in dbscheme
8+
final override StmtBlock getBody() { foreach_statement(this, _, _, result, _) }
99

10-
VarAccess getVariable() { foreach_statement(this, result, _, _, _) } // TODO: Change @ast to @variable_expression in dbscheme
10+
VarAccess getVariable() { foreach_statement(this, result, _, _, _) }
1111

12-
PipelineBase getIterableExpr() { foreach_statement(this, _, result, _, _) } // TODO: Change @ast to @pipeline_base in dbscheme
12+
PipelineBase getIterableExpr() { foreach_statement(this, _, result, _, _) }
1313

1414
predicate isParallel() { foreach_statement(this, _, _, _, 1) }
1515
}

powershell/ql/lib/semmle/code/powershell/ForStmt.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ class ForStmt extends @for_statement, LoopStmt {
55

66
override string toString() { result = "for(...;...;...)" }
77

8-
PipelineBase getInitializer() { for_statement_initializer(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme
8+
PipelineBase getInitializer() { for_statement_initializer(this, result) }
99

10-
PipelineBase getCondition() { for_statement_condition(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme
10+
PipelineBase getCondition() { for_statement_condition(this, result) }
1111

12-
PipelineBase getIterator() { for_statement_iterator(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme
12+
PipelineBase getIterator() { for_statement_iterator(this, result) }
1313

14-
final override StmtBlock getBody() { for_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme
14+
final override StmtBlock getBody() { for_statement(this, result) }
1515
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import powershell
22

33
/** A `break` or `continue` statement. */
4-
class GotoStmt extends @labelled_statement, Stmt { // TODO: Rename @labelled_statement to @goto_statement
4+
class GotoStmt extends @labelled_statement, Stmt {
55

66
/** ..., if any. */
7-
Expr getLabel() { statement_label(this, result) } // TODO: Replace @ast with @expression
7+
Expr getLabel() { statement_label(this, result) }
88
}

0 commit comments

Comments
 (0)