Skip to content

Commit b66f3b0

Browse files
committed
PS: Rename a few classes and tests.
1 parent bfa9210 commit b66f3b0

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class NamedAttributeArgument extends @named_attribute_argument, Ast {
77

88
string getName() { named_attribute_argument(this, result, _) }
99

10+
predicate hasName(string s) { this.getName() = s }
11+
1012
Expr getValue() { named_attribute_argument(this, _, result) }
1113
}
1214

powershell/ql/lib/semmle/code/powershell/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module SsaFlow {
8686
predicate localFlowStep(SsaImpl::DefinitionExt def, Node nodeFrom, Node nodeTo, boolean isUseStep) {
8787
Impl::localFlowStep(def, asNode(nodeFrom), asNode(nodeTo), isUseStep) and
8888
// Flow out of property name parameter nodes are covered by `readStep`.
89-
not nodeFrom instanceof PipelineByPropertyNameParameter
89+
not nodeFrom instanceof PipelineByPropertyNameParameterNode
9090
}
9191

9292
predicate localMustFlowStep(SsaImpl::DefinitionExt def, Node nodeFrom, Node nodeTo) {
@@ -501,8 +501,8 @@ private module ParameterNodes {
501501
override string toStringImpl() { result = parameter.toString() }
502502
}
503503

504-
class PipelineByPropertyNameParameter extends NormalParameterNode {
505-
PipelineByPropertyNameParameter() { this.getParameter().isPipelineByPropertyName() }
504+
class PipelineByPropertyNameParameterNode extends NormalParameterNode {
505+
PipelineByPropertyNameParameterNode() { this.getParameter().isPipelineByPropertyName() }
506506

507507
string getPropretyName() { result = this.getParameter().getName() }
508508
}
@@ -760,8 +760,8 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
760760
or
761761
exists(Content::KnownElementContent ec, SsaImpl::DefinitionExt def |
762762
c.isSingleton(ec) and
763-
node1.(PipelineByPropertyNameParameter).getPropretyName() = ec.getIndex().asString() and
764-
def.getSourceVariable() = node1.(PipelineByPropertyNameParameter).getParameter() and
763+
node1.(PipelineByPropertyNameParameterNode).getPropretyName() = ec.getIndex().asString() and
764+
def.getSourceVariable() = node1.(PipelineByPropertyNameParameterNode).getParameter() and
765765
SsaImpl::firstRead(def, node2.asExpr())
766766
)
767767
}
@@ -794,7 +794,7 @@ predicate expectsContent(Node n, ContentSet c) {
794794
c.isAnyElement()
795795
or
796796
exists(Content::KnownElementContent ec |
797-
ec.getIndex().asString() = n.(PipelineByPropertyNameParameter).getPropretyName() and
797+
ec.getIndex().asString() = n.(PipelineByPropertyNameParameterNode).getPropretyName() and
798798
c.isSingleton(ec)
799799
)
800800
}
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
function produce {
2-
$x = Source "16"
3-
$y = Source "17"
4-
$z = Source "18"
2+
$x = Source "1"
3+
$y = Source "2"
4+
$z = Source "3"
55
$x
66
$y, $z
77
}
88

9-
function consume {
9+
function consumeWithProcess {
1010
Param([Parameter(ValueFromPipeline)] $x)
1111

1212
process {
13-
Sink $x # $ hasValueFlow=16 hasValueFlow=17 hasValueFlow=18 hasValueFlow=19 hasValueFlow=20
13+
Sink $x # $ hasValueFlow=1 hasValueFlow=2 hasValueFlow=3 hasValueFlow=4 hasValueFlow=5
1414
}
1515
}
1616

17-
produce | consume
17+
produce | consumeWithProcess
1818

19-
$x = Source "19"
20-
$y = Source "20"
21-
$x, $y | consume
19+
$x = Source "4"
20+
$y = Source "5"
21+
$x, $y | consumeWithProcess
2222

23-
function consume2 {
23+
function consumeWithProcessAnonymous {
2424
process {
25-
Sink $_ # $ hasValueFlow=21 hasValueFlow=22
25+
Sink $_ # $ hasValueFlow=6 hasValueFlow=7
2626
}
2727
}
2828

29-
$x = Source "21"
30-
$y = Source "22"
31-
$x, $y | consume2
29+
$x = Source "6"
30+
$y = Source "7"
31+
$x, $y | consumeWithProcessAnonymous
3232

33-
function consumeValueFromPipelineByPropertyName {
33+
function consumeValueFromPipelineByPropertyNameWithoutProcess {
3434
Param([Parameter(ValueFromPipelineByPropertyName)] $x)
3535

36-
Sink $x # $ hasValueFlow=23
36+
Sink $x # $ hasValueFlow=8
3737
}
3838

39-
$x = Source "23"
40-
[pscustomobject]@{x = $x} | consumeValueFromPipelineByPropertyName
39+
$x = Source "8"
40+
[pscustomobject]@{x = $x} | consumeValueFromPipelineByPropertyNameWithoutProcess

0 commit comments

Comments
 (0)