PS: Rename getExpr to getBase on ConvertExpr.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-10-15 13:26:18 +01:00
parent 97672f9e91
commit 43fcbcaffb
4 changed files with 19 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ class ConvertExpr extends @convert_expression, Expr {
override SourceLocation getLocation() { convert_expression_location(this, result) }
Expr getExpr() { convert_expression(this, _, result, _, _) }
Expr getBase() { convert_expression(this, _, result, _, _) }
TypeConstraint getType() { convert_expression(this, _, _, result, _) }

View File

@@ -485,6 +485,22 @@ module ExprNodes {
)
}
}
class ConvertExprChildMapping extends ExprChildMapping, ConvertExpr {
override predicate relevantChild(Ast n) { n = this.getBase() }
}
class ConvertCfgNode extends ExprCfgNode {
override string getAPrimaryQlClass() { result = "ConvertCfgNode" }
override ConvertExprChildMapping e;
override ConvertExpr getExpr() { result = e }
final ExprCfgNode getBase() { e.hasCfgChild(e.getBase(), this, result) }
TypeConstraint getType() { result = e.getType() }
}
}
module StmtNodes {

View File

@@ -589,7 +589,7 @@ module Trees {
class ScriptBlockExprTree extends LeafTree instanceof ScriptBlockExpr { }
class ConvertExprTree extends StandardPostOrderTree instanceof ConvertExpr {
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
override AstNode getChildNode(int i) { i = 0 and result = super.getBase() }
}
class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {

View File

@@ -10,7 +10,7 @@ module Private {
predicate isExplicitWrite(Expr e, AssignStmt assign) {
e = assign.getLeftHandSide()
or
e = any(ConvertExpr convert | isExplicitWrite(convert, assign)).getExpr()
e = any(ConvertExpr convert | isExplicitWrite(convert, assign)).getBase()
or
e = any(ArrayLiteral array | isExplicitWrite(array, assign)).getAnElement()
}