mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
fixes name and autoformats
This commit is contained in:
@@ -161,28 +161,38 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
|
||||
* file that was extracted without type information.
|
||||
*/
|
||||
Type getType() { ast_node_type(this, result) }
|
||||
|
||||
|
||||
/**
|
||||
* Holds if the syntactic context that the expression appears in relies on the expression
|
||||
* being non-null/non-undefined.
|
||||
*/
|
||||
predicate getNullSensitiveContext() {
|
||||
exists(ExprOrStmt ctx |
|
||||
this = ctx.(PropAccess).getBase() or
|
||||
this = ctx.(IndexExpr).getPropertyNameExpr() or
|
||||
this = ctx.(InvokeExpr).getCallee() or
|
||||
(this = ctx.(BinaryExpr).getAnOperand() and
|
||||
not ctx instanceof LogicalBinaryExpr and
|
||||
not ctx instanceof EqualityTest) or
|
||||
(this = ctx.(UnaryExpr).getOperand() and
|
||||
not ctx instanceof LogNotExpr) or
|
||||
this = ctx.(UpdateExpr).getOperand() or
|
||||
this = ctx.(CompoundAssignExpr).getLhs() or
|
||||
this = ctx.(CompoundAssignExpr).getRhs() or
|
||||
this = ctx.(AssignExpr).getRhs() or
|
||||
this = ctx.(SpreadElement).getOperand() or
|
||||
this = ctx.(ForOfStmt).getIterationDomain()
|
||||
)
|
||||
predicate inNullSensitiveContext() {
|
||||
exists(ExprOrStmt ctx |
|
||||
this = ctx.(PropAccess).getBase()
|
||||
or
|
||||
this = ctx.(IndexExpr).getPropertyNameExpr()
|
||||
or
|
||||
this = ctx.(InvokeExpr).getCallee()
|
||||
or
|
||||
this = ctx.(BinaryExpr).getAnOperand() and
|
||||
not ctx instanceof LogicalBinaryExpr and
|
||||
not ctx instanceof EqualityTest
|
||||
or
|
||||
this = ctx.(UnaryExpr).getOperand() and
|
||||
not ctx instanceof LogNotExpr
|
||||
or
|
||||
this = ctx.(UpdateExpr).getOperand()
|
||||
or
|
||||
this = ctx.(CompoundAssignExpr).getLhs()
|
||||
or
|
||||
this = ctx.(CompoundAssignExpr).getRhs()
|
||||
or
|
||||
this = ctx.(AssignExpr).getRhs()
|
||||
or
|
||||
this = ctx.(SpreadElement).getOperand()
|
||||
or
|
||||
this = ctx.(ForOfStmt).getIterationDomain()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user