File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
python/ql/src/semmle/python Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -401,13 +401,18 @@ class ControlFlowNode extends @py_flow_node {
401401 py_true_successors ( this , _) or py_false_successors ( this , _)
402402 }
403403
404- /* Gets a CFG node that corresponds to a child of the AST node for this node */
405- pragma [ noinline]
406404 ControlFlowNode getAChild ( ) {
407- this . getNode ( ) . getAChildNode ( ) = result . getNode ( ) and
405+ result = this . getExprChild ( ) and
408406 result .getBasicBlock ( ) .dominates ( this .getBasicBlock ( ) )
409407 }
410408
409+ /* join-ordering helper for `getAChild() */
410+ pragma [ noinline]
411+ private ControlFlowNode getExprChild ( ) {
412+ this .getNode ( ) .( Expr ) .getAChildNode ( ) = result .getNode ( ) and
413+ not this instanceof UnaryExprNode
414+ }
415+
411416}
412417
413418
@@ -1066,7 +1071,7 @@ class BasicBlock extends @py_flow_node {
10661071 this .strictlyDominates ( other )
10671072 }
10681073
1069- BasicBlock getImmediateDominator ( ) {
1074+ cached BasicBlock getImmediateDominator ( ) {
10701075 this .getAPart ( ) .getImmediateDominator ( ) = result .getAPart ( )
10711076 }
10721077
You can’t perform that action at this time.
0 commit comments