PS: Add some simple SSA tests.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-09-16 13:29:24 +01:00
parent 0312dce009
commit fbcac1020f
4 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
$glo_a = 42
$glob_b = $glob_a
function f() {
$a = 43
$b = $a
return $b
}

View File

@@ -0,0 +1,11 @@
function function-param([int]$n1, [int]$n2) {
return $n1 + $n2
}
function param-block {
param(
[int]$a,
[int]$b
)
return $a + $b
}

View File

@@ -0,0 +1,2 @@
| explicit.ps1:1:1:8:2 | <uninitialized> glob_a | explicit.ps1:2:11:2:18 | glob_a |
| explicit.ps1:5:5:5:7 | a | explicit.ps1:5:5:5:7 | a |

View File

@@ -0,0 +1,4 @@
import powershell
import semmle.code.powershell.dataflow.Ssa
query predicate definition(Ssa::Definition def, Variable v) { def.getSourceVariable() = v }