@@ -161,28 +161,38 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
161161 * file that was extracted without type information.
162162 */
163163 Type getType ( ) { ast_node_type ( this , result ) }
164-
164+
165165 /**
166166 * Holds if the syntactic context that the expression appears in relies on the expression
167167 * being non-null/non-undefined.
168168 */
169- predicate getNullSensitiveContext ( ) {
170- exists ( ExprOrStmt ctx |
171- this = ctx .( PropAccess ) .getBase ( ) or
172- this = ctx .( IndexExpr ) .getPropertyNameExpr ( ) or
173- this = ctx .( InvokeExpr ) .getCallee ( ) or
174- ( this = ctx .( BinaryExpr ) .getAnOperand ( ) and
175- not ctx instanceof LogicalBinaryExpr and
176- not ctx instanceof EqualityTest ) or
177- ( this = ctx .( UnaryExpr ) .getOperand ( ) and
178- not ctx instanceof LogNotExpr ) or
179- this = ctx .( UpdateExpr ) .getOperand ( ) or
180- this = ctx .( CompoundAssignExpr ) .getLhs ( ) or
181- this = ctx .( CompoundAssignExpr ) .getRhs ( ) or
182- this = ctx .( AssignExpr ) .getRhs ( ) or
183- this = ctx .( SpreadElement ) .getOperand ( ) or
184- this = ctx .( ForOfStmt ) .getIterationDomain ( )
185- )
169+ predicate inNullSensitiveContext ( ) {
170+ exists ( ExprOrStmt ctx |
171+ this = ctx .( PropAccess ) .getBase ( )
172+ or
173+ this = ctx .( IndexExpr ) .getPropertyNameExpr ( )
174+ or
175+ this = ctx .( InvokeExpr ) .getCallee ( )
176+ or
177+ this = ctx .( BinaryExpr ) .getAnOperand ( ) and
178+ not ctx instanceof LogicalBinaryExpr and
179+ not ctx instanceof EqualityTest
180+ or
181+ this = ctx .( UnaryExpr ) .getOperand ( ) and
182+ not ctx instanceof LogNotExpr
183+ or
184+ this = ctx .( UpdateExpr ) .getOperand ( )
185+ or
186+ this = ctx .( CompoundAssignExpr ) .getLhs ( )
187+ or
188+ this = ctx .( CompoundAssignExpr ) .getRhs ( )
189+ or
190+ this = ctx .( AssignExpr ) .getRhs ( )
191+ or
192+ this = ctx .( SpreadElement ) .getOperand ( )
193+ or
194+ this = ctx .( ForOfStmt ) .getIterationDomain ( )
195+ )
186196 }
187197}
188198
0 commit comments