This commit is contained in:
Chris Smowton
2022-03-31 12:19:53 +01:00
parent 0d9c353c37
commit c2d461bcee

View File

@@ -440,10 +440,10 @@ class SwitchCase extends Stmt, @case {
* Gets the expression on the right-hand side of the arrow, if any.
*
* Note, this predicate gets a value when this switch case is of the form
* `case e1 -> e2`, where `e2` is neither a block nor a throw statement.
* `case e1 -> e2`, where `e2` is neither a block nor a throw statement.
* This predicate is mutually exclusive with `getRuleStatement`.
*/
Expr getRuleExpression() {
Expr getRuleExpression() {
result.getParent() = this and result.getIndex() = -1
or
exists(ExprStmt es | es.getParent() = this and es.getIndex() = -1 | result = es.getExpr())
@@ -453,10 +453,10 @@ class SwitchCase extends Stmt, @case {
* Gets the statement on the right-hand side of the arrow, if any.
*
* Note, this predicate gets a value when this switch case is of the form
* `case e1 -> { s1; s2; ... }` or `case e1 -> throw ...`.
* `case e1 -> { s1; s2; ... }` or `case e1 -> throw ...`.
* This predicate is mutually exclusive with `getRuleExpression`.
*/
Stmt getRuleStatement() {
Stmt getRuleStatement() {
result.getParent() = this and result.getIndex() = -1 and not result instanceof ExprStmt
}
}