Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c120cca

Browse files
committed
better explanation of null sensitive contexts
1 parent 40e3a24 commit c120cca

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • javascript/ql/src/semmle/javascript

javascript/ql/src/semmle/javascript/Expr.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
165165
/**
166166
* Holds if the syntactic context that the expression appears in relies on the expression
167167
* being non-null/non-undefined.
168+
*
169+
* A context relies on the subexpression being non-null/non-undefined if either...
170+
*
171+
* * Using null or undefined would cause a runtime error
172+
* * Using null or undefined would cause no error due to type conversion, but the
173+
* behavior in the broader context is sufficiently non-obvious to warrant explicitly
174+
* converting to ensure that readers understand the intent
168175
*/
169176
predicate inNullSensitiveContext() {
170177
exists(ExprOrStmt ctx |

0 commit comments

Comments
 (0)