@@ -73,7 +73,7 @@ class BecomeExprTree extends StandardPostOrderTree instanceof BecomeExpr {
7373}
7474
7575class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
76- BinaryOpExprTree ( ) { super . getOperatorName ( ) != "&&" and super . getOperatorName ( ) != "||" }
76+ BinaryOpExprTree ( ) { not this instanceof LogicalOrExpr and not this instanceof LogicalAndExpr }
7777
7878 override ControlFlowTree getChildNode ( int i ) {
7979 i = 0 and result = super .getLhs ( )
@@ -82,61 +82,53 @@ class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
8282 }
8383}
8484
85- class LogicalOrBinaryOpExprTree extends PreOrderTree instanceof BinaryExpr {
86- LogicalOrBinaryOpExprTree ( ) { super .getOperatorName ( ) = "||" }
87-
88- final override predicate propagatesAbnormal ( AstNode child ) {
89- child = [ super .getRhs ( ) , super .getLhs ( ) ]
90- }
85+ class LogicalOrBinaryOpExprTree extends PreOrderTree , LogicalOrExpr {
86+ final override predicate propagatesAbnormal ( AstNode child ) { child = this .getAnOperand ( ) }
9187
9288 override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
9389 // Edge to the first node in the lhs
9490 pred = this and
95- first ( super .getLhs ( ) , succ ) and
91+ first ( this .getLhs ( ) , succ ) and
9692 completionIsSimple ( c )
9793 or
9894 // Edge from the last node in the lhs to the first node in the rhs
99- last ( super .getLhs ( ) , pred , c ) and
100- first ( super .getRhs ( ) , succ ) and
95+ last ( this .getLhs ( ) , pred , c ) and
96+ first ( this .getRhs ( ) , succ ) and
10197 c .( BooleanCompletion ) .failed ( )
10298 }
10399
104100 override predicate last ( AstNode node , Completion c ) {
105101 // Lhs. as the last node
106- last ( super .getLhs ( ) , node , c ) and
102+ last ( this .getLhs ( ) , node , c ) and
107103 c .( BooleanCompletion ) .succeeded ( )
108104 or
109105 // Rhs. as the last node
110- last ( super .getRhs ( ) , node , c )
106+ last ( this .getRhs ( ) , node , c )
111107 }
112108}
113109
114- class LogicalAndBinaryOpExprTree extends PreOrderTree instanceof BinaryExpr {
115- LogicalAndBinaryOpExprTree ( ) { super .getOperatorName ( ) = "&&" }
116-
117- final override predicate propagatesAbnormal ( AstNode child ) {
118- child = [ super .getRhs ( ) , super .getLhs ( ) ]
119- }
110+ class LogicalAndBinaryOpExprTree extends PreOrderTree , LogicalAndExpr {
111+ final override predicate propagatesAbnormal ( AstNode child ) { child = this .getAnOperand ( ) }
120112
121113 override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
122114 // Edge to the first node in the lhs
123115 pred = this and
124- first ( super .getLhs ( ) , succ ) and
116+ first ( this .getLhs ( ) , succ ) and
125117 completionIsSimple ( c )
126118 or
127119 // Edge from the last node in the lhs to the first node in the rhs
128- last ( super .getLhs ( ) , pred , c ) and
129- first ( super .getRhs ( ) , succ ) and
120+ last ( this .getLhs ( ) , pred , c ) and
121+ first ( this .getRhs ( ) , succ ) and
130122 c .( BooleanCompletion ) .succeeded ( )
131123 }
132124
133125 override predicate last ( AstNode node , Completion c ) {
134126 // Lhs. as the last node
135- last ( super .getLhs ( ) , node , c ) and
127+ last ( this .getLhs ( ) , node , c ) and
136128 c .( BooleanCompletion ) .failed ( )
137129 or
138130 // Rhs. as the last node
139- last ( super .getRhs ( ) , node , c )
131+ last ( this .getRhs ( ) , node , c )
140132 }
141133}
142134
0 commit comments