@@ -129,13 +129,16 @@ module ControlFlow {
129129 Callable getEnclosingCallable ( ) { none ( ) }
130130
131131 /** Gets the statement this `Node` corresponds to, if any. */
132- Stmt asStmt ( ) { none ( ) }
132+ Stmt asStmt ( ) { this = TStmtNode ( result ) }
133133
134134 /** Gets the expression this `Node` corresponds to, if any. */
135- Expr asExpr ( ) { none ( ) }
135+ Expr asExpr ( ) { this = TExprNode ( result ) }
136136
137137 /** 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+ }
139142
140143 /** Gets a textual representation of this element. */
141144 string toString ( ) { none ( ) }
@@ -159,10 +162,6 @@ module ControlFlow {
159162
160163 override Callable getEnclosingCallable ( ) { result = e .getEnclosingCallable ( ) }
161164
162- override Expr asExpr ( ) { result = e }
163-
164- override Call asCall ( ) { result = e }
165-
166165 override ExprParent getAstNode ( ) { result = e }
167166
168167 /** Gets a textual representation of this element. */
@@ -182,10 +181,6 @@ module ControlFlow {
182181
183182 override Callable getEnclosingCallable ( ) { result = s .getEnclosingCallable ( ) }
184183
185- override Stmt asStmt ( ) { result = s }
186-
187- override Call asCall ( ) { result = s }
188-
189184 override ExprParent getAstNode ( ) { result = s }
190185
191186 override string toString ( ) { result = s .toString ( ) }
0 commit comments