@@ -129,13 +129,16 @@ module ControlFlow {
129
129
Callable getEnclosingCallable ( ) { none ( ) }
130
130
131
131
/** Gets the statement this `Node` corresponds to, if any. */
132
- Stmt asStmt ( ) { none ( ) }
132
+ Stmt asStmt ( ) { this = TStmtNode ( result ) }
133
133
134
134
/** Gets the expression this `Node` corresponds to, if any. */
135
- Expr asExpr ( ) { none ( ) }
135
+ Expr asExpr ( ) { this = TExprNode ( result ) }
136
136
137
137
/** Gets the call this `Node` corresponds to, if any. */
138
- Call asCall ( ) { none ( ) }
138
+ Call asCall ( ) {
139
+ result = this .asExpr ( ) or
140
+ result = this .asStmt ( )
141
+ }
139
142
140
143
/** Gets a textual representation of this element. */
141
144
string toString ( ) { none ( ) }
@@ -159,10 +162,6 @@ module ControlFlow {
159
162
160
163
override Callable getEnclosingCallable ( ) { result = e .getEnclosingCallable ( ) }
161
164
162
- override Expr asExpr ( ) { result = e }
163
-
164
- override Call asCall ( ) { result = e }
165
-
166
165
override ExprParent getAstNode ( ) { result = e }
167
166
168
167
/** Gets a textual representation of this element. */
@@ -182,10 +181,6 @@ module ControlFlow {
182
181
183
182
override Callable getEnclosingCallable ( ) { result = s .getEnclosingCallable ( ) }
184
183
185
- override Stmt asStmt ( ) { result = s }
186
-
187
- override Call asCall ( ) { result = s }
188
-
189
184
override ExprParent getAstNode ( ) { result = s }
190
185
191
186
override string toString ( ) { result = s .toString ( ) }
0 commit comments