@@ -73,7 +73,7 @@ class BecomeExprTree extends StandardPostOrderTree instanceof BecomeExpr {
73
73
}
74
74
75
75
class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
76
- BinaryOpExprTree ( ) { super . getOperatorName ( ) != "&&" and super . getOperatorName ( ) != "||" }
76
+ BinaryOpExprTree ( ) { not this instanceof LogicalOrExpr and not this instanceof LogicalAndExpr }
77
77
78
78
override ControlFlowTree getChildNode ( int i ) {
79
79
i = 0 and result = super .getLhs ( )
@@ -82,61 +82,53 @@ class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
82
82
}
83
83
}
84
84
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 ( ) }
91
87
92
88
override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
93
89
// Edge to the first node in the lhs
94
90
pred = this and
95
- first ( super .getLhs ( ) , succ ) and
91
+ first ( this .getLhs ( ) , succ ) and
96
92
completionIsSimple ( c )
97
93
or
98
94
// 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
101
97
c .( BooleanCompletion ) .failed ( )
102
98
}
103
99
104
100
override predicate last ( AstNode node , Completion c ) {
105
101
// Lhs. as the last node
106
- last ( super .getLhs ( ) , node , c ) and
102
+ last ( this .getLhs ( ) , node , c ) and
107
103
c .( BooleanCompletion ) .succeeded ( )
108
104
or
109
105
// Rhs. as the last node
110
- last ( super .getRhs ( ) , node , c )
106
+ last ( this .getRhs ( ) , node , c )
111
107
}
112
108
}
113
109
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 ( ) }
120
112
121
113
override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
122
114
// Edge to the first node in the lhs
123
115
pred = this and
124
- first ( super .getLhs ( ) , succ ) and
116
+ first ( this .getLhs ( ) , succ ) and
125
117
completionIsSimple ( c )
126
118
or
127
119
// 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
130
122
c .( BooleanCompletion ) .succeeded ( )
131
123
}
132
124
133
125
override predicate last ( AstNode node , Completion c ) {
134
126
// Lhs. as the last node
135
- last ( super .getLhs ( ) , node , c ) and
127
+ last ( this .getLhs ( ) , node , c ) and
136
128
c .( BooleanCompletion ) .failed ( )
137
129
or
138
130
// Rhs. as the last node
139
- last ( super .getRhs ( ) , node , c )
131
+ last ( this .getRhs ( ) , node , c )
140
132
}
141
133
}
142
134
0 commit comments