Skip to content

Commit 3f0fe96

Browse files
committed
add getBoolValue() as a utility predicate on BooleanLiteral
1 parent 2f8c9a5 commit 3f0fe96

File tree

1 file changed

+4
-1
lines changed
  • javascript/ql/lib/semmle/javascript

1 file changed

+4
-1
lines changed

javascript/ql/lib/semmle/javascript/Expr.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,10 @@ class NullLiteral extends @null_literal, Literal { }
379379
* false
380380
* ```
381381
*/
382-
class BooleanLiteral extends @boolean_literal, Literal { }
382+
class BooleanLiteral extends @boolean_literal, Literal {
383+
/** Gets the value of this literal. */
384+
boolean getBoolValue() { if this.getRawValue() = "true" then result = true else result = false }
385+
}
383386

384387
/**
385388
* A numeric literal.

0 commit comments

Comments
 (0)