@@ -59,22 +59,6 @@ module CfgImpl = Make<Location, CfgInput>;
59
59
60
60
import CfgImpl
61
61
62
- class FunctionTree extends LeafTree instanceof Function { }
63
-
64
- class BlockExprTree extends StandardPostOrderTree instanceof BlockExpr {
65
- override ControlFlowTree getChildNode ( int i ) {
66
- result = super .getStatement ( i )
67
- or
68
- not exists ( super .getStatement ( i ) ) and
69
- ( exists ( super .getStatement ( i - 1 ) ) or i = 0 ) and
70
- result = super .getTail ( )
71
- }
72
- }
73
-
74
- class CallExprTree extends StandardPostOrderTree instanceof CallExpr {
75
- override ControlFlowTree getChildNode ( int i ) { result = super .getArg ( i ) }
76
- }
77
-
78
62
class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryOpExpr {
79
63
BinaryOpExprTree ( ) { super .getOp ( ) != "&&" and super .getOp ( ) != "||" }
80
64
@@ -127,6 +111,44 @@ class LogicalAndBinaryOpExprTree extends PostOrderTree instanceof BinaryOpExpr {
127
111
}
128
112
}
129
113
114
+ class BlockExprTree extends StandardPostOrderTree instanceof BlockExpr {
115
+ override ControlFlowTree getChildNode ( int i ) {
116
+ result = super .getStatement ( i )
117
+ or
118
+ not exists ( super .getStatement ( i ) ) and
119
+ ( exists ( super .getStatement ( i - 1 ) ) or i = 0 ) and
120
+ result = super .getTail ( )
121
+ }
122
+ }
123
+
124
+ class BreakExprTree extends PostOrderTree instanceof BreakExpr {
125
+ override predicate propagatesAbnormal ( AstNode child ) { child = super .getExpr ( ) }
126
+
127
+ override predicate first ( AstNode node ) {
128
+ first ( super .getExpr ( ) , node )
129
+ or
130
+ not super .hasExpr ( ) and node = this
131
+ }
132
+
133
+ override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
134
+ last ( super .getExpr ( ) , pred , c ) and succ = this
135
+ }
136
+ }
137
+
138
+ class CallExprTree extends StandardPostOrderTree instanceof CallExpr {
139
+ override ControlFlowTree getChildNode ( int i ) { result = super .getArg ( i ) }
140
+ }
141
+
142
+ class ClosureExprTree extends LeafTree instanceof ClosureExpr { }
143
+
144
+ class ContinueExprTree extends LeafTree instanceof ContinueExpr { }
145
+
146
+ class ExprStmtTree extends StandardPostOrderTree instanceof ExprStmt {
147
+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
148
+ }
149
+
150
+ class FunctionTree extends LeafTree instanceof Function { }
151
+
130
152
class IfExprTree extends PostOrderTree instanceof IfExpr {
131
153
override predicate first ( AstNode node ) { first ( super .getCondition ( ) , node ) }
132
154
@@ -157,10 +179,6 @@ class IfExprTree extends PostOrderTree instanceof IfExpr {
157
179
}
158
180
}
159
181
160
- class ExprStmtTree extends StandardPostOrderTree instanceof ExprStmt {
161
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
162
- }
163
-
164
182
class LetExprTree extends StandardPostOrderTree instanceof LetExpr {
165
183
override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
166
184
}
@@ -173,6 +191,8 @@ class LetStmtTree extends StandardPostOrderTree instanceof LetStmt {
173
191
}
174
192
}
175
193
194
+ class LiteralExprTree extends LeafTree instanceof LiteralExpr { }
195
+
176
196
class LoopExprTree extends PostOrderTree instanceof LoopExpr {
177
197
override predicate propagatesAbnormal ( AstNode child ) { none ( ) }
178
198
@@ -199,21 +219,9 @@ class LoopExprTree extends PostOrderTree instanceof LoopExpr {
199
219
}
200
220
}
201
221
202
- class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
203
- override predicate propagatesAbnormal ( AstNode child ) { child = super .getExpr ( ) }
204
-
205
- override predicate first ( AstNode node ) {
206
- first ( super .getExpr ( ) , node )
207
- or
208
- not super .hasExpr ( ) and node = this
209
- }
210
-
211
- override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
212
- last ( super .getExpr ( ) , pred , c ) and succ = this
213
- }
214
- }
222
+ class PathExprTree extends LeafTree instanceof PathExpr { }
215
223
216
- class BreakExprTree extends PostOrderTree instanceof BreakExpr {
224
+ class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
217
225
override predicate propagatesAbnormal ( AstNode child ) { child = super .getExpr ( ) }
218
226
219
227
override predicate first ( AstNode node ) {
@@ -227,13 +235,5 @@ class BreakExprTree extends PostOrderTree instanceof BreakExpr {
227
235
}
228
236
}
229
237
230
- class ClosureExprTree extends LeafTree instanceof ClosureExpr { }
231
-
232
- class ContinueExprTree extends LeafTree instanceof ContinueExpr { }
233
-
234
- class LiteralExprTree extends LeafTree instanceof LiteralExpr { }
235
-
236
- class PathExprTree extends LeafTree instanceof PathExpr { }
237
-
238
238
// A leaf tree for unimplemented nodes in the AST.
239
239
class UnimplementedTree extends LeafTree instanceof Unimplemented { }
0 commit comments