Skip to content

Commit 2aa84f4

Browse files
committed
PS: Fix bug in 'getConstructedTypeExpr' and add a helper predicate to 'ObjectCreationNode'.
1 parent aebaa87 commit 2aa84f4

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

powershell/ql/lib/semmle/code/powershell/ast/internal/ObjectCreation.qll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ class DotNetObjectCreation extends AbstractObjectCreation, CmdCall {
4646

4747
final override Expr getConstructedTypeExpr() {
4848
// Either it's the named argument `TypeName`
49-
result = CmdCall.super.getNamedArgument("TypeName")
49+
result = CmdCall.super.getNamedArgument("typename")
5050
or
5151
// Or it's the first positional argument if that's the named argument
52-
not CmdCall.super.hasNamedArgument("TypeName") and
53-
result = CmdCall.super.getPositionalArgument(0) and
54-
result = CmdCall.super.getNamedArgument(["ArgumentList", "Property"])
52+
not CmdCall.super.hasNamedArgument("typename") and
53+
result = CmdCall.super.getPositionalArgument(0)
5554
}
5655
}
5756

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,10 @@ class ObjectCreationNode extends CallNode {
500500
string getAConstructedTypeName() {
501501
result = this.getObjectCreationNode().getAConstructedTypeName()
502502
}
503+
504+
string getLowerCaseConstructedTypeName() {
505+
result = this.getObjectCreationNode().getLowerCaseConstructedTypeName()
506+
}
503507
}
504508

505509
/** A call, viewed as a node in a data flow graph. */

0 commit comments

Comments
 (0)