Merge pull request #115 from microsoft/powershell-fix-dead-end-for-stmt

Powershell fix dead end for stmt
This commit is contained in:
Mathias Vorreiter Pedersen
2024-10-08 16:47:57 +02:00
committed by GitHub
3 changed files with 805 additions and 2390 deletions

View File

@@ -343,7 +343,16 @@ module Trees {
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
// Start with initialization
this = pred and
first(super.getInitializer(), succ) and
(
first(super.getInitializer(), succ)
or
not exists(super.getInitializer()) and
first(super.getCondition(), succ)
or
not exists(super.getInitializer()) and
not exists(super.getCondition()) and
first(this.getBody(), succ)
) and
completionIsSimple(c)
or
// Initialization -> condition
@@ -359,7 +368,16 @@ module Trees {
// Body -> iterator
last(this.getBody(), pred, c) and
completionIsNormal(c) and
first(super.getIterator(), succ)
(
first(super.getIterator(), succ)
or
not exists(super.getIterator()) and
first(super.getCondition(), succ)
or
not exists(super.getIterator()) and
not exists(super.getCondition()) and
first(this.getBody(), succ)
)
or
// Iterator -> condition
last(super.getIterator(), pred, c) and

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,2 @@
/**
* @kind graph
*/
import semmle.code.powershell.Cfg
import semmle.code.powershell.controlflow.internal.ControlFlowGraphImpl::TestOutput<CfgNode>