Skip to content

Commit 43fcbca

Browse files
committed
PS: Rename getExpr to getBase on ConvertExpr.
1 parent 97672f9 commit 43fcbca

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class ConvertExpr extends @convert_expression, Expr {
55

66
override SourceLocation getLocation() { convert_expression_location(this, result) }
77

8-
Expr getExpr() { convert_expression(this, _, result, _, _) }
8+
Expr getBase() { convert_expression(this, _, result, _, _) }
99

1010
TypeConstraint getType() { convert_expression(this, _, _, result, _) }
1111

powershell/ql/lib/semmle/code/powershell/controlflow/CfgNodes.qll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,22 @@ module ExprNodes {
485485
)
486486
}
487487
}
488+
489+
class ConvertExprChildMapping extends ExprChildMapping, ConvertExpr {
490+
override predicate relevantChild(Ast n) { n = this.getBase() }
491+
}
492+
493+
class ConvertCfgNode extends ExprCfgNode {
494+
override string getAPrimaryQlClass() { result = "ConvertCfgNode" }
495+
496+
override ConvertExprChildMapping e;
497+
498+
override ConvertExpr getExpr() { result = e }
499+
500+
final ExprCfgNode getBase() { e.hasCfgChild(e.getBase(), this, result) }
501+
502+
TypeConstraint getType() { result = e.getType() }
503+
}
488504
}
489505

490506
module StmtNodes {

powershell/ql/lib/semmle/code/powershell/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ module Trees {
589589
class ScriptBlockExprTree extends LeafTree instanceof ScriptBlockExpr { }
590590

591591
class ConvertExprTree extends StandardPostOrderTree instanceof ConvertExpr {
592-
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
592+
override AstNode getChildNode(int i) { i = 0 and result = super.getBase() }
593593
}
594594

595595
class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {

powershell/ql/lib/semmle/code/powershell/internal/ExplicitWrite.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Private {
1010
predicate isExplicitWrite(Expr e, AssignStmt assign) {
1111
e = assign.getLeftHandSide()
1212
or
13-
e = any(ConvertExpr convert | isExplicitWrite(convert, assign)).getExpr()
13+
e = any(ConvertExpr convert | isExplicitWrite(convert, assign)).getBase()
1414
or
1515
e = any(ArrayLiteral array | isExplicitWrite(array, assign)).getAnElement()
1616
}

0 commit comments

Comments
 (0)