From 8575c53447e4beb44b97c689da394b3fe9f99622 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Thu, 29 Aug 2024 15:03:39 +0100 Subject: [PATCH] PS: Move 'getBody' up to the parent class. --- powershell/ql/lib/semmle/code/powershell/DoUntilStmt.qll | 2 +- powershell/ql/lib/semmle/code/powershell/DoWhileStmt.qll | 2 +- powershell/ql/lib/semmle/code/powershell/ForEachStmt.qll | 2 +- powershell/ql/lib/semmle/code/powershell/ForStmt.qll | 2 +- powershell/ql/lib/semmle/code/powershell/LoopStmt.qll | 4 +++- powershell/ql/lib/semmle/code/powershell/WhileStmt.qll | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/powershell/ql/lib/semmle/code/powershell/DoUntilStmt.qll b/powershell/ql/lib/semmle/code/powershell/DoUntilStmt.qll index a0b4f40c03a..6bb3b5c48fd 100644 --- a/powershell/ql/lib/semmle/code/powershell/DoUntilStmt.qll +++ b/powershell/ql/lib/semmle/code/powershell/DoUntilStmt.qll @@ -7,5 +7,5 @@ class DoUntilStmt extends @do_until_statement, LoopStmt { PipelineBase getCondition() { do_until_statement_condition(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme - StmtBlock getBody() { do_until_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme + final override StmtBlock getBody() { do_until_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme } diff --git a/powershell/ql/lib/semmle/code/powershell/DoWhileStmt.qll b/powershell/ql/lib/semmle/code/powershell/DoWhileStmt.qll index 8076e202347..1882ae35a78 100644 --- a/powershell/ql/lib/semmle/code/powershell/DoWhileStmt.qll +++ b/powershell/ql/lib/semmle/code/powershell/DoWhileStmt.qll @@ -7,5 +7,5 @@ class DoWhileStmt extends @do_while_statement, LoopStmt { PipelineBase getCondition() { do_while_statement_condition(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme - StmtBlock getBody() { do_while_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme + final override StmtBlock getBody() { do_while_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme } diff --git a/powershell/ql/lib/semmle/code/powershell/ForEachStmt.qll b/powershell/ql/lib/semmle/code/powershell/ForEachStmt.qll index 9a32a6dc7cb..d1b4975c179 100644 --- a/powershell/ql/lib/semmle/code/powershell/ForEachStmt.qll +++ b/powershell/ql/lib/semmle/code/powershell/ForEachStmt.qll @@ -5,7 +5,7 @@ class ForEachStmt extends @foreach_statement, LoopStmt { override string toString() { result = "forach(... in ...)" } - StmtBlock getBody() { foreach_statement(this, _, _, result, _) } // TODO: Change @ast to @stmt_block in dbscheme + final override StmtBlock getBody() { foreach_statement(this, _, _, result, _) } // TODO: Change @ast to @stmt_block in dbscheme VarAccess getVariable() { foreach_statement(this, result, _, _, _) } // TODO: Change @ast to @variable_expression in dbscheme diff --git a/powershell/ql/lib/semmle/code/powershell/ForStmt.qll b/powershell/ql/lib/semmle/code/powershell/ForStmt.qll index 3a89532e537..402a72d5469 100644 --- a/powershell/ql/lib/semmle/code/powershell/ForStmt.qll +++ b/powershell/ql/lib/semmle/code/powershell/ForStmt.qll @@ -11,5 +11,5 @@ class ForStmt extends @for_statement, LoopStmt { PipelineBase getIterator() { for_statement_iterator(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme - StmtBlock getBody() { for_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme + final override StmtBlock getBody() { for_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme } diff --git a/powershell/ql/lib/semmle/code/powershell/LoopStmt.qll b/powershell/ql/lib/semmle/code/powershell/LoopStmt.qll index b8ac1e47206..edd9417a495 100644 --- a/powershell/ql/lib/semmle/code/powershell/LoopStmt.qll +++ b/powershell/ql/lib/semmle/code/powershell/LoopStmt.qll @@ -1,3 +1,5 @@ import powershell -class LoopStmt extends @loop_statement, LabeledStmt { } +class LoopStmt extends @loop_statement, LabeledStmt { + StmtBlock getBody() { none() } +} diff --git a/powershell/ql/lib/semmle/code/powershell/WhileStmt.qll b/powershell/ql/lib/semmle/code/powershell/WhileStmt.qll index 1b34927956e..4f716f6be04 100644 --- a/powershell/ql/lib/semmle/code/powershell/WhileStmt.qll +++ b/powershell/ql/lib/semmle/code/powershell/WhileStmt.qll @@ -7,5 +7,5 @@ class WhileStmt extends @while_statement, LoopStmt { PipelineBase getCondition() { while_statement_condition(this, result) } // TODO: Change @ast to @pipeline_base in dbscheme - StmtBlock getBody() { while_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme + final override StmtBlock getBody() { while_statement(this, result) } // TODO: Change @ast to @stmt_block in dbscheme }