AST: merge Case and CaseMatch classes

This commit is contained in:
Arthur Baars
2021-11-29 16:00:17 +01:00
parent f8a62c4c82
commit 1e026ef45e
8 changed files with 271 additions and 201 deletions

View File

@@ -308,11 +308,36 @@ class TernaryIfExpr extends ConditionalExpr, TTernaryIfExpr {
}
}
class CaseExpr extends ControlExpr, TCaseExpr {
private Ruby::Case g;
CaseExpr() { this = TCaseExpr(g) }
/**
* A `case` statement. There are three forms of `case` statements:
* ```rb
* # a value-less case expression acting like an if-elsif expression:
* case
* when x == 0 then puts "zero"
* when x > 0 then puts "positive"
* else puts "negative"
* end
*
* # a case expression that matches a value using `when` clauses:
* case value
* when 1, 2 then puts "a is one or two"
* when 3 then puts "a is three"
* else puts "I don't know what a is"
* end
*
* # a case expression that matches a value against patterns using `in` clauses:
* config = {db: {user: 'admin', password: 'abc123'}}
* case config
* in db: {user:} # matches subhash and puts matched value in variable user
* puts "Connect with user '#{user}'"
* in connection: {username: } unless username == 'admin'
* puts "Connect with user '#{username}'"
* else
* puts "Unrecognized structure of config"
* end
* ```
*/
class CaseExpr extends ControlExpr, TCase {
final override string getAPrimaryQlClass() { result = "CaseExpr" }
/**
@@ -334,25 +359,25 @@ class CaseExpr extends ControlExpr, TCaseExpr {
* end
* ```
*/
final Expr getValue() { toGenerated(result) = g.getValue() }
Expr getValue() { none() }
/**
* Gets the `n`th branch of this case expression, either a `WhenExpr` or a
* `StmtSequence`.
* Gets the `n`th branch of this case expression, either a `WhenExpr`, or a
* `InClause` or a `StmtSequence`.
*/
final Expr getBranch(int n) { toGenerated(result) = g.getChild(n) }
Expr getBranch(int n) { none() }
/**
* Gets a branch of this case expression, either a `WhenExpr` or an
* `ElseExpr`.
* Gets a branch of this case expression, either a `WhenExpr`, or a
* `InClause` or a `StmtSequence`.
*/
final Expr getABranch() { result = this.getBranch(_) }
/** Gets the `n`th `when` branch of this case expression. */
final WhenExpr getWhenBranch(int n) { result = this.getBranch(n) }
deprecated final WhenExpr getWhenBranch(int n) { result = this.getBranch(n) }
/** Gets a `when` branch of this case expression. */
final WhenExpr getAWhenBranch() { result = this.getABranch() }
deprecated final WhenExpr getAWhenBranch() { result = this.getABranch() }
/** Gets the `else` branch of this case expression, if any. */
final StmtSequence getElseBranch() { result = this.getABranch() }
@@ -371,12 +396,37 @@ class CaseExpr extends ControlExpr, TCaseExpr {
or
pred = "getBranch" and result = this.getBranch(_)
or
pred = "getWhenBranch" and result = this.getWhenBranch(_)
or
pred = "getElseBranch" and result = this.getElseBranch()
}
}
private class CaseWhenExpr extends CaseExpr, TCaseExpr {
private Ruby::Case g;
CaseWhenExpr() { this = TCaseExpr(g) }
final override Expr getValue() { toGenerated(result) = g.getValue() }
final override Expr getBranch(int n) {
toGenerated(result) = g.getChild(n) or
toGenerated(result) = g.getChild(n)
}
}
private class CaseMatch extends CaseExpr, TCaseMatch {
private Ruby::CaseMatch g;
CaseMatch() { this = TCaseMatch(g) }
final override Expr getValue() { toGenerated(result) = g.getValue() }
final override Expr getBranch(int n) {
toGenerated(result) = g.getClauses(n)
or
n = count(g.getClauses(_)) and toGenerated(result) = g.getElse()
}
}
/**
* A `when` branch of a `case` expression.
* ```rb
@@ -429,85 +479,6 @@ class WhenExpr extends Expr, TWhenExpr {
}
}
/**
* A `case` statement used for pattern matching. For example:
* ```rb
* config = {db: {user: 'admin', password: 'abc123'}}
* case config
* in db: {user:} # matches subhash and puts matched value in variable user
* puts "Connect with user '#{user}'"
* in connection: {username: } unless username == 'admin'
* puts "Connect with user '#{username}'"
* else
* puts "Unrecognized structure of config"
* end
* ```
*/
class CaseMatch extends ControlExpr, TCaseMatch {
private Ruby::CaseMatch g;
CaseMatch() { this = TCaseMatch(g) }
final override string getAPrimaryQlClass() { result = "CaseMatch" }
/**
* Gets the expression being matched. For example, `foo` in the following example.
* ```rb
* case foo
* in 0
* puts 'zero'
* in 1
* puts 'one'
* end
* ```
*/
final Expr getValue() { toGenerated(result) = g.getValue() }
/**
* Gets the `n`th branch of this case expression, either an `InClause` or a
* `StmtSequence`.
*/
final Expr getBranch(int n) {
toGenerated(result) = g.getClauses(n)
or
n = count(g.getClauses(_)) and toGenerated(result) = g.getElse()
}
/**
* Gets a branch of this case expression, either an `InClause` or an
* `StmtSequence`.
*/
final Expr getABranch() { result = this.getBranch(_) }
/** Gets the `n`th `in` clause of this case expression. */
final InClause getInClause(int n) { result = this.getBranch(n) }
/** Gets an `in` clause of this case expression. */
final InClause getAnInClause() { result = this.getABranch() }
/** Gets the `else` branch of this case expression, if any. */
final StmtSequence getElseBranch() { result = this.getABranch() }
/**
* Gets the number of branches of this case expression.
*/
final int getNumberOfBranches() { result = count(this.getBranch(_)) }
final override string toString() { result = "case ... in" }
override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getValue" and result = this.getValue()
or
pred = "getBranch" and result = this.getBranch(_)
or
pred = "getInClause" and result = this.getInClause(_)
or
pred = "getElseBranch" and result = this.getElseBranch()
}
}
/**
* An `in` clause of a `case` expression.
* ```rb

View File

@@ -623,6 +623,8 @@ TAstNodeReal fromGenerated(Ruby::AstNode n) { n = toGenerated(result) }
class TCall = TMethodCall or TYieldCall;
class TCase = TCaseExpr or TCaseMatch;
class TMethodCall =
TMethodCallSynth or TIdentifierMethodCall or TScopeResolutionMethodCall or TRegularMethodCall or
TElementReference or TSuperCall or TUnaryOperation or TBinaryOperation;

View File

@@ -192,7 +192,7 @@ private predicate inBooleanContext(AstNode n) {
or
exists(CaseExpr c, WhenExpr w |
not exists(c.getValue()) and
c.getAWhenBranch() = w and
c.getABranch() = w and
w.getPattern(_) = n
)
}
@@ -214,7 +214,7 @@ private predicate inMatchingContext(AstNode n) {
or
exists(CaseExpr c, WhenExpr w |
exists(c.getValue()) and
c.getAWhenBranch() = w and
c.getABranch() = w and
w.getPattern(_) = n
)
or

View File

@@ -378,7 +378,7 @@ module Trees {
override ControlFlowTree getChildElement(int i) { result = this.getArgument(i) }
}
private class CaseTree extends PreOrderTree, CaseExpr {
private class CaseTree extends PreOrderTree, CaseExpr, ASTInternal::TCaseExpr {
final override predicate propagatesAbnormal(AstNode child) {
child = this.getValue() or child = this.getABranch()
}
@@ -386,7 +386,7 @@ module Trees {
final override predicate last(AstNode last, Completion c) {
last(this.getValue(), last, c) and not exists(this.getABranch())
or
last(this.getAWhenBranch().getBody(), last, c)
last(this.getABranch().(WhenExpr).getBody(), last, c)
or
exists(int i, ControlFlowTree lastBranch |
lastBranch = this.getBranch(i) and

View File

@@ -170,7 +170,7 @@ calls/calls.rb:
# 106| getStmt: [CaseExpr] case ...
# 106| getValue: [MethodCall] call to foo
# 106| getReceiver: [Self, SelfVariableAccess] self
# 107| getBranch/getWhenBranch: [WhenExpr] when ...
# 107| getBranch: [WhenExpr] when ...
# 107| getPattern: [MethodCall] call to bar
# 107| getReceiver: [Self, SelfVariableAccess] self
# 107| getBody: [StmtSequence] then ...
@@ -179,7 +179,7 @@ calls/calls.rb:
# 110| getStmt: [CaseExpr] case ...
# 110| getValue: [MethodCall] call to foo
# 110| getReceiver: [ConstantReadAccess] X
# 111| getBranch/getWhenBranch: [WhenExpr] when ...
# 111| getBranch: [WhenExpr] when ...
# 111| getPattern: [MethodCall] call to bar
# 111| getReceiver: [ConstantReadAccess] X
# 111| getBody: [StmtSequence] then ...
@@ -689,11 +689,11 @@ control/cases.rb:
# 5| getAnOperand/getRightOperand: [IntegerLiteral] 0
# 8| getStmt: [CaseExpr] case ...
# 8| getValue: [LocalVariableAccess] a
# 9| getBranch/getWhenBranch: [WhenExpr] when ...
# 9| getBranch: [WhenExpr] when ...
# 9| getPattern: [LocalVariableAccess] b
# 9| getBody: [StmtSequence] then ...
# 10| getStmt: [IntegerLiteral] 100
# 11| getBranch/getWhenBranch: [WhenExpr] when ...
# 11| getBranch: [WhenExpr] when ...
# 11| getPattern: [LocalVariableAccess] c
# 11| getPattern: [LocalVariableAccess] d
# 11| getBody: [StmtSequence] then ...
@@ -701,44 +701,44 @@ control/cases.rb:
# 13| getBranch/getElseBranch: [StmtSequence] else ...
# 14| getStmt: [IntegerLiteral] 300
# 18| getStmt: [CaseExpr] case ...
# 19| getBranch/getWhenBranch: [WhenExpr] when ...
# 19| getBranch: [WhenExpr] when ...
# 19| getPattern: [GTExpr] ... > ...
# 19| getAnOperand/getGreaterOperand/getLeftOperand/getReceiver: [LocalVariableAccess] a
# 19| getAnOperand/getArgument/getLesserOperand/getRightOperand: [LocalVariableAccess] b
# 19| getBody: [StmtSequence] then ...
# 19| getStmt: [IntegerLiteral] 10
# 20| getBranch/getWhenBranch: [WhenExpr] when ...
# 20| getBranch: [WhenExpr] when ...
# 20| getPattern: [EqExpr] ... == ...
# 20| getAnOperand/getLeftOperand/getReceiver: [LocalVariableAccess] a
# 20| getAnOperand/getArgument/getRightOperand: [LocalVariableAccess] b
# 20| getBody: [StmtSequence] then ...
# 20| getStmt: [IntegerLiteral] 20
# 21| getBranch/getWhenBranch: [WhenExpr] when ...
# 21| getBranch: [WhenExpr] when ...
# 21| getPattern: [LTExpr] ... < ...
# 21| getAnOperand/getLeftOperand/getLesserOperand/getReceiver: [LocalVariableAccess] a
# 21| getAnOperand/getArgument/getGreaterOperand/getRightOperand: [LocalVariableAccess] b
# 21| getBody: [StmtSequence] then ...
# 21| getStmt: [IntegerLiteral] 30
# 26| getStmt: [CaseMatch] case ... in
# 26| getStmt: [CaseExpr] case ...
# 26| getValue: [MethodCall] call to expr
# 26| getReceiver: [Self, SelfVariableAccess] self
# 27| getBranch/getInClause: [InClause] in ... then ...
# 27| getBranch: [InClause] in ... then ...
# 27| getPattern: [IntegerLiteral] 5
# 27| getBody: [StmtSequence] then ...
# 27| getStmt: [BooleanLiteral] true
# 28| getBranch/getElseBranch: [StmtSequence] else ...
# 28| getStmt: [BooleanLiteral] false
# 31| getStmt: [CaseMatch] case ... in
# 31| getStmt: [CaseExpr] case ...
# 31| getValue: [MethodCall] call to expr
# 31| getReceiver: [Self, SelfVariableAccess] self
# 32| getBranch/getInClause: [InClause] in ... then ...
# 32| getBranch: [InClause] in ... then ...
# 32| getPattern: [LocalVariableAccess] x
# 32| getCondition: [LTExpr] ... < ...
# 32| getAnOperand/getLeftOperand/getLesserOperand/getReceiver: [LocalVariableAccess] x
# 32| getAnOperand/getArgument/getGreaterOperand/getRightOperand: [IntegerLiteral] 0
# 32| getBody: [StmtSequence] then ...
# 33| getStmt: [BooleanLiteral] true
# 34| getBranch/getInClause: [InClause] in ... then ...
# 34| getBranch: [InClause] in ... then ...
# 34| getPattern: [LocalVariableAccess] x
# 34| getCondition: [LTExpr] ... < ...
# 34| getAnOperand/getLeftOperand/getLesserOperand/getReceiver: [LocalVariableAccess] x
@@ -747,195 +747,195 @@ control/cases.rb:
# 35| getStmt: [BooleanLiteral] true
# 36| getBranch/getElseBranch: [StmtSequence] else ...
# 36| getStmt: [BooleanLiteral] false
# 39| getStmt: [CaseMatch] case ... in
# 39| getStmt: [CaseExpr] case ...
# 39| getValue: [MethodCall] call to expr
# 39| getReceiver: [Self, SelfVariableAccess] self
# 40| getBranch/getInClause: [InClause] in ... then ...
# 40| getBranch: [InClause] in ... then ...
# 40| getPattern: [IntegerLiteral] 5
# 41| getBranch/getInClause: [InClause] in ... then ...
# 41| getBranch: [InClause] in ... then ...
# 41| getPattern: [ArrayPattern] [ ..., * ]
# 41| getPrefixElement/getSuffixElement: [IntegerLiteral] 5
# 42| getBranch/getInClause: [InClause] in ... then ...
# 42| getBranch: [InClause] in ... then ...
# 42| getPattern: [ArrayPattern] [ ..., * ]
# 42| getPrefixElement: [IntegerLiteral] 1
# 42| getPrefixElement: [IntegerLiteral] 2
# 43| getBranch/getInClause: [InClause] in ... then ...
# 43| getBranch: [InClause] in ... then ...
# 43| getPattern: [ArrayPattern] [ ..., * ]
# 43| getPrefixElement/getSuffixElement: [IntegerLiteral] 1
# 43| getPrefixElement/getSuffixElement: [IntegerLiteral] 2
# 44| getBranch/getInClause: [InClause] in ... then ...
# 44| getBranch: [InClause] in ... then ...
# 44| getPattern: [ArrayPattern] [ ..., * ]
# 44| getPrefixElement: [IntegerLiteral] 1
# 44| getPrefixElement: [IntegerLiteral] 2
# 44| getPrefixElement: [IntegerLiteral] 3
# 45| getBranch/getInClause: [InClause] in ... then ...
# 45| getBranch: [InClause] in ... then ...
# 45| getPattern: [ArrayPattern] [ ..., * ]
# 45| getPrefixElement/getSuffixElement: [IntegerLiteral] 1
# 45| getPrefixElement/getSuffixElement: [IntegerLiteral] 2
# 45| getPrefixElement/getSuffixElement: [IntegerLiteral] 3
# 46| getBranch/getInClause: [InClause] in ... then ...
# 46| getBranch: [InClause] in ... then ...
# 46| getPattern: [ArrayPattern] [ ..., * ]
# 46| getPrefixElement/getSuffixElement: [IntegerLiteral] 1
# 46| getPrefixElement/getSuffixElement: [IntegerLiteral] 2
# 46| getPrefixElement/getSuffixElement: [IntegerLiteral] 3
# 47| getBranch/getInClause: [InClause] in ... then ...
# 47| getBranch: [InClause] in ... then ...
# 47| getPattern: [ArrayPattern] [ ..., * ]
# 47| getPrefixElement/getSuffixElement: [IntegerLiteral] 1
# 47| getRestVariableAccess: [LocalVariableAccess] x
# 47| getSuffixElement: [IntegerLiteral] 3
# 48| getBranch/getInClause: [InClause] in ... then ...
# 48| getBranch: [InClause] in ... then ...
# 48| getPattern: [ArrayPattern] [ ..., * ]
# 49| getBranch/getInClause: [InClause] in ... then ...
# 49| getBranch: [InClause] in ... then ...
# 49| getPattern: [ArrayPattern] [ ..., * ]
# 49| getSuffixElement: [IntegerLiteral] 3
# 49| getSuffixElement: [IntegerLiteral] 4
# 50| getBranch/getInClause: [InClause] in ... then ...
# 50| getBranch: [InClause] in ... then ...
# 50| getPattern: [FindPattern] [ *,...,* ]
# 50| getElement: [IntegerLiteral] 3
# 51| getBranch/getInClause: [InClause] in ... then ...
# 51| getBranch: [InClause] in ... then ...
# 51| getPattern: [FindPattern] [ *,...,* ]
# 51| getPrefixVariableAccess: [LocalVariableAccess] a
# 51| getElement: [IntegerLiteral] 3
# 51| getSuffixVariableAccess: [LocalVariableAccess] b
# 52| getBranch/getInClause: [InClause] in ... then ...
# 52| getBranch: [InClause] in ... then ...
# 52| getPattern: [HashPattern] { ..., ** }
# 52| getKey: [SymbolLiteral] :a
# 53| getBranch/getInClause: [InClause] in ... then ...
# 53| getBranch: [InClause] in ... then ...
# 53| getPattern: [HashPattern] { ..., ** }
# 53| getKey: [SymbolLiteral] :a
# 53| getValue: [IntegerLiteral] 5
# 54| getBranch/getInClause: [InClause] in ... then ...
# 54| getBranch: [InClause] in ... then ...
# 54| getPattern: [HashPattern] { ..., ** }
# 54| getKey: [SymbolLiteral] :a
# 54| getValue: [IntegerLiteral] 5
# 55| getBranch/getInClause: [InClause] in ... then ...
# 55| getBranch: [InClause] in ... then ...
# 55| getPattern: [HashPattern] { ..., ** }
# 55| getKey: [SymbolLiteral] :a
# 55| getValue: [IntegerLiteral] 5
# 55| getKey: [SymbolLiteral] :b
# 56| getBranch/getInClause: [InClause] in ... then ...
# 56| getBranch: [InClause] in ... then ...
# 56| getPattern: [HashPattern] { ..., ** }
# 56| getKey: [SymbolLiteral] :a
# 56| getValue: [IntegerLiteral] 5
# 56| getKey: [SymbolLiteral] :b
# 56| getRestVariableAccess: [LocalVariableAccess] map
# 57| getBranch/getInClause: [InClause] in ... then ...
# 57| getBranch: [InClause] in ... then ...
# 57| getPattern: [HashPattern] { ..., ** }
# 57| getKey: [SymbolLiteral] :a
# 57| getValue: [IntegerLiteral] 5
# 57| getKey: [SymbolLiteral] :b
# 58| getBranch/getInClause: [InClause] in ... then ...
# 58| getBranch: [InClause] in ... then ...
# 58| getPattern: [HashPattern] { ..., ** }
# 59| getBranch/getInClause: [InClause] in ... then ...
# 59| getBranch: [InClause] in ... then ...
# 59| getPattern: [ArrayPattern] [ ..., * ]
# 59| getPrefixElement: [IntegerLiteral] 5
# 60| getBranch/getInClause: [InClause] in ... then ...
# 60| getBranch: [InClause] in ... then ...
# 60| getPattern: [ArrayPattern] [ ..., * ]
# 60| getPrefixElement/getSuffixElement: [IntegerLiteral] 5
# 61| getBranch/getInClause: [InClause] in ... then ...
# 61| getBranch: [InClause] in ... then ...
# 61| getPattern: [ArrayPattern] [ ..., * ]
# 61| getPrefixElement: [IntegerLiteral] 1
# 61| getPrefixElement: [IntegerLiteral] 2
# 62| getBranch/getInClause: [InClause] in ... then ...
# 62| getBranch: [InClause] in ... then ...
# 62| getPattern: [ArrayPattern] [ ..., * ]
# 62| getPrefixElement/getSuffixElement: [IntegerLiteral] 1
# 62| getPrefixElement/getSuffixElement: [IntegerLiteral] 2
# 63| getBranch/getInClause: [InClause] in ... then ...
# 63| getBranch: [InClause] in ... then ...
# 63| getPattern: [ArrayPattern] [ ..., * ]
# 63| getPrefixElement: [IntegerLiteral] 1
# 63| getPrefixElement: [IntegerLiteral] 2
# 63| getPrefixElement: [IntegerLiteral] 3
# 64| getBranch/getInClause: [InClause] in ... then ...
# 64| getBranch: [InClause] in ... then ...
# 64| getPattern: [ArrayPattern] [ ..., * ]
# 64| getPrefixElement/getSuffixElement: [IntegerLiteral] 1
# 64| getPrefixElement/getSuffixElement: [IntegerLiteral] 2
# 64| getPrefixElement/getSuffixElement: [IntegerLiteral] 3
# 65| getBranch/getInClause: [InClause] in ... then ...
# 65| getBranch: [InClause] in ... then ...
# 65| getPattern: [ArrayPattern] [ ..., * ]
# 65| getPrefixElement/getSuffixElement: [IntegerLiteral] 1
# 65| getPrefixElement/getSuffixElement: [IntegerLiteral] 2
# 65| getPrefixElement/getSuffixElement: [IntegerLiteral] 3
# 66| getBranch/getInClause: [InClause] in ... then ...
# 66| getBranch: [InClause] in ... then ...
# 66| getPattern: [ArrayPattern] [ ..., * ]
# 66| getPrefixElement/getSuffixElement: [IntegerLiteral] 1
# 66| getRestVariableAccess: [LocalVariableAccess] x
# 66| getSuffixElement: [IntegerLiteral] 3
# 67| getBranch/getInClause: [InClause] in ... then ...
# 67| getBranch: [InClause] in ... then ...
# 67| getPattern: [ArrayPattern] [ ..., * ]
# 68| getBranch/getInClause: [InClause] in ... then ...
# 68| getBranch: [InClause] in ... then ...
# 68| getPattern: [ArrayPattern] [ ..., * ]
# 68| getSuffixElement: [IntegerLiteral] 3
# 68| getSuffixElement: [IntegerLiteral] 4
# 69| getBranch/getInClause: [InClause] in ... then ...
# 69| getBranch: [InClause] in ... then ...
# 69| getPattern: [FindPattern] [ *,...,* ]
# 69| getElement: [IntegerLiteral] 3
# 70| getBranch/getInClause: [InClause] in ... then ...
# 70| getBranch: [InClause] in ... then ...
# 70| getPattern: [FindPattern] [ *,...,* ]
# 70| getPrefixVariableAccess: [LocalVariableAccess] a
# 70| getElement: [IntegerLiteral] 3
# 70| getSuffixVariableAccess: [LocalVariableAccess] b
# 71| getBranch/getInClause: [InClause] in ... then ...
# 71| getBranch: [InClause] in ... then ...
# 71| getPattern: [HashPattern] { ..., ** }
# 71| getKey: [SymbolLiteral] :a
# 72| getBranch/getInClause: [InClause] in ... then ...
# 72| getBranch: [InClause] in ... then ...
# 72| getPattern: [HashPattern] { ..., ** }
# 72| getKey: [SymbolLiteral] :a
# 72| getValue: [IntegerLiteral] 5
# 73| getBranch/getInClause: [InClause] in ... then ...
# 73| getBranch: [InClause] in ... then ...
# 73| getPattern: [HashPattern] { ..., ** }
# 73| getKey: [SymbolLiteral] :a
# 73| getValue: [IntegerLiteral] 5
# 74| getBranch/getInClause: [InClause] in ... then ...
# 74| getBranch: [InClause] in ... then ...
# 74| getPattern: [HashPattern] { ..., ** }
# 74| getKey: [SymbolLiteral] :a
# 74| getValue: [IntegerLiteral] 5
# 74| getKey: [SymbolLiteral] :b
# 75| getBranch/getInClause: [InClause] in ... then ...
# 75| getBranch: [InClause] in ... then ...
# 75| getPattern: [HashPattern] { ..., ** }
# 75| getKey: [SymbolLiteral] :a
# 75| getValue: [IntegerLiteral] 5
# 75| getKey: [SymbolLiteral] :b
# 75| getRestVariableAccess: [LocalVariableAccess] map
# 76| getBranch/getInClause: [InClause] in ... then ...
# 76| getBranch: [InClause] in ... then ...
# 76| getPattern: [HashPattern] { ..., ** }
# 76| getKey: [SymbolLiteral] :a
# 76| getValue: [IntegerLiteral] 5
# 76| getKey: [SymbolLiteral] :b
# 77| getBranch/getInClause: [InClause] in ... then ...
# 77| getBranch: [InClause] in ... then ...
# 77| getPattern: [HashPattern] { ..., ** }
# 78| getBranch/getInClause: [InClause] in ... then ...
# 78| getBranch: [InClause] in ... then ...
# 78| getPattern: [HashPattern] { ..., ** }
# 79| getBranch/getInClause: [InClause] in ... then ...
# 79| getBranch: [InClause] in ... then ...
# 79| getPattern: [ArrayPattern] [ ..., * ]
# 84| getStmt: [AssignExpr] ... = ...
# 84| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
# 84| getAnOperand/getRightOperand: [IntegerLiteral] 42
# 86| getStmt: [CaseMatch] case ... in
# 86| getStmt: [CaseExpr] case ...
# 86| getValue: [MethodCall] call to expr
# 86| getReceiver: [Self, SelfVariableAccess] self
# 87| getBranch/getInClause: [InClause] in ... then ...
# 87| getBranch: [InClause] in ... then ...
# 87| getPattern: [IntegerLiteral] 5
# 88| getBranch/getInClause: [InClause] in ... then ...
# 88| getBranch: [InClause] in ... then ...
# 88| getPattern: [VariableReferencePattern] ^...
# 88| getVariableAccess: [LocalVariableAccess] foo
# 89| getBranch/getInClause: [InClause] in ... then ...
# 89| getBranch: [InClause] in ... then ...
# 89| getPattern: [LocalVariableAccess] var
# 90| getBranch/getInClause: [InClause] in ... then ...
# 90| getBranch: [InClause] in ... then ...
# 90| getPattern: [StringLiteral] "string"
# 90| getComponent: [StringTextComponent] string
# 91| getBranch/getInClause: [InClause] in ... then ...
# 91| getBranch: [InClause] in ... then ...
# 91| getPattern: [ArrayLiteral] %w(...)
# 91| getElement: [StringLiteral] "foo"
# 91| getComponent: [StringTextComponent] foo
# 91| getElement: [StringLiteral] "bar"
# 91| getComponent: [StringTextComponent] bar
# 92| getBranch/getInClause: [InClause] in ... then ...
# 92| getBranch: [InClause] in ... then ...
# 92| getPattern: [ArrayLiteral] %i(...)
# 92| getElement: [SymbolLiteral] :"foo"
# 92| getComponent: [StringTextComponent] foo
# 92| getElement: [SymbolLiteral] :"bar"
# 92| getComponent: [StringTextComponent] bar
# 93| getBranch/getInClause: [InClause] in ... then ...
# 93| getBranch: [InClause] in ... then ...
# 93| getPattern: [RegExpLiteral] /.*abc[0-9]/
# 93| getParsed: [RegExpSequence] .*abc[0-9]
# 93| 0: [RegExpStar] .*
@@ -948,21 +948,21 @@ control/cases.rb:
# 93| 0: [RegExpConstant, RegExpNormalChar] 0
# 93| 1: [RegExpConstant, RegExpNormalChar] 9
# 93| getComponent: [StringTextComponent] .*abc[0-9]
# 94| getBranch/getInClause: [InClause] in ... then ...
# 94| getBranch: [InClause] in ... then ...
# 94| getPattern: [RangeLiteral] _ .. _
# 94| getBegin: [IntegerLiteral] 5
# 94| getEnd: [IntegerLiteral] 10
# 95| getBranch/getInClause: [InClause] in ... then ...
# 95| getBranch: [InClause] in ... then ...
# 95| getPattern: [RangeLiteral] _ .. _
# 95| getEnd: [IntegerLiteral] 10
# 96| getBranch/getInClause: [InClause] in ... then ...
# 96| getBranch: [InClause] in ... then ...
# 96| getPattern: [RangeLiteral] _ .. _
# 96| getBegin: [IntegerLiteral] 5
# 97| getBranch/getInClause: [InClause] in ... then ...
# 97| getBranch: [InClause] in ... then ...
# 97| getPattern: [AsPattern] ... => ...
# 97| getPattern: [IntegerLiteral] 5
# 97| getVariableAccess: [LocalVariableAccess] x
# 98| getBranch/getInClause: [InClause] in ... then ...
# 98| getBranch: [InClause] in ... then ...
# 98| getPattern: [AlternativePattern] ... | ...
# 98| getAlternative: [IntegerLiteral] 5
# 98| getAlternative: [VariableReferencePattern] ^...
@@ -970,15 +970,15 @@ control/cases.rb:
# 98| getAlternative: [LocalVariableAccess] var
# 98| getAlternative: [StringLiteral] "string"
# 98| getComponent: [StringTextComponent] string
# 99| getBranch/getInClause: [InClause] in ... then ...
# 99| getBranch: [InClause] in ... then ...
# 99| getPattern: [ConstantReadAccess] Foo
# 100| getBranch/getInClause: [InClause] in ... then ...
# 100| getBranch: [InClause] in ... then ...
# 100| getPattern: [ConstantReadAccess] Bar
# 100| getScopeExpr: [ConstantReadAccess] Foo
# 101| getBranch/getInClause: [InClause] in ... then ...
# 101| getBranch: [InClause] in ... then ...
# 101| getPattern: [ConstantReadAccess] Bar
# 101| getScopeExpr: [ConstantReadAccess] Foo
# 102| getBranch/getInClause: [InClause] in ... then ...
# 102| getBranch: [InClause] in ... then ...
# 102| getPattern: [AlternativePattern] ... | ...
# 102| getAlternative: [NilLiteral] nil
# 102| getAlternative: [Self, SelfVariableAccess] self
@@ -987,46 +987,46 @@ control/cases.rb:
# 102| getAlternative: [LineLiteral] __LINE__
# 102| getAlternative: [FileLiteral] __FILE__
# 102| getAlternative: [EncodingLiteral] __ENCODING__
# 103| getBranch/getInClause: [InClause] in ... then ...
# 103| getBranch: [InClause] in ... then ...
# 103| getPattern: [Lambda] -> { ... }
# 103| getParameter: [SimpleParameter] x
# 103| getDefiningAccess: [LocalVariableAccess] x
# 103| getStmt: [EqExpr] ... == ...
# 103| getAnOperand/getLeftOperand/getReceiver: [LocalVariableAccess] x
# 103| getAnOperand/getArgument/getRightOperand: [IntegerLiteral] 10
# 104| getBranch/getInClause: [InClause] in ... then ...
# 104| getBranch: [InClause] in ... then ...
# 104| getPattern: [SymbolLiteral] :foo
# 105| getBranch/getInClause: [InClause] in ... then ...
# 105| getBranch: [InClause] in ... then ...
# 105| getPattern: [SymbolLiteral] :"foo bar"
# 105| getComponent: [StringTextComponent] foo bar
# 106| getBranch/getInClause: [InClause] in ... then ...
# 106| getBranch: [InClause] in ... then ...
# 106| getPattern: [AlternativePattern] ... | ...
# 106| getAlternative: [UnaryMinusExpr] - ...
# 106| getAnOperand/getOperand/getReceiver: [IntegerLiteral] 5
# 106| getAlternative: [UnaryPlusExpr] + ...
# 106| getAnOperand/getOperand/getReceiver: [IntegerLiteral] 10
# 111| getStmt: [CaseMatch] case ... in
# 111| getStmt: [CaseExpr] case ...
# 111| getValue: [MethodCall] call to expr
# 111| getReceiver: [Self, SelfVariableAccess] self
# 112| getBranch/getInClause: [InClause] in ... then ...
# 112| getBranch: [InClause] in ... then ...
# 112| getPattern: [ArrayPattern] [ ..., * ]
# 113| getBranch/getInClause: [InClause] in ... then ...
# 113| getBranch: [InClause] in ... then ...
# 113| getPattern: [ArrayPattern] [ ..., * ]
# 113| getPrefixElement: [LocalVariableAccess] x
# 114| getBranch/getInClause: [InClause] in ... then ...
# 114| getBranch: [InClause] in ... then ...
# 114| getPattern: [ArrayPattern] [ ..., * ]
# 114| getPrefixElement/getSuffixElement: [LocalVariableAccess] x
# 115| getBranch/getInClause: [InClause] in ... then ...
# 115| getBranch: [InClause] in ... then ...
# 115| getPattern: [ArrayPattern] [ ..., * ]
# 115| getClass: [ConstantReadAccess] Bar
# 115| getScopeExpr: [ConstantReadAccess] Foo
# 116| getBranch/getInClause: [InClause] in ... then ...
# 116| getBranch: [InClause] in ... then ...
# 116| getPattern: [ArrayPattern] [ ..., * ]
# 116| getClass: [ConstantReadAccess] Foo
# 117| getBranch/getInClause: [InClause] in ... then ...
# 117| getBranch: [InClause] in ... then ...
# 117| getPattern: [ArrayPattern] [ ..., * ]
# 117| getClass: [ConstantReadAccess] Bar
# 118| getBranch/getInClause: [InClause] in ... then ...
# 118| getBranch: [InClause] in ... then ...
# 118| getPattern: [ArrayPattern] [ ..., * ]
# 118| getClass: [ConstantReadAccess] Bar
# 118| getPrefixElement/getSuffixElement: [LocalVariableAccess] a
@@ -1034,42 +1034,42 @@ control/cases.rb:
# 118| getRestVariableAccess: [LocalVariableAccess] c
# 118| getSuffixElement: [LocalVariableAccess] d
# 118| getSuffixElement: [LocalVariableAccess] e
# 123| getStmt: [CaseMatch] case ... in
# 123| getStmt: [CaseExpr] case ...
# 123| getValue: [MethodCall] call to expr
# 123| getReceiver: [Self, SelfVariableAccess] self
# 124| getBranch/getInClause: [InClause] in ... then ...
# 124| getBranch: [InClause] in ... then ...
# 124| getPattern: [FindPattern] [ *,...,* ]
# 124| getElement: [LocalVariableAccess] x
# 125| getBranch/getInClause: [InClause] in ... then ...
# 125| getBranch: [InClause] in ... then ...
# 125| getPattern: [FindPattern] [ *,...,* ]
# 125| getPrefixVariableAccess: [LocalVariableAccess] x
# 125| getElement: [IntegerLiteral] 1
# 125| getElement: [IntegerLiteral] 2
# 125| getSuffixVariableAccess: [LocalVariableAccess] y
# 126| getBranch/getInClause: [InClause] in ... then ...
# 126| getBranch: [InClause] in ... then ...
# 126| getPattern: [FindPattern] [ *,...,* ]
# 126| getClass: [ConstantReadAccess] Bar
# 126| getScopeExpr: [ConstantReadAccess] Foo
# 126| getElement: [IntegerLiteral] 1
# 127| getBranch/getInClause: [InClause] in ... then ...
# 127| getBranch: [InClause] in ... then ...
# 127| getPattern: [FindPattern] [ *,...,* ]
# 127| getClass: [ConstantReadAccess] Foo
# 127| getElement: [ConstantReadAccess] Bar
# 132| getStmt: [CaseMatch] case ... in
# 132| getStmt: [CaseExpr] case ...
# 132| getValue: [MethodCall] call to expr
# 132| getReceiver: [Self, SelfVariableAccess] self
# 133| getBranch/getInClause: [InClause] in ... then ...
# 133| getBranch: [InClause] in ... then ...
# 133| getPattern: [HashPattern] { ..., ** }
# 134| getBranch/getInClause: [InClause] in ... then ...
# 134| getBranch: [InClause] in ... then ...
# 134| getPattern: [HashPattern] { ..., ** }
# 134| getKey: [SymbolLiteral] :x
# 135| getBranch/getInClause: [InClause] in ... then ...
# 135| getBranch: [InClause] in ... then ...
# 135| getPattern: [HashPattern] { ..., ** }
# 135| getClass: [ConstantReadAccess] Bar
# 135| getScopeExpr: [ConstantReadAccess] Foo
# 135| getKey: [SymbolLiteral] :x
# 135| getValue: [IntegerLiteral] 1
# 136| getBranch/getInClause: [InClause] in ... then ...
# 136| getBranch: [InClause] in ... then ...
# 136| getPattern: [HashPattern] { ..., ** }
# 136| getClass: [ConstantReadAccess] Bar
# 136| getScopeExpr: [ConstantReadAccess] Foo
@@ -1077,14 +1077,14 @@ control/cases.rb:
# 136| getValue: [IntegerLiteral] 1
# 136| getKey: [SymbolLiteral] :a
# 136| getRestVariableAccess: [LocalVariableAccess] rest
# 137| getBranch/getInClause: [InClause] in ... then ...
# 137| getBranch: [InClause] in ... then ...
# 137| getPattern: [HashPattern] { ..., ** }
# 137| getClass: [ConstantReadAccess] Foo
# 137| getKey: [SymbolLiteral] :y
# 138| getBranch/getInClause: [InClause] in ... then ...
# 138| getBranch: [InClause] in ... then ...
# 138| getPattern: [HashPattern] { ..., ** }
# 138| getClass: [ConstantReadAccess] Bar
# 139| getBranch/getInClause: [InClause] in ... then ...
# 139| getBranch: [InClause] in ... then ...
# 139| getPattern: [HashPattern] { ..., ** }
# 139| getClass: [ConstantReadAccess] Bar
# 139| getKey: [SymbolLiteral] :a

View File

@@ -1,11 +1,25 @@
caseValues
| cases.rb:8:1:15:3 | case ... | cases.rb:8:6:8:6 | a |
| cases.rb:26:1:29:3 | case ... | cases.rb:26:6:26:9 | call to expr |
| cases.rb:31:1:37:3 | case ... | cases.rb:31:6:31:9 | call to expr |
| cases.rb:39:1:80:3 | case ... | cases.rb:39:6:39:9 | call to expr |
| cases.rb:86:1:107:3 | case ... | cases.rb:86:6:86:9 | call to expr |
| cases.rb:111:1:119:3 | case ... | cases.rb:111:6:111:9 | call to expr |
| cases.rb:123:1:128:3 | case ... | cases.rb:123:6:123:9 | call to expr |
| cases.rb:132:1:140:3 | case ... | cases.rb:132:6:132:9 | call to expr |
caseNoValues
| cases.rb:18:1:22:3 | case ... |
caseElseBranches
| cases.rb:8:1:15:3 | case ... | cases.rb:13:1:14:7 | else ... |
| cases.rb:26:1:29:3 | case ... | cases.rb:28:3:28:12 | else ... |
| cases.rb:31:1:37:3 | case ... | cases.rb:36:3:36:12 | else ... |
caseNoElseBranches
| cases.rb:18:1:22:3 | case ... |
| cases.rb:39:1:80:3 | case ... |
| cases.rb:86:1:107:3 | case ... |
| cases.rb:111:1:119:3 | case ... |
| cases.rb:123:1:128:3 | case ... |
| cases.rb:132:1:140:3 | case ... |
caseWhenBranches
| cases.rb:8:1:15:3 | case ... | cases.rb:9:1:10:7 | when ... | 0 | cases.rb:9:6:9:6 | b | cases.rb:9:7:10:7 | then ... |
| cases.rb:8:1:15:3 | case ... | cases.rb:11:1:12:7 | when ... | 0 | cases.rb:11:6:11:6 | c | cases.rb:11:10:12:7 | then ... |
@@ -20,3 +34,86 @@ caseAllBranches
| cases.rb:18:1:22:3 | case ... | 0 | cases.rb:19:1:19:19 | when ... |
| cases.rb:18:1:22:3 | case ... | 1 | cases.rb:20:1:20:19 | when ... |
| cases.rb:18:1:22:3 | case ... | 2 | cases.rb:21:1:21:19 | when ... |
| cases.rb:26:1:29:3 | case ... | 0 | cases.rb:27:3:27:16 | in ... then ... |
| cases.rb:26:1:29:3 | case ... | 1 | cases.rb:28:3:28:12 | else ... |
| cases.rb:31:1:37:3 | case ... | 0 | cases.rb:32:3:33:11 | in ... then ... |
| cases.rb:31:1:37:3 | case ... | 1 | cases.rb:34:3:35:11 | in ... then ... |
| cases.rb:31:1:37:3 | case ... | 2 | cases.rb:36:3:36:12 | else ... |
| cases.rb:39:1:80:3 | case ... | 0 | cases.rb:40:3:40:6 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 1 | cases.rb:41:3:41:8 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 2 | cases.rb:42:3:42:10 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 3 | cases.rb:43:3:43:11 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 4 | cases.rb:44:3:44:13 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 5 | cases.rb:45:3:45:14 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 6 | cases.rb:46:3:46:16 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 7 | cases.rb:47:3:47:14 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 8 | cases.rb:48:3:48:7 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 9 | cases.rb:49:3:49:13 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 10 | cases.rb:50:3:50:13 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 11 | cases.rb:51:3:51:15 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 12 | cases.rb:52:3:52:8 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 13 | cases.rb:53:3:53:10 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 14 | cases.rb:54:3:54:11 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 15 | cases.rb:55:3:55:18 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 16 | cases.rb:56:3:56:21 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 17 | cases.rb:57:3:57:21 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 18 | cases.rb:58:3:58:11 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 19 | cases.rb:59:3:59:9 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 20 | cases.rb:60:3:60:10 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 21 | cases.rb:61:3:61:12 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 22 | cases.rb:62:3:62:13 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 23 | cases.rb:63:3:63:15 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 24 | cases.rb:64:3:64:16 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 25 | cases.rb:65:3:65:18 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 26 | cases.rb:66:3:66:16 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 27 | cases.rb:67:3:67:9 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 28 | cases.rb:68:3:68:15 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 29 | cases.rb:69:3:69:15 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 30 | cases.rb:70:3:70:17 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 31 | cases.rb:71:3:71:10 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 32 | cases.rb:72:3:72:12 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 33 | cases.rb:73:3:73:13 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 34 | cases.rb:74:3:74:20 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 35 | cases.rb:75:3:75:23 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 36 | cases.rb:76:3:76:23 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 37 | cases.rb:77:3:77:13 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 38 | cases.rb:78:3:78:8 | in ... then ... |
| cases.rb:39:1:80:3 | case ... | 39 | cases.rb:79:3:79:8 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 0 | cases.rb:87:3:87:6 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 1 | cases.rb:88:3:88:9 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 2 | cases.rb:89:3:89:8 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 3 | cases.rb:90:3:90:13 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 4 | cases.rb:91:3:91:16 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 5 | cases.rb:92:3:92:16 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 6 | cases.rb:93:3:93:17 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 7 | cases.rb:94:3:94:12 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 8 | cases.rb:95:3:95:10 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 9 | cases.rb:96:3:96:9 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 10 | cases.rb:97:3:97:11 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 11 | cases.rb:98:3:98:30 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 12 | cases.rb:99:3:99:8 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 13 | cases.rb:100:3:100:13 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 14 | cases.rb:101:3:101:15 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 15 | cases.rb:102:3:102:67 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 16 | cases.rb:103:3:103:21 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 17 | cases.rb:104:3:104:9 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 18 | cases.rb:105:3:105:15 | in ... then ... |
| cases.rb:86:1:107:3 | case ... | 19 | cases.rb:106:3:106:13 | in ... then ... |
| cases.rb:111:1:119:3 | case ... | 0 | cases.rb:112:3:112:8 | in ... then ... |
| cases.rb:111:1:119:3 | case ... | 1 | cases.rb:113:3:113:9 | in ... then ... |
| cases.rb:111:1:119:3 | case ... | 2 | cases.rb:114:3:114:11 | in ... then ... |
| cases.rb:111:1:119:3 | case ... | 3 | cases.rb:115:3:115:16 | in ... then ... |
| cases.rb:111:1:119:3 | case ... | 4 | cases.rb:116:3:116:11 | in ... then ... |
| cases.rb:111:1:119:3 | case ... | 5 | cases.rb:117:3:117:12 | in ... then ... |
| cases.rb:111:1:119:3 | case ... | 6 | cases.rb:118:3:118:25 | in ... then ... |
| cases.rb:123:1:128:3 | case ... | 0 | cases.rb:124:3:124:15 | in ... then ... |
| cases.rb:123:1:128:3 | case ... | 1 | cases.rb:125:3:125:20 | in ... then ... |
| cases.rb:123:1:128:3 | case ... | 2 | cases.rb:126:3:126:23 | in ... then ... |
| cases.rb:123:1:128:3 | case ... | 3 | cases.rb:127:3:127:20 | in ... then ... |
| cases.rb:132:1:140:3 | case ... | 0 | cases.rb:133:3:133:8 | in ... then ... |
| cases.rb:132:1:140:3 | case ... | 1 | cases.rb:134:3:134:10 | in ... then ... |
| cases.rb:132:1:140:3 | case ... | 2 | cases.rb:135:3:135:21 | in ... then ... |
| cases.rb:132:1:140:3 | case ... | 3 | cases.rb:136:3:136:33 | in ... then ... |
| cases.rb:132:1:140:3 | case ... | 4 | cases.rb:137:3:137:14 | in ... then ... |
| cases.rb:132:1:140:3 | case ... | 5 | cases.rb:138:3:138:15 | in ... then ... |
| cases.rb:132:1:140:3 | case ... | 6 | cases.rb:139:3:139:23 | in ... then ... |

View File

@@ -11,7 +11,7 @@ query predicate caseElseBranches(CaseExpr c, StmtSequence elseBranch) {
query predicate caseNoElseBranches(CaseExpr c) { not exists(c.getElseBranch()) }
query predicate caseWhenBranches(CaseExpr c, WhenExpr when, int pIndex, Expr p, StmtSequence body) {
when = c.getAWhenBranch() and
when = c.getABranch() and
p = when.getPattern(pIndex) and
body = when.getBody()
}

View File

@@ -1,12 +1,12 @@
| cases.rb:8:1:15:3 | case ... | CaseExpr |
| cases.rb:18:1:22:3 | case ... | CaseExpr |
| cases.rb:26:1:29:3 | case ... in | CaseMatch |
| cases.rb:31:1:37:3 | case ... in | CaseMatch |
| cases.rb:39:1:80:3 | case ... in | CaseMatch |
| cases.rb:86:1:107:3 | case ... in | CaseMatch |
| cases.rb:111:1:119:3 | case ... in | CaseMatch |
| cases.rb:123:1:128:3 | case ... in | CaseMatch |
| cases.rb:132:1:140:3 | case ... in | CaseMatch |
| cases.rb:26:1:29:3 | case ... | CaseExpr |
| cases.rb:31:1:37:3 | case ... | CaseExpr |
| cases.rb:39:1:80:3 | case ... | CaseExpr |
| cases.rb:86:1:107:3 | case ... | CaseExpr |
| cases.rb:111:1:119:3 | case ... | CaseExpr |
| cases.rb:123:1:128:3 | case ... | CaseExpr |
| cases.rb:132:1:140:3 | case ... | CaseExpr |
| conditionals.rb:10:1:12:3 | if ... | IfExpr |
| conditionals.rb:15:1:19:3 | if ... | IfExpr |
| conditionals.rb:22:1:30:3 | if ... | IfExpr |