Skip to content

Commit fbcac10

Browse files
committed
PS: Add some simple SSA tests.
1 parent 0312dce commit fbcac10

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$glo_a = 42
2+
$glob_b = $glob_a
3+
4+
function f() {
5+
$a = 43
6+
$b = $a
7+
return $b
8+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function function-param([int]$n1, [int]$n2) {
2+
return $n1 + $n2
3+
}
4+
5+
function param-block {
6+
param(
7+
[int]$a,
8+
[int]$b
9+
)
10+
return $a + $b
11+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| explicit.ps1:1:1:8:2 | <uninitialized> glob_a | explicit.ps1:2:11:2:18 | glob_a |
2+
| explicit.ps1:5:5:5:7 | a | explicit.ps1:5:5:5:7 | a |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import powershell
2+
import semmle.code.powershell.dataflow.Ssa
3+
4+
query predicate definition(Ssa::Definition def, Variable v) { def.getSourceVariable() = v }

0 commit comments

Comments
 (0)