Merge pull request #161 from github/hvitved/cfg-remove-is-hidden

CFG: Remove `isHidden()` predicate
This commit is contained in:
Tom Hvitved
2021-03-25 15:08:17 +01:00
committed by GitHub
13 changed files with 686 additions and 353 deletions

View File

@@ -57,16 +57,6 @@ class ArgumentList extends Expr, TArgumentList {
class StmtSequence extends Expr, TStmtSequence {
override string getAPrimaryQlClass() { result = "StmtSequence" }
override string toString() {
exists(int c | c = this.getNumberOfStatements() |
c = 0 and result = ";"
or
c = 1 and result = this.getStmt(0).toString()
or
c > 1 and result = "...; ..."
)
}
/** Gets the `n`th statement in this sequence. */
Stmt getStmt(int n) { none() }
@@ -91,6 +81,8 @@ private class Then extends StmtSequence, TThen {
Then() { this = TThen(g) }
override Stmt getStmt(int n) { toGenerated(result) = g.getChild(n) }
final override string toString() { result = "then ..." }
}
private class Else extends StmtSequence, TElse {
@@ -99,6 +91,8 @@ private class Else extends StmtSequence, TElse {
Else() { this = TElse(g) }
override Stmt getStmt(int n) { toGenerated(result) = g.getChild(n) }
final override string toString() { result = "else ..." }
}
private class Do extends StmtSequence, TDo {
@@ -107,6 +101,8 @@ private class Do extends StmtSequence, TDo {
Do() { this = TDo(g) }
override Stmt getStmt(int n) { toGenerated(result) = g.getChild(n) }
final override string toString() { result = "do ..." }
}
private class Ensure extends StmtSequence, TEnsure {
@@ -212,13 +208,7 @@ class ParenthesizedExpr extends StmtSequence, TParenthesizedExpr {
final override string getAPrimaryQlClass() { result = "ParenthesizedExpr" }
final override string toString() {
exists(int c | c = this.getNumberOfStatements() |
c = 0 and result = "()"
or
c > 0 and result = "(" + StmtSequence.super.toString() + ")"
)
}
final override string toString() { result = "( ... )" }
final override Stmt getStmt(int n) { toGenerated(result) = g.getChild(n) }
}

View File

@@ -107,12 +107,6 @@ abstract private class ControlFlowTree extends AstNode {
*/
pragma[nomagic]
abstract predicate succ(AstNode pred, AstNode succ, Completion c);
/**
* Holds if this node should be hidden in the CFG. That is, edges
* `pred -> this -> succ` are converted to a single edge `pred -> succ`.
*/
predicate isHidden() { none() }
}
/** Holds if `first` is the first element executed within AST node `n`. */
@@ -132,62 +126,35 @@ predicate last(ControlFlowTree n, AstNode last, Completion c) {
)
}
private predicate succImpl(AstNode pred, AstNode succ, Completion c) {
any(ControlFlowTree cft).succ(pred, succ, c)
}
private predicate isHidden(ControlFlowTree t) { t.isHidden() }
private predicate succImplIfHidden(AstNode pred, AstNode succ) {
isHidden(pred) and
succImpl(pred, succ, any(SimpleCompletion c))
}
/**
* Holds if `succ` is a control flow successor for `pred`, given that `pred`
* finishes with completion `c`.
*/
pragma[nomagic]
predicate succ(AstNode pred, AstNode succ, Completion c) {
exists(AstNode n |
succImpl(pred, n, c) and
succImplIfHidden*(n, succ) and
not isHidden(pred) and
not isHidden(succ)
)
any(ControlFlowTree cft).succ(pred, succ, c)
}
/** Holds if `first` is first executed when entering `scope`. */
pragma[nomagic]
predicate succEntry(CfgScope::Range_ scope, AstNode first) {
exists(AstNode n |
scope.entry(n) and
succImplIfHidden*(n, first) and
not isHidden(first)
)
}
predicate succEntry(CfgScope::Range_ scope, AstNode first) { scope.entry(first) }
/** Holds if `last` with completion `c` can exit `scope`. */
pragma[nomagic]
predicate succExit(CfgScope::Range_ scope, AstNode last, Completion c) {
exists(AstNode n |
scope.exit(n, c) and
succImplIfHidden*(last, n) and
not isHidden(last)
)
}
predicate succExit(CfgScope::Range_ scope, AstNode last, Completion c) { scope.exit(last, c) }
/**
* An AST node where the children are evaluated following a standard left-to-right
* evaluation. The actual evaluation order is determined by the predicate
* `getChildNode()`.
*/
abstract private class StandardNode extends ControlFlowTree {
abstract private class StandardTree extends ControlFlowTree {
/** Gets the `i`th child node, in order of evaluation. */
abstract ControlFlowTree getChildNode(int i);
private AstNode getChildNodeRanked(int i) {
result = rank[i + 1](AstNode child, int j | child = this.getChildNode(j) | child order by j)
private ControlFlowTree getChildNodeRanked(int i) {
result =
rank[i + 1](ControlFlowTree child, int j | child = this.getChildNode(j) | child order by j)
}
/** Gets the first child node of this element. */
@@ -236,24 +203,17 @@ private class ForRange extends ForExpr {
}
}
// TODO: remove this predicate
predicate isValidFor(Completion c, ControlFlowTree node) {
c instanceof SimpleCompletion and isHidden(node)
or
c.isValidFor(node)
}
abstract private class StandardPreOrderTree extends StandardNode, PreOrderTree {
abstract private class StandardPreOrderTree extends StandardTree, PreOrderTree {
final override predicate last(AstNode last, Completion c) {
last(this.getLastChildNode(), last, c)
or
not exists(this.getLastChildNode()) and
isValidFor(c, this) and
c.isValidFor(this) and
last = this
}
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
StandardNode.super.succ(pred, succ, c)
StandardTree.super.succ(pred, succ, c)
or
pred = this and
first(this.getFirstChildNode(), succ) and
@@ -264,11 +224,11 @@ abstract private class StandardPreOrderTree extends StandardNode, PreOrderTree {
abstract private class PostOrderTree extends ControlFlowTree {
override predicate last(AstNode last, Completion c) {
last = this and
isValidFor(c, last)
c.isValidFor(last)
}
}
abstract private class StandardPostOrderTree extends StandardNode, PostOrderTree {
abstract private class StandardPostOrderTree extends StandardTree, PostOrderTree {
final override predicate first(AstNode first) {
first(this.getFirstChildNode(), first)
or
@@ -277,7 +237,7 @@ abstract private class StandardPostOrderTree extends StandardNode, PostOrderTree
}
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
StandardNode.super.succ(pred, succ, c)
StandardTree.super.succ(pred, succ, c)
or
last(this.getLastChildNode(), pred, c) and
succ = this and
@@ -291,11 +251,11 @@ abstract private class LeafTree extends PreOrderTree, PostOrderTree {
override predicate succ(AstNode pred, AstNode succ, Completion c) { none() }
}
abstract class ScopeTree extends StandardNode, LeafTree {
abstract class ScopeTree extends StandardTree, LeafTree {
final override predicate propagatesAbnormal(AstNode child) { none() }
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
StandardNode.super.succ(pred, succ, c)
StandardTree.super.succ(pred, succ, c)
}
}
@@ -309,10 +269,14 @@ module Trees {
}
}
private class ArgumentListTree extends StandardPostOrderTree, ArgumentList {
private class ArgumentListTree extends StandardTree, ArgumentList {
final override ControlFlowTree getChildNode(int i) { result = this.getElement(i) }
override predicate isHidden() { any() }
final override predicate first(AstNode first) { first(this.getFirstChildNode(), first) }
final override predicate last(AstNode last, Completion c) {
last(this.getLastChildNode(), last, c)
}
}
private class ArrayLiteralTree extends StandardPostOrderTree, ArrayLiteral {
@@ -335,8 +299,10 @@ module Trees {
}
}
private class BeginTree extends BodyStmtPreOrderTree, BeginExpr {
override predicate isHidden() { any() }
private class BeginTree extends BodyStmtTree, BeginExpr {
final override predicate first(AstNode first) { this.firstInner(first) }
final override predicate last(AstNode last, Completion c) { this.lastInner(last, c) }
}
private class BinaryOperationTree extends StandardPostOrderTree, BinaryOperation {
@@ -416,11 +382,6 @@ module Trees {
}
override predicate succ(AstNode pred, AstNode succ, Completion c) {
this instanceof PreOrderTree and
pred = this and
c instanceof SimpleCompletion and
this.firstInner(succ)
or
// Normal left-to-right evaluation in the body
exists(int i |
last(this.getBodyChild(i, _), pred, c) and
@@ -498,12 +459,14 @@ module Trees {
* Gets a descendant that belongs to the `ensure` block of this block, if any.
* Nested `ensure` blocks are not included.
*/
pragma[nomagic]
AstNode getAnEnsureDescendant() {
result = this.getEnsure()
or
exists(AstNode mid |
mid = this.getAnEnsureDescendant() and
result = getAChildInScope(mid, getCfgScope(mid)) and
result = mid.getAChild() and
getCfgScope(result) = getCfgScope(mid) and
not exists(BodyStmt nestedBlock |
result = nestedBlock.getEnsure() and
nestedBlock != this
@@ -517,7 +480,8 @@ module Trees {
*/
private predicate nestedEnsure(BodyStmtTree innerBlock) {
exists(StmtSequence innerEnsure |
innerEnsure = getAChildInScope(this.getAnEnsureDescendant(), getCfgScope(this)) and
innerEnsure = this.getAnEnsureDescendant().getAChild() and
getCfgScope(innerEnsure) = getCfgScope(this) and
innerEnsure = innerBlock.(BodyStmt).getEnsure()
)
}
@@ -565,7 +529,15 @@ module Trees {
or
not exists(this.getAChild(_)) and
last = this and
isValidFor(c, this)
c.isValidFor(this)
}
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
BodyStmtTree.super.succ(pred, succ, c)
or
pred = this and
c instanceof SimpleCompletion and
this.firstInner(succ)
}
}
@@ -1041,7 +1013,7 @@ module Trees {
or
not exists(this.getAnException()) and
last = this and
isValidFor(c, this)
c.isValidFor(this)
)
)
}
@@ -1127,7 +1099,15 @@ module Trees {
final override predicate first(AstNode first) { first(this.getStmt(0), first) }
override predicate propagatesAbnormal(AstNode child) { child = this.getAStmt() }
final override predicate propagatesAbnormal(AstNode child) { child = this.getAStmt() }
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
succ = this and
last(this.getLastBodyChild(), pred, c) and
c instanceof NormalCompletion
or
StmtSequenceTree.super.succ(pred, succ, c)
}
}
/**
@@ -1145,25 +1125,21 @@ module Trees {
not this instanceof ParenthesizedExpr
}
override predicate propagatesAbnormal(AstNode child) { child = this.getAStmt() }
override predicate isHidden() {
this instanceof ASTInternal::TElse or
this instanceof ASTInternal::TThen or
this instanceof ASTInternal::TDo
}
final AstNode getLastChildNode() { result = this.getStmt(this.getNumberOfStatements() - 1) }
final override predicate propagatesAbnormal(AstNode child) { child = this.getAStmt() }
final override predicate last(AstNode last, Completion c) {
last(this.getLastChildNode(), last, c)
last(this.getLastStmt(), last, c)
or
not exists(this.getLastChildNode()) and
isValidFor(c, this) and
not exists(this.getLastStmt()) and
c.isValidFor(this) and
last = this
}
override predicate succ(AstNode pred, AstNode succ, Completion c) {
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
pred = this and
first(this.getBodyChild(0, _), succ) and
c instanceof SimpleCompletion
or
StmtSequenceTree.super.succ(pred, succ, c)
}
}
@@ -1213,7 +1189,7 @@ module Trees {
rescuable = true
}
AstNode getLastBodyChild() {
final AstNode getLastBodyChild() {
exists(int i |
result = this.getBodyChild(i, _) and
not exists(this.getBodyChild(i + 1, _))
@@ -1221,16 +1197,6 @@ module Trees {
}
override predicate succ(AstNode pred, AstNode succ, Completion c) {
this instanceof PreOrderTree and
pred = this and
first(this.getBodyChild(0, _), succ) and
c instanceof SimpleCompletion
or
this instanceof PostOrderTree and
succ = this and
last(this.getLastBodyChild(), pred, c) and
c instanceof NormalCompletion
or
// Normal left-to-right evaluation in the body
exists(int i |
last(this.getBodyChild(i, _), pred, c) and
@@ -1240,18 +1206,14 @@ module Trees {
}
}
private class StringConcatenationTree extends StandardPostOrderTree, StringConcatenation {
private class StringConcatenationTree extends StandardTree, StringConcatenation {
final override ControlFlowTree getChildNode(int i) { result = this.getString(i) }
override predicate isHidden() { any() }
}
final override predicate first(AstNode first) { first(this.getFirstChildNode(), first) }
private class StringTextComponentTree extends LeafTree, StringTextComponent {
override predicate isHidden() { any() }
}
private class StringEscapeSequenceComponentTree extends LeafTree, StringEscapeSequenceComponent {
override predicate isHidden() { any() }
final override predicate last(AstNode last, Completion c) {
last(this.getLastChildNode(), last, c)
}
}
private class StringlikeLiteralTree extends StandardPostOrderTree, StringlikeLiteral {
@@ -1264,14 +1226,20 @@ module Trees {
final override ControlFlowTree getChildNode(int i) { result = this.getArgument(i) }
}
private class ToplevelTree extends BodyStmtPreOrderTree, Toplevel {
private class ToplevelTree extends BodyStmtTree, Toplevel {
final override AstNode getBodyChild(int i, boolean rescuable) {
result = this.getBeginBlock(i) and rescuable = true
or
result = BodyStmtPreOrderTree.super.getBodyChild(i - count(this.getABeginBlock()), rescuable)
result = BodyStmtTree.super.getBodyChild(i - count(this.getABeginBlock()), rescuable)
}
override predicate isHidden() { any() }
final override predicate first(AstNode first) { this.firstInner(first) }
final override predicate last(AstNode last, Completion c) { this.lastInner(last, c) }
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
BodyStmtTree.super.succ(pred, succ, c)
}
}
private class TuplePatternTree extends StandardPostOrderTree, TuplePattern {
@@ -1329,13 +1297,6 @@ module Trees {
private class YieldCallTree extends StandardPreOrderTree, YieldCall {
final override ControlFlowTree getChildNode(int i) { result = this.getArgument(i) }
}
/** Gets a child of `n` that is in CFG scope `scope`. */
pragma[noinline]
private AstNode getAChildInScope(AstNode n, CfgScope scope) {
result.getParent() = n and
scope = getCfgScope(result)
}
}
private Scope parent(Scope n) {
@@ -1343,11 +1304,20 @@ private Scope parent(Scope n) {
not n instanceof CfgScope::Range_
}
/** Gets the CFG scope of node `n`. */
pragma[inline]
CfgScope getCfgScope(AstNode n) {
exists(AstNode n0 |
pragma[only_bind_into](n0) = n and
pragma[only_bind_into](result) = getCfgScopeImpl(n0)
)
}
cached
private module Cached {
/** Gets the CFG scope of node `n`. */
cached
CfgScope getCfgScope(AstNode n) {
CfgScope getCfgScopeImpl(AstNode n) {
result = parent*(ASTInternal::fromGenerated(scopeOf(ASTInternal::toGenerated(n))))
}

View File

@@ -43,9 +43,9 @@ calls/calls.rb:
# 46| getStmt: [MethodCall] call to foo
# 47| getStmt: [MethodCall] call to foo
# 47| getReceiver: [ConstantReadAccess] X
# 50| getStmt: [ParenthesizedExpr] (call to foo)
# 50| getStmt: [ParenthesizedExpr] ( ... )
# 50| getStmt: [MethodCall] call to foo
# 51| getStmt: [ParenthesizedExpr] (call to foo)
# 51| getStmt: [ParenthesizedExpr] ( ... )
# 51| getStmt: [MethodCall] call to foo
# 51| getReceiver: [ConstantReadAccess] X
# 54| getStmt: [MethodCall] call to some_func
@@ -117,7 +117,7 @@ calls/calls.rb:
# 106| getValue: [MethodCall] call to foo
# 107| getBranch: [WhenExpr] when ...
# 107| getPattern: [MethodCall] call to bar
# 107| getBody: [StmtSequence] call to baz
# 107| getBody: [StmtSequence] then ...
# 108| getStmt: [MethodCall] call to baz
# 110| getStmt: [CaseExpr] case ...
# 110| getValue: [MethodCall] call to foo
@@ -125,7 +125,7 @@ calls/calls.rb:
# 111| getBranch: [WhenExpr] when ...
# 111| getPattern: [MethodCall] call to bar
# 111| getReceiver: [ConstantReadAccess] X
# 111| getBody: [StmtSequence] call to baz
# 111| getBody: [StmtSequence] then ...
# 112| getStmt: [MethodCall] call to baz
# 112| getReceiver: [ConstantReadAccess] X
# 116| getStmt: [Class] MyClass
@@ -189,27 +189,27 @@ calls/calls.rb:
# 167| getReceiver: [ConstantReadAccess] X
# 170| getStmt: [IfExpr] if ...
# 170| getCondition: [MethodCall] call to foo
# 170| getBranch/getThen: [StmtSequence] call to wibble
# 170| getBranch/getThen: [StmtSequence] then ...
# 171| getStmt: [MethodCall] call to wibble
# 172| getBranch/getElse: [IfExpr] elsif ...
# 172| getCondition: [MethodCall] call to bar
# 172| getBranch/getThen: [StmtSequence] call to wobble
# 172| getBranch/getThen: [StmtSequence] then ...
# 173| getStmt: [MethodCall] call to wobble
# 174| getBranch/getElse: [StmtSequence] call to wabble
# 174| getBranch/getElse: [StmtSequence] else ...
# 175| getStmt: [MethodCall] call to wabble
# 177| getStmt: [IfExpr] if ...
# 177| getCondition: [MethodCall] call to foo
# 177| getReceiver: [ConstantReadAccess] X
# 177| getBranch/getThen: [StmtSequence] call to wibble
# 177| getBranch/getThen: [StmtSequence] then ...
# 178| getStmt: [MethodCall] call to wibble
# 178| getReceiver: [ConstantReadAccess] X
# 179| getBranch/getElse: [IfExpr] elsif ...
# 179| getCondition: [MethodCall] call to bar
# 179| getReceiver: [ConstantReadAccess] X
# 179| getBranch/getThen: [StmtSequence] call to wobble
# 179| getBranch/getThen: [StmtSequence] then ...
# 180| getStmt: [MethodCall] call to wobble
# 180| getReceiver: [ConstantReadAccess] X
# 181| getBranch/getElse: [StmtSequence] call to wabble
# 181| getBranch/getElse: [StmtSequence] else ...
# 182| getStmt: [MethodCall] call to wabble
# 182| getReceiver: [ConstantReadAccess] X
# 186| getStmt: [IfModifierExpr] ... if ...
@@ -222,12 +222,12 @@ calls/calls.rb:
# 187| getReceiver: [ConstantReadAccess] X
# 190| getStmt: [UnlessExpr] unless ...
# 190| getCondition: [MethodCall] call to foo
# 190| getBranch/getThen: [StmtSequence] call to bar
# 190| getBranch/getThen: [StmtSequence] then ...
# 191| getStmt: [MethodCall] call to bar
# 193| getStmt: [UnlessExpr] unless ...
# 193| getCondition: [MethodCall] call to foo
# 193| getReceiver: [ConstantReadAccess] X
# 193| getBranch/getThen: [StmtSequence] call to bar
# 193| getBranch/getThen: [StmtSequence] then ...
# 194| getStmt: [MethodCall] call to bar
# 194| getReceiver: [ConstantReadAccess] X
# 198| getStmt: [UnlessModifierExpr] ... unless ...
@@ -240,12 +240,12 @@ calls/calls.rb:
# 199| getReceiver: [ConstantReadAccess] X
# 202| getStmt: [WhileExpr] while ...
# 202| getCondition: [MethodCall] call to foo
# 202| getBody: [StmtSequence] call to bar
# 202| getBody: [StmtSequence] do ...
# 203| getStmt: [MethodCall] call to bar
# 205| getStmt: [WhileExpr] while ...
# 205| getCondition: [MethodCall] call to foo
# 205| getReceiver: [ConstantReadAccess] X
# 205| getBody: [StmtSequence] call to bar
# 205| getBody: [StmtSequence] do ...
# 206| getStmt: [MethodCall] call to bar
# 206| getReceiver: [ConstantReadAccess] X
# 210| getStmt: [WhileModifierExpr] ... while ...
@@ -258,12 +258,12 @@ calls/calls.rb:
# 211| getReceiver: [ConstantReadAccess] X
# 214| getStmt: [UntilExpr] until ...
# 214| getCondition: [MethodCall] call to foo
# 214| getBody: [StmtSequence] call to bar
# 214| getBody: [StmtSequence] do ...
# 215| getStmt: [MethodCall] call to bar
# 217| getStmt: [UntilExpr] until ...
# 217| getCondition: [MethodCall] call to foo
# 217| getReceiver: [ConstantReadAccess] X
# 217| getBody: [StmtSequence] call to bar
# 217| getBody: [StmtSequence] do ...
# 218| getStmt: [MethodCall] call to bar
# 218| getReceiver: [ConstantReadAccess] X
# 222| getStmt: [UntilModifierExpr] ... until ...
@@ -278,14 +278,14 @@ calls/calls.rb:
# 226| getPattern: [LocalVariableAccess] x
# 226| <in>: [???] In
# 226| getValue: [MethodCall] call to bar
# 226| getBody: [StmtSequence] call to baz
# 226| getBody: [StmtSequence] do ...
# 227| getStmt: [MethodCall] call to baz
# 229| getStmt: [ForExpr] for ... in ...
# 229| getPattern: [LocalVariableAccess] x
# 229| <in>: [???] In
# 229| getValue: [MethodCall] call to bar
# 229| getReceiver: [ConstantReadAccess] X
# 229| getBody: [StmtSequence] call to baz
# 229| getBody: [StmtSequence] do ...
# 230| getStmt: [MethodCall] call to baz
# 230| getReceiver: [ConstantReadAccess] X
# 234| getStmt: [ElementReference] ...[...]
@@ -492,33 +492,33 @@ control/cases.rb:
# 8| getValue: [LocalVariableAccess] a
# 9| getBranch: [WhenExpr] when ...
# 9| getPattern: [LocalVariableAccess] b
# 9| getBody: [StmtSequence] 100
# 9| getBody: [StmtSequence] then ...
# 10| getStmt: [IntegerLiteral] 100
# 11| getBranch: [WhenExpr] when ...
# 11| getPattern: [LocalVariableAccess] c
# 11| getPattern: [LocalVariableAccess] d
# 11| getBody: [StmtSequence] 200
# 11| getBody: [StmtSequence] then ...
# 12| getStmt: [IntegerLiteral] 200
# 13| getBranch: [StmtSequence] 300
# 13| getBranch: [StmtSequence] else ...
# 14| getStmt: [IntegerLiteral] 300
# 18| getStmt: [CaseExpr] case ...
# 19| getBranch: [WhenExpr] when ...
# 19| getPattern: [GTExpr] ... > ...
# 19| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] a
# 19| getAnOperand/getLesserOperand/getRightOperand: [LocalVariableAccess] b
# 19| getBody: [StmtSequence] 10
# 19| getBody: [StmtSequence] then ...
# 19| getStmt: [IntegerLiteral] 10
# 20| getBranch: [WhenExpr] when ...
# 20| getPattern: [EqExpr] ... == ...
# 20| getAnOperand/getLeftOperand: [LocalVariableAccess] a
# 20| getAnOperand/getRightOperand: [LocalVariableAccess] b
# 20| getBody: [StmtSequence] 20
# 20| getBody: [StmtSequence] then ...
# 20| getStmt: [IntegerLiteral] 20
# 21| getBranch: [WhenExpr] when ...
# 21| getPattern: [LTExpr] ... < ...
# 21| getAnOperand/getLeftOperand/getLesserOperand: [LocalVariableAccess] a
# 21| getAnOperand/getGreaterOperand/getRightOperand: [LocalVariableAccess] b
# 21| getBody: [StmtSequence] 30
# 21| getBody: [StmtSequence] then ...
# 21| getStmt: [IntegerLiteral] 30
modules/classes.rb:
# 2| [Toplevel] classes.rb
@@ -589,61 +589,61 @@ control/conditionals.rb:
# 10| getCondition: [GTExpr] ... > ...
# 10| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] a
# 10| getAnOperand/getLesserOperand/getRightOperand: [LocalVariableAccess] b
# 10| getBranch/getThen: [StmtSequence] c
# 10| getBranch/getThen: [StmtSequence] then ...
# 11| getStmt: [LocalVariableAccess] c
# 15| getStmt: [IfExpr] if ...
# 15| getCondition: [EqExpr] ... == ...
# 15| getAnOperand/getLeftOperand: [LocalVariableAccess] a
# 15| getAnOperand/getRightOperand: [LocalVariableAccess] b
# 15| getBranch/getThen: [StmtSequence] c
# 15| getBranch/getThen: [StmtSequence] then ...
# 16| getStmt: [LocalVariableAccess] c
# 17| getBranch/getElse: [StmtSequence] d
# 17| getBranch/getElse: [StmtSequence] else ...
# 18| getStmt: [LocalVariableAccess] d
# 22| getStmt: [IfExpr] if ...
# 22| getCondition: [EqExpr] ... == ...
# 22| getAnOperand/getLeftOperand: [LocalVariableAccess] a
# 22| getAnOperand/getRightOperand: [IntegerLiteral] 0
# 22| getBranch/getThen: [StmtSequence] c
# 22| getBranch/getThen: [StmtSequence] then ...
# 23| getStmt: [LocalVariableAccess] c
# 24| getBranch/getElse: [IfExpr] elsif ...
# 24| getCondition: [EqExpr] ... == ...
# 24| getAnOperand/getLeftOperand: [LocalVariableAccess] a
# 24| getAnOperand/getRightOperand: [IntegerLiteral] 1
# 24| getBranch/getThen: [StmtSequence] d
# 24| getBranch/getThen: [StmtSequence] then ...
# 25| getStmt: [LocalVariableAccess] d
# 26| getBranch/getElse: [IfExpr] elsif ...
# 26| getCondition: [EqExpr] ... == ...
# 26| getAnOperand/getLeftOperand: [LocalVariableAccess] a
# 26| getAnOperand/getRightOperand: [IntegerLiteral] 2
# 26| getBranch/getThen: [StmtSequence] e
# 26| getBranch/getThen: [StmtSequence] then ...
# 27| getStmt: [LocalVariableAccess] e
# 28| getBranch/getElse: [StmtSequence] f
# 28| getBranch/getElse: [StmtSequence] else ...
# 29| getStmt: [LocalVariableAccess] f
# 33| getStmt: [IfExpr] if ...
# 33| getCondition: [EqExpr] ... == ...
# 33| getAnOperand/getLeftOperand: [LocalVariableAccess] a
# 33| getAnOperand/getRightOperand: [IntegerLiteral] 0
# 33| getBranch/getThen: [StmtSequence] b
# 33| getBranch/getThen: [StmtSequence] then ...
# 34| getStmt: [LocalVariableAccess] b
# 35| getBranch/getElse: [IfExpr] elsif ...
# 35| getCondition: [EqExpr] ... == ...
# 35| getAnOperand/getLeftOperand: [LocalVariableAccess] a
# 35| getAnOperand/getRightOperand: [IntegerLiteral] 1
# 35| getBranch/getThen: [StmtSequence] c
# 35| getBranch/getThen: [StmtSequence] then ...
# 36| getStmt: [LocalVariableAccess] c
# 40| getStmt: [UnlessExpr] unless ...
# 40| getCondition: [GTExpr] ... > ...
# 40| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] a
# 40| getAnOperand/getLesserOperand/getRightOperand: [LocalVariableAccess] b
# 40| getBranch/getThen: [StmtSequence] c
# 40| getBranch/getThen: [StmtSequence] then ...
# 41| getStmt: [LocalVariableAccess] c
# 45| getStmt: [UnlessExpr] unless ...
# 45| getCondition: [EqExpr] ... == ...
# 45| getAnOperand/getLeftOperand: [LocalVariableAccess] a
# 45| getAnOperand/getRightOperand: [LocalVariableAccess] b
# 45| getBranch/getThen: [StmtSequence] c
# 45| getBranch/getThen: [StmtSequence] then ...
# 46| getStmt: [LocalVariableAccess] c
# 47| getBranch/getElse: [StmtSequence] d
# 47| getBranch/getElse: [StmtSequence] else ...
# 48| getStmt: [LocalVariableAccess] d
# 52| getStmt: [IfModifierExpr] ... if ...
# 52| getBody/getBranch: [AssignExpr] ... = ...
@@ -671,6 +671,20 @@ control/conditionals.rb:
# 58| getBranch/getElse: [SubExpr] ... - ...
# 58| getAnOperand/getLeftOperand: [LocalVariableAccess] e
# 58| getAnOperand/getRightOperand: [IntegerLiteral] 2
# 61| getStmt: [IfExpr] if ...
# 61| getCondition: [GTExpr] ... > ...
# 61| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] a
# 61| getAnOperand/getLesserOperand/getRightOperand: [LocalVariableAccess] b
# 61| getBranch/getThen: [StmtSequence] then ...
# 62| getStmt: [LocalVariableAccess] c
# 63| getBranch/getElse: [StmtSequence] else ...
# 67| getStmt: [IfExpr] if ...
# 67| getCondition: [GTExpr] ... > ...
# 67| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] a
# 67| getAnOperand/getLesserOperand/getRightOperand: [LocalVariableAccess] b
# 67| getBranch/getThen: [StmtSequence] then ...
# 68| getBranch/getElse: [StmtSequence] else ...
# 69| getStmt: [LocalVariableAccess] c
constants/constants.rb:
# 1| [Toplevel] constants.rb
# 1| getStmt: [Module] ModuleA
@@ -973,31 +987,31 @@ literals/literals.rb:
# 114| getValue: [IntegerLiteral] 7
# 114| getElement: [HashSplatArgument] **...
# 114| getValue: [MethodCall] call to bar
# 117| getStmt: [ParenthesizedExpr] (_ .. _)
# 117| getStmt: [ParenthesizedExpr] ( ... )
# 117| getStmt: [RangeLiteral] _ .. _
# 117| getBegin: [IntegerLiteral] 1
# 117| getEnd: [IntegerLiteral] 10
# 118| getStmt: [ParenthesizedExpr] (_ ... _)
# 118| getStmt: [ParenthesizedExpr] ( ... )
# 118| getStmt: [RangeLiteral] _ ... _
# 118| getBegin: [IntegerLiteral] 1
# 118| getEnd: [IntegerLiteral] 10
# 119| getStmt: [ParenthesizedExpr] (_ .. _)
# 119| getStmt: [ParenthesizedExpr] ( ... )
# 119| getStmt: [RangeLiteral] _ .. _
# 119| getBegin: [IntegerLiteral] 1
# 119| getEnd: [IntegerLiteral] 0
# 120| getStmt: [ParenthesizedExpr] (_ .. _)
# 120| getStmt: [ParenthesizedExpr] ( ... )
# 120| getStmt: [RangeLiteral] _ .. _
# 120| getBegin: [MethodCall] call to start
# 120| getEnd: [AddExpr] ... + ...
# 120| getAnOperand/getLeftOperand: [IntegerLiteral] 2
# 120| getAnOperand/getRightOperand: [IntegerLiteral] 3
# 121| getStmt: [ParenthesizedExpr] (_ .. _)
# 121| getStmt: [ParenthesizedExpr] ( ... )
# 121| getStmt: [RangeLiteral] _ .. _
# 121| getBegin: [IntegerLiteral] 1
# 122| getStmt: [ParenthesizedExpr] (_ .. _)
# 122| getStmt: [ParenthesizedExpr] ( ... )
# 122| getStmt: [RangeLiteral] _ .. _
# 122| getEnd: [IntegerLiteral] 1
# 123| getStmt: [ParenthesizedExpr] (... - ...)
# 123| getStmt: [ParenthesizedExpr] ( ... )
# 123| getStmt: [SubExpr] ... - ...
# 123| getAnOperand/getLeftOperand: [RangeLiteral] _ .. _
# 123| getBegin: [IntegerLiteral] 0
@@ -1144,7 +1158,7 @@ control/loops.rb:
# 9| getValue: [RangeLiteral] _ .. _
# 9| getBegin: [IntegerLiteral] 1
# 9| getEnd: [IntegerLiteral] 10
# 9| getBody: [StmtSequence] ...; ...
# 9| getBody: [StmtSequence] do ...
# 10| getStmt: [AssignAddExpr] ... += ...
# 10| getAnOperand/getLeftOperand: [LocalVariableAccess] sum
# 10| getAnOperand/getRightOperand: [LocalVariableAccess] n
@@ -1157,7 +1171,7 @@ control/loops.rb:
# 16| getValue: [RangeLiteral] _ .. _
# 16| getBegin: [IntegerLiteral] 1
# 16| getEnd: [IntegerLiteral] 10
# 16| getBody: [StmtSequence] ...; ...
# 16| getBody: [StmtSequence] do ...
# 17| getStmt: [AssignAddExpr] ... += ...
# 17| getAnOperand/getLeftOperand: [LocalVariableAccess] sum
# 17| getAnOperand/getRightOperand: [LocalVariableAccess] n
@@ -1176,7 +1190,7 @@ control/loops.rb:
# 22| getElement: [Pair] Pair
# 22| getKey: [SymbolLiteral] :bar
# 22| getValue: [IntegerLiteral] 1
# 22| getBody: [StmtSequence] ...; ...
# 22| getBody: [StmtSequence] do ...
# 23| getStmt: [AssignAddExpr] ... += ...
# 23| getAnOperand/getLeftOperand: [LocalVariableAccess] sum
# 23| getAnOperand/getRightOperand: [LocalVariableAccess] value
@@ -1195,7 +1209,7 @@ control/loops.rb:
# 28| getElement: [Pair] Pair
# 28| getKey: [SymbolLiteral] :bar
# 28| getValue: [IntegerLiteral] 1
# 28| getBody: [StmtSequence] ...; ...
# 28| getBody: [StmtSequence] do ...
# 29| getStmt: [AssignAddExpr] ... += ...
# 29| getAnOperand/getLeftOperand: [LocalVariableAccess] sum
# 29| getAnOperand/getRightOperand: [LocalVariableAccess] value
@@ -1207,7 +1221,7 @@ control/loops.rb:
# 35| getCondition: [LTExpr] ... < ...
# 35| getAnOperand/getLeftOperand/getLesserOperand: [LocalVariableAccess] x
# 35| getAnOperand/getGreaterOperand/getRightOperand: [LocalVariableAccess] y
# 35| getBody: [StmtSequence] ...; ...
# 35| getBody: [StmtSequence] do ...
# 36| getStmt: [AssignAddExpr] ... += ...
# 36| getAnOperand/getLeftOperand: [LocalVariableAccess] x
# 36| getAnOperand/getRightOperand: [IntegerLiteral] 1
@@ -1219,7 +1233,7 @@ control/loops.rb:
# 42| getCondition: [LTExpr] ... < ...
# 42| getAnOperand/getLeftOperand/getLesserOperand: [LocalVariableAccess] x
# 42| getAnOperand/getGreaterOperand/getRightOperand: [LocalVariableAccess] y
# 42| getBody: [StmtSequence] ...; ...
# 42| getBody: [StmtSequence] do ...
# 43| getStmt: [AssignAddExpr] ... += ...
# 43| getAnOperand/getLeftOperand: [LocalVariableAccess] x
# 43| getAnOperand/getRightOperand: [IntegerLiteral] 1
@@ -1237,7 +1251,7 @@ control/loops.rb:
# 51| getCondition: [EqExpr] ... == ...
# 51| getAnOperand/getLeftOperand: [LocalVariableAccess] x
# 51| getAnOperand/getRightOperand: [LocalVariableAccess] y
# 51| getBody: [StmtSequence] ...; ...
# 51| getBody: [StmtSequence] do ...
# 52| getStmt: [AssignAddExpr] ... += ...
# 52| getAnOperand/getLeftOperand: [LocalVariableAccess] x
# 52| getAnOperand/getRightOperand: [IntegerLiteral] 1
@@ -1248,7 +1262,7 @@ control/loops.rb:
# 57| getCondition: [GTExpr] ... > ...
# 57| getAnOperand/getGreaterOperand/getLeftOperand: [LocalVariableAccess] x
# 57| getAnOperand/getLesserOperand/getRightOperand: [LocalVariableAccess] y
# 57| getBody: [StmtSequence] ...; ...
# 57| getBody: [StmtSequence] do ...
# 58| getStmt: [AssignAddExpr] ... += ...
# 58| getAnOperand/getLeftOperand: [LocalVariableAccess] x
# 58| getAnOperand/getRightOperand: [IntegerLiteral] 1
@@ -1262,6 +1276,11 @@ control/loops.rb:
# 63| getCondition: [EqExpr] ... == ...
# 63| getAnOperand/getLeftOperand: [LocalVariableAccess] x
# 63| getAnOperand/getRightOperand: [IntegerLiteral] 0
# 66| getStmt: [WhileExpr] while ...
# 66| getCondition: [LTExpr] ... < ...
# 66| getAnOperand/getLeftOperand/getLesserOperand: [LocalVariableAccess] x
# 66| getAnOperand/getGreaterOperand/getRightOperand: [LocalVariableAccess] y
# 66| getBody: [StmtSequence] do ...
misc/misc.rb:
# 1| [Toplevel] misc.rb
# 1| getStmt: [AssignExpr] ... = ...

View File

@@ -3,20 +3,20 @@ caseValues
caseNoValues
| cases.rb:18:1:22:3 | case ... |
caseElseBranches
| cases.rb:8:1:15:3 | case ... | cases.rb:13:1:14:7 | 300 |
| cases.rb:8:1:15:3 | case ... | cases.rb:13:1:14:7 | else ... |
caseNoElseBranches
| cases.rb:18:1:22: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 | 100 |
| 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 | 200 |
| cases.rb:8:1:15:3 | case ... | cases.rb:11:1:12:7 | when ... | 1 | cases.rb:11:9:11:9 | d | cases.rb:11:10:12:7 | 200 |
| cases.rb:18:1:22:3 | case ... | cases.rb:19:1:19:19 | when ... | 0 | cases.rb:19:6:19:10 | ... > ... | cases.rb:19:13:19:19 | 10 |
| cases.rb:18:1:22:3 | case ... | cases.rb:20:1:20:19 | when ... | 0 | cases.rb:20:6:20:11 | ... == ... | cases.rb:20:13:20:19 | 20 |
| cases.rb:18:1:22:3 | case ... | cases.rb:21:1:21:19 | when ... | 0 | cases.rb:21:6:21:10 | ... < ... | cases.rb:21:13:21:19 | 30 |
| 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 ... |
| cases.rb:8:1:15:3 | case ... | cases.rb:11:1:12:7 | when ... | 1 | cases.rb:11:9:11:9 | d | cases.rb:11:10:12:7 | then ... |
| cases.rb:18:1:22:3 | case ... | cases.rb:19:1:19:19 | when ... | 0 | cases.rb:19:6:19:10 | ... > ... | cases.rb:19:13:19:19 | then ... |
| cases.rb:18:1:22:3 | case ... | cases.rb:20:1:20:19 | when ... | 0 | cases.rb:20:6:20:11 | ... == ... | cases.rb:20:13:20:19 | then ... |
| cases.rb:18:1:22:3 | case ... | cases.rb:21:1:21:19 | when ... | 0 | cases.rb:21:6:21:10 | ... < ... | cases.rb:21:13:21:19 | then ... |
caseAllBranches
| cases.rb:8:1:15:3 | case ... | 0 | cases.rb:9:1:10:7 | when ... |
| cases.rb:8:1:15:3 | case ... | 1 | cases.rb:11:1:12:7 | when ... |
| cases.rb:8:1:15:3 | case ... | 2 | cases.rb:13:1:14:7 | 300 |
| cases.rb:8:1:15:3 | case ... | 2 | cases.rb:13:1:14:7 | else ... |
| 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 ... |

View File

@@ -1,34 +1,40 @@
conditionalExprs
| conditionals.rb:10:1:12:3 | if ... | IfExpr | conditionals.rb:10:4:10:8 | ... > ... | conditionals.rb:10:10:11:5 | c | true |
| conditionals.rb:15:1:19:3 | if ... | IfExpr | conditionals.rb:15:4:15:9 | ... == ... | conditionals.rb:15:10:16:5 | c | true |
| conditionals.rb:15:1:19:3 | if ... | IfExpr | conditionals.rb:15:4:15:9 | ... == ... | conditionals.rb:17:1:18:5 | d | false |
| conditionals.rb:22:1:30:3 | if ... | IfExpr | conditionals.rb:22:4:22:9 | ... == ... | conditionals.rb:22:11:23:5 | c | true |
| conditionals.rb:10:1:12:3 | if ... | IfExpr | conditionals.rb:10:4:10:8 | ... > ... | conditionals.rb:10:10:11:5 | then ... | true |
| conditionals.rb:15:1:19:3 | if ... | IfExpr | conditionals.rb:15:4:15:9 | ... == ... | conditionals.rb:15:10:16:5 | then ... | true |
| conditionals.rb:15:1:19:3 | if ... | IfExpr | conditionals.rb:15:4:15:9 | ... == ... | conditionals.rb:17:1:18:5 | else ... | false |
| conditionals.rb:22:1:30:3 | if ... | IfExpr | conditionals.rb:22:4:22:9 | ... == ... | conditionals.rb:22:11:23:5 | then ... | true |
| conditionals.rb:22:1:30:3 | if ... | IfExpr | conditionals.rb:22:4:22:9 | ... == ... | conditionals.rb:24:1:29:5 | elsif ... | false |
| conditionals.rb:24:1:29:5 | elsif ... | IfExpr | conditionals.rb:24:7:24:12 | ... == ... | conditionals.rb:24:14:25:5 | d | true |
| conditionals.rb:24:1:29:5 | elsif ... | IfExpr | conditionals.rb:24:7:24:12 | ... == ... | conditionals.rb:24:14:25:5 | then ... | true |
| conditionals.rb:24:1:29:5 | elsif ... | IfExpr | conditionals.rb:24:7:24:12 | ... == ... | conditionals.rb:26:1:29:5 | elsif ... | false |
| conditionals.rb:26:1:29:5 | elsif ... | IfExpr | conditionals.rb:26:7:26:12 | ... == ... | conditionals.rb:26:14:27:5 | e | true |
| conditionals.rb:26:1:29:5 | elsif ... | IfExpr | conditionals.rb:26:7:26:12 | ... == ... | conditionals.rb:28:1:29:5 | f | false |
| conditionals.rb:33:1:37:3 | if ... | IfExpr | conditionals.rb:33:4:33:9 | ... == ... | conditionals.rb:33:10:34:5 | b | true |
| conditionals.rb:26:1:29:5 | elsif ... | IfExpr | conditionals.rb:26:7:26:12 | ... == ... | conditionals.rb:26:14:27:5 | then ... | true |
| conditionals.rb:26:1:29:5 | elsif ... | IfExpr | conditionals.rb:26:7:26:12 | ... == ... | conditionals.rb:28:1:29:5 | else ... | false |
| conditionals.rb:33:1:37:3 | if ... | IfExpr | conditionals.rb:33:4:33:9 | ... == ... | conditionals.rb:33:10:34:5 | then ... | true |
| conditionals.rb:33:1:37:3 | if ... | IfExpr | conditionals.rb:33:4:33:9 | ... == ... | conditionals.rb:35:1:36:5 | elsif ... | false |
| conditionals.rb:35:1:36:5 | elsif ... | IfExpr | conditionals.rb:35:7:35:12 | ... == ... | conditionals.rb:35:13:36:5 | c | true |
| conditionals.rb:40:1:42:3 | unless ... | UnlessExpr | conditionals.rb:40:8:40:12 | ... > ... | conditionals.rb:40:14:41:5 | c | false |
| conditionals.rb:45:1:49:3 | unless ... | UnlessExpr | conditionals.rb:45:8:45:13 | ... == ... | conditionals.rb:45:14:46:5 | c | false |
| conditionals.rb:45:1:49:3 | unless ... | UnlessExpr | conditionals.rb:45:8:45:13 | ... == ... | conditionals.rb:47:1:48:5 | d | true |
| conditionals.rb:35:1:36:5 | elsif ... | IfExpr | conditionals.rb:35:7:35:12 | ... == ... | conditionals.rb:35:13:36:5 | then ... | true |
| conditionals.rb:40:1:42:3 | unless ... | UnlessExpr | conditionals.rb:40:8:40:12 | ... > ... | conditionals.rb:40:14:41:5 | then ... | false |
| conditionals.rb:45:1:49:3 | unless ... | UnlessExpr | conditionals.rb:45:8:45:13 | ... == ... | conditionals.rb:45:14:46:5 | then ... | false |
| conditionals.rb:45:1:49:3 | unless ... | UnlessExpr | conditionals.rb:45:8:45:13 | ... == ... | conditionals.rb:47:1:48:5 | else ... | true |
| conditionals.rb:52:1:52:14 | ... if ... | IfModifierExpr | conditionals.rb:52:10:52:14 | ... > ... | conditionals.rb:52:1:52:5 | ... = ... | true |
| conditionals.rb:55:1:55:18 | ... unless ... | UnlessModifierExpr | conditionals.rb:55:14:55:18 | ... < ... | conditionals.rb:55:1:55:5 | ... = ... | false |
| conditionals.rb:58:5:58:25 | ... ? ... : ... | TernaryIfExpr | conditionals.rb:58:5:58:9 | ... > ... | conditionals.rb:58:13:58:17 | ... + ... | true |
| conditionals.rb:58:5:58:25 | ... ? ... : ... | TernaryIfExpr | conditionals.rb:58:5:58:9 | ... > ... | conditionals.rb:58:21:58:25 | ... - ... | false |
| conditionals.rb:61:1:64:3 | if ... | IfExpr | conditionals.rb:61:4:61:8 | ... > ... | conditionals.rb:61:10:62:5 | then ... | true |
| conditionals.rb:61:1:64:3 | if ... | IfExpr | conditionals.rb:61:4:61:8 | ... > ... | conditionals.rb:63:1:63:4 | else ... | false |
| conditionals.rb:67:1:70:3 | if ... | IfExpr | conditionals.rb:67:4:67:8 | ... > ... | conditionals.rb:67:10:67:13 | then ... | true |
| conditionals.rb:67:1:70:3 | if ... | IfExpr | conditionals.rb:67:4:67:8 | ... > ... | conditionals.rb:68:1:69:5 | else ... | false |
ifExprs
| conditionals.rb:10:1:12:3 | if ... | IfExpr | conditionals.rb:10:4:10:8 | ... > ... | conditionals.rb:10:10:11:5 | c | (none) | false |
| conditionals.rb:15:1:19:3 | if ... | IfExpr | conditionals.rb:15:4:15:9 | ... == ... | conditionals.rb:15:10:16:5 | c | d | false |
| conditionals.rb:22:1:30:3 | if ... | IfExpr | conditionals.rb:22:4:22:9 | ... == ... | conditionals.rb:22:11:23:5 | c | elsif ... | false |
| conditionals.rb:24:1:29:5 | elsif ... | IfExpr | conditionals.rb:24:7:24:12 | ... == ... | conditionals.rb:24:14:25:5 | d | elsif ... | true |
| conditionals.rb:26:1:29:5 | elsif ... | IfExpr | conditionals.rb:26:7:26:12 | ... == ... | conditionals.rb:26:14:27:5 | e | f | true |
| conditionals.rb:33:1:37:3 | if ... | IfExpr | conditionals.rb:33:4:33:9 | ... == ... | conditionals.rb:33:10:34:5 | b | elsif ... | false |
| conditionals.rb:35:1:36:5 | elsif ... | IfExpr | conditionals.rb:35:7:35:12 | ... == ... | conditionals.rb:35:13:36:5 | c | (none) | true |
| conditionals.rb:10:1:12:3 | if ... | IfExpr | conditionals.rb:10:4:10:8 | ... > ... | conditionals.rb:10:10:11:5 | then ... | (none) | false |
| conditionals.rb:15:1:19:3 | if ... | IfExpr | conditionals.rb:15:4:15:9 | ... == ... | conditionals.rb:15:10:16:5 | then ... | else ... | false |
| conditionals.rb:22:1:30:3 | if ... | IfExpr | conditionals.rb:22:4:22:9 | ... == ... | conditionals.rb:22:11:23:5 | then ... | elsif ... | false |
| conditionals.rb:24:1:29:5 | elsif ... | IfExpr | conditionals.rb:24:7:24:12 | ... == ... | conditionals.rb:24:14:25:5 | then ... | elsif ... | true |
| conditionals.rb:26:1:29:5 | elsif ... | IfExpr | conditionals.rb:26:7:26:12 | ... == ... | conditionals.rb:26:14:27:5 | then ... | else ... | true |
| conditionals.rb:33:1:37:3 | if ... | IfExpr | conditionals.rb:33:4:33:9 | ... == ... | conditionals.rb:33:10:34:5 | then ... | elsif ... | false |
| conditionals.rb:35:1:36:5 | elsif ... | IfExpr | conditionals.rb:35:7:35:12 | ... == ... | conditionals.rb:35:13:36:5 | then ... | (none) | true |
| conditionals.rb:61:1:64:3 | if ... | IfExpr | conditionals.rb:61:4:61:8 | ... > ... | conditionals.rb:61:10:62:5 | then ... | else ... | false |
| conditionals.rb:67:1:70:3 | if ... | IfExpr | conditionals.rb:67:4:67:8 | ... > ... | conditionals.rb:67:10:67:13 | then ... | else ... | false |
unlessExprs
| conditionals.rb:40:1:42:3 | unless ... | UnlessExpr | conditionals.rb:40:8:40:12 | ... > ... | conditionals.rb:40:14:41:5 | c | (none) |
| conditionals.rb:45:1:49:3 | unless ... | UnlessExpr | conditionals.rb:45:8:45:13 | ... == ... | conditionals.rb:45:14:46:5 | c | d |
| conditionals.rb:40:1:42:3 | unless ... | UnlessExpr | conditionals.rb:40:8:40:12 | ... > ... | conditionals.rb:40:14:41:5 | then ... | (none) |
| conditionals.rb:45:1:49:3 | unless ... | UnlessExpr | conditionals.rb:45:8:45:13 | ... == ... | conditionals.rb:45:14:46:5 | then ... | else ... |
ifModifierExprs
| conditionals.rb:52:1:52:14 | ... if ... | IfModifierExpr | conditionals.rb:52:10:52:14 | ... > ... | conditionals.rb:52:1:52:5 | ... = ... |
unlessModifierExprs

View File

@@ -12,6 +12,8 @@
| conditionals.rb:52:1:52:14 | ... if ... | IfModifierExpr |
| conditionals.rb:55:1:55:18 | ... unless ... | UnlessModifierExpr |
| conditionals.rb:58:5:58:25 | ... ? ... : ... | TernaryIfExpr |
| conditionals.rb:61:1:64:3 | if ... | IfExpr |
| conditionals.rb:67:1:70:3 | if ... | IfExpr |
| loops.rb:9:1:12:3 | for ... in ... | ForExpr |
| loops.rb:16:1:19:3 | for ... in ... | ForExpr |
| loops.rb:22:1:25:3 | for ... in ... | ForExpr |
@@ -22,3 +24,4 @@
| loops.rb:51:1:54:3 | until ... | UntilExpr |
| loops.rb:57:1:60:3 | until ... | UntilExpr |
| loops.rb:63:1:63:19 | ... until ... | UntilModifierExpr |
| loops.rb:66:1:67:3 | while ... | WhileExpr |

View File

@@ -1,48 +1,50 @@
loops
| loops.rb:9:1:12:3 | for ... in ... | ForExpr | loops.rb:9:15:12:3 | ...; ... | StmtSequence |
| loops.rb:16:1:19:3 | for ... in ... | ForExpr | loops.rb:16:15:19:3 | ...; ... | StmtSequence |
| loops.rb:22:1:25:3 | for ... in ... | ForExpr | loops.rb:22:35:25:3 | ...; ... | StmtSequence |
| loops.rb:28:1:32:3 | for ... in ... | ForExpr | loops.rb:28:37:32:3 | ...; ... | StmtSequence |
| loops.rb:35:1:39:3 | while ... | WhileExpr | loops.rb:35:12:39:3 | ...; ... | StmtSequence |
| loops.rb:42:1:45:3 | while ... | WhileExpr | loops.rb:42:13:45:3 | ...; ... | StmtSequence |
| loops.rb:9:1:12:3 | for ... in ... | ForExpr | loops.rb:9:15:12:3 | do ... | StmtSequence |
| loops.rb:16:1:19:3 | for ... in ... | ForExpr | loops.rb:16:15:19:3 | do ... | StmtSequence |
| loops.rb:22:1:25:3 | for ... in ... | ForExpr | loops.rb:22:35:25:3 | do ... | StmtSequence |
| loops.rb:28:1:32:3 | for ... in ... | ForExpr | loops.rb:28:37:32:3 | do ... | StmtSequence |
| loops.rb:35:1:39:3 | while ... | WhileExpr | loops.rb:35:12:39:3 | do ... | StmtSequence |
| loops.rb:42:1:45:3 | while ... | WhileExpr | loops.rb:42:13:45:3 | do ... | StmtSequence |
| loops.rb:48:1:48:19 | ... while ... | WhileModifierExpr | loops.rb:48:1:48:6 | ... += ... | AssignAddExpr |
| loops.rb:51:1:54:3 | until ... | UntilExpr | loops.rb:51:13:54:3 | ...; ... | StmtSequence |
| loops.rb:57:1:60:3 | until ... | UntilExpr | loops.rb:57:13:60:3 | ...; ... | StmtSequence |
| loops.rb:51:1:54:3 | until ... | UntilExpr | loops.rb:51:13:54:3 | do ... | StmtSequence |
| loops.rb:57:1:60:3 | until ... | UntilExpr | loops.rb:57:13:60:3 | do ... | StmtSequence |
| loops.rb:63:1:63:19 | ... until ... | UntilModifierExpr | loops.rb:63:1:63:6 | ... -= ... | AssignSubExpr |
| loops.rb:66:1:67:3 | while ... | WhileExpr | loops.rb:66:13:67:3 | do ... | StmtSequence |
conditionalLoops
| loops.rb:35:1:39:3 | while ... | WhileExpr | loops.rb:35:7:35:11 | ... < ... | loops.rb:35:12:39:3 | ...; ... | StmtSequence |
| loops.rb:42:1:45:3 | while ... | WhileExpr | loops.rb:42:7:42:11 | ... < ... | loops.rb:42:13:45:3 | ...; ... | StmtSequence |
| loops.rb:35:1:39:3 | while ... | WhileExpr | loops.rb:35:7:35:11 | ... < ... | loops.rb:35:12:39:3 | do ... | StmtSequence |
| loops.rb:42:1:45:3 | while ... | WhileExpr | loops.rb:42:7:42:11 | ... < ... | loops.rb:42:13:45:3 | do ... | StmtSequence |
| loops.rb:48:1:48:19 | ... while ... | WhileModifierExpr | loops.rb:48:14:48:19 | ... >= ... | loops.rb:48:1:48:6 | ... += ... | AssignAddExpr |
| loops.rb:51:1:54:3 | until ... | UntilExpr | loops.rb:51:7:51:12 | ... == ... | loops.rb:51:13:54:3 | ...; ... | StmtSequence |
| loops.rb:57:1:60:3 | until ... | UntilExpr | loops.rb:57:7:57:11 | ... > ... | loops.rb:57:13:60:3 | ...; ... | StmtSequence |
| loops.rb:51:1:54:3 | until ... | UntilExpr | loops.rb:51:7:51:12 | ... == ... | loops.rb:51:13:54:3 | do ... | StmtSequence |
| loops.rb:57:1:60:3 | until ... | UntilExpr | loops.rb:57:7:57:11 | ... > ... | loops.rb:57:13:60:3 | do ... | StmtSequence |
| loops.rb:63:1:63:19 | ... until ... | UntilModifierExpr | loops.rb:63:14:63:19 | ... == ... | loops.rb:63:1:63:6 | ... -= ... | AssignSubExpr |
| loops.rb:66:1:67:3 | while ... | WhileExpr | loops.rb:66:7:66:11 | ... < ... | loops.rb:66:13:67:3 | do ... | StmtSequence |
forExprs
| loops.rb:9:1:12:3 | for ... in ... | loops.rb:9:5:9:5 | n | loops.rb:9:15:12:3 | ...; ... | 0 | loops.rb:10:5:10:12 | ... += ... |
| loops.rb:9:1:12:3 | for ... in ... | loops.rb:9:5:9:5 | n | loops.rb:9:15:12:3 | ...; ... | 1 | loops.rb:11:5:11:11 | ... = ... |
| loops.rb:16:1:19:3 | for ... in ... | loops.rb:16:5:16:5 | n | loops.rb:16:15:19:3 | ...; ... | 0 | loops.rb:17:5:17:12 | ... += ... |
| loops.rb:16:1:19:3 | for ... in ... | loops.rb:16:5:16:5 | n | loops.rb:16:15:19:3 | ...; ... | 1 | loops.rb:18:5:18:12 | ... -= ... |
| loops.rb:22:1:25:3 | for ... in ... | loops.rb:22:5:22:14 | (..., ...) | loops.rb:22:35:25:3 | ...; ... | 0 | loops.rb:23:3:23:14 | ... += ... |
| loops.rb:22:1:25:3 | for ... in ... | loops.rb:22:5:22:14 | (..., ...) | loops.rb:22:35:25:3 | ...; ... | 1 | loops.rb:24:3:24:14 | ... *= ... |
| loops.rb:28:1:32:3 | for ... in ... | loops.rb:28:5:28:16 | (..., ...) | loops.rb:28:37:32:3 | ...; ... | 0 | loops.rb:29:3:29:14 | ... += ... |
| loops.rb:28:1:32:3 | for ... in ... | loops.rb:28:5:28:16 | (..., ...) | loops.rb:28:37:32:3 | ...; ... | 1 | loops.rb:30:3:30:14 | ... /= ... |
| loops.rb:28:1:32:3 | for ... in ... | loops.rb:28:5:28:16 | (..., ...) | loops.rb:28:37:32:3 | ...; ... | 2 | loops.rb:31:3:31:7 | break |
| loops.rb:9:1:12:3 | for ... in ... | loops.rb:9:5:9:5 | n | loops.rb:9:15:12:3 | do ... | 0 | loops.rb:10:5:10:12 | ... += ... |
| loops.rb:9:1:12:3 | for ... in ... | loops.rb:9:5:9:5 | n | loops.rb:9:15:12:3 | do ... | 1 | loops.rb:11:5:11:11 | ... = ... |
| loops.rb:16:1:19:3 | for ... in ... | loops.rb:16:5:16:5 | n | loops.rb:16:15:19:3 | do ... | 0 | loops.rb:17:5:17:12 | ... += ... |
| loops.rb:16:1:19:3 | for ... in ... | loops.rb:16:5:16:5 | n | loops.rb:16:15:19:3 | do ... | 1 | loops.rb:18:5:18:12 | ... -= ... |
| loops.rb:22:1:25:3 | for ... in ... | loops.rb:22:5:22:14 | (..., ...) | loops.rb:22:35:25:3 | do ... | 0 | loops.rb:23:3:23:14 | ... += ... |
| loops.rb:22:1:25:3 | for ... in ... | loops.rb:22:5:22:14 | (..., ...) | loops.rb:22:35:25:3 | do ... | 1 | loops.rb:24:3:24:14 | ... *= ... |
| loops.rb:28:1:32:3 | for ... in ... | loops.rb:28:5:28:16 | (..., ...) | loops.rb:28:37:32:3 | do ... | 0 | loops.rb:29:3:29:14 | ... += ... |
| loops.rb:28:1:32:3 | for ... in ... | loops.rb:28:5:28:16 | (..., ...) | loops.rb:28:37:32:3 | do ... | 1 | loops.rb:30:3:30:14 | ... /= ... |
| loops.rb:28:1:32:3 | for ... in ... | loops.rb:28:5:28:16 | (..., ...) | loops.rb:28:37:32:3 | do ... | 2 | loops.rb:31:3:31:7 | break |
forExprsTuplePatterns
| loops.rb:22:1:25:3 | for ... in ... | loops.rb:22:5:22:14 | (..., ...) | 0 | loops.rb:22:5:22:7 | key |
| loops.rb:22:1:25:3 | for ... in ... | loops.rb:22:5:22:14 | (..., ...) | 1 | loops.rb:22:10:22:14 | value |
| loops.rb:28:1:32:3 | for ... in ... | loops.rb:28:5:28:16 | (..., ...) | 0 | loops.rb:28:6:28:8 | key |
| loops.rb:28:1:32:3 | for ... in ... | loops.rb:28:5:28:16 | (..., ...) | 1 | loops.rb:28:11:28:15 | value |
whileExprs
| loops.rb:35:1:39:3 | while ... | loops.rb:35:7:35:11 | ... < ... | loops.rb:35:12:39:3 | ...; ... | 0 | loops.rb:36:3:36:8 | ... += ... |
| loops.rb:35:1:39:3 | while ... | loops.rb:35:7:35:11 | ... < ... | loops.rb:35:12:39:3 | ...; ... | 1 | loops.rb:37:3:37:8 | ... += ... |
| loops.rb:35:1:39:3 | while ... | loops.rb:35:7:35:11 | ... < ... | loops.rb:35:12:39:3 | ...; ... | 2 | loops.rb:38:3:38:6 | next |
| loops.rb:42:1:45:3 | while ... | loops.rb:42:7:42:11 | ... < ... | loops.rb:42:13:45:3 | ...; ... | 0 | loops.rb:43:3:43:8 | ... += ... |
| loops.rb:42:1:45:3 | while ... | loops.rb:42:7:42:11 | ... < ... | loops.rb:42:13:45:3 | ...; ... | 1 | loops.rb:44:3:44:8 | ... += ... |
| loops.rb:35:1:39:3 | while ... | loops.rb:35:7:35:11 | ... < ... | loops.rb:35:12:39:3 | do ... | 0 | loops.rb:36:3:36:8 | ... += ... |
| loops.rb:35:1:39:3 | while ... | loops.rb:35:7:35:11 | ... < ... | loops.rb:35:12:39:3 | do ... | 1 | loops.rb:37:3:37:8 | ... += ... |
| loops.rb:35:1:39:3 | while ... | loops.rb:35:7:35:11 | ... < ... | loops.rb:35:12:39:3 | do ... | 2 | loops.rb:38:3:38:6 | next |
| loops.rb:42:1:45:3 | while ... | loops.rb:42:7:42:11 | ... < ... | loops.rb:42:13:45:3 | do ... | 0 | loops.rb:43:3:43:8 | ... += ... |
| loops.rb:42:1:45:3 | while ... | loops.rb:42:7:42:11 | ... < ... | loops.rb:42:13:45:3 | do ... | 1 | loops.rb:44:3:44:8 | ... += ... |
whileModifierExprs
| loops.rb:48:1:48:19 | ... while ... | loops.rb:48:14:48:19 | ... >= ... | loops.rb:48:1:48:6 | ... += ... |
untilExprs
| loops.rb:51:1:54:3 | until ... | loops.rb:51:7:51:12 | ... == ... | loops.rb:51:13:54:3 | ...; ... | 0 | loops.rb:52:3:52:8 | ... += ... |
| loops.rb:51:1:54:3 | until ... | loops.rb:51:7:51:12 | ... == ... | loops.rb:51:13:54:3 | ...; ... | 1 | loops.rb:53:3:53:8 | ... -= ... |
| loops.rb:57:1:60:3 | until ... | loops.rb:57:7:57:11 | ... > ... | loops.rb:57:13:60:3 | ...; ... | 0 | loops.rb:58:3:58:8 | ... += ... |
| loops.rb:57:1:60:3 | until ... | loops.rb:57:7:57:11 | ... > ... | loops.rb:57:13:60:3 | ...; ... | 1 | loops.rb:59:3:59:8 | ... -= ... |
| loops.rb:51:1:54:3 | until ... | loops.rb:51:7:51:12 | ... == ... | loops.rb:51:13:54:3 | do ... | 0 | loops.rb:52:3:52:8 | ... += ... |
| loops.rb:51:1:54:3 | until ... | loops.rb:51:7:51:12 | ... == ... | loops.rb:51:13:54:3 | do ... | 1 | loops.rb:53:3:53:8 | ... -= ... |
| loops.rb:57:1:60:3 | until ... | loops.rb:57:7:57:11 | ... > ... | loops.rb:57:13:60:3 | do ... | 0 | loops.rb:58:3:58:8 | ... += ... |
| loops.rb:57:1:60:3 | until ... | loops.rb:57:7:57:11 | ... > ... | loops.rb:57:13:60:3 | do ... | 1 | loops.rb:59:3:59:8 | ... -= ... |
untilModifierExprs
| loops.rb:63:1:63:19 | ... until ... | loops.rb:63:14:63:19 | ... == ... | loops.rb:63:1:63:6 | ... -= ... |

View File

@@ -55,4 +55,16 @@ a = b if c > d
a = b unless c < d
# Ternary if expr
a = b > c ? d + 1 : e - 2
a = b > c ? d + 1 : e - 2
# If expr with empty else (treated as no else)
if a > b then
c
else
end
# If expr with empty then (treated as no then)
if a > b then
else
c
end

View File

@@ -60,4 +60,8 @@ until x > y do
end
# Until-modified expression
x -= 1 until x == 0
x -= 1 until x == 0
# While loop with empty `do` block
while x < y do
end

File diff suppressed because it is too large Load Diff

View File

@@ -42,3 +42,11 @@ def constant_condition()
puts "Impossible"
end
end
def empty_else b
if b then
puts "true"
else
end
puts "done"
end

View File

@@ -25,4 +25,9 @@ def m3
[1,2,3].each do |x|
puts x
end
end
end
def m4(x, y)
while x < y do
end
end

View File

@@ -3,20 +3,20 @@
| local_dataflow.rb:2:7:2:7 | a | local_dataflow.rb:2:3:2:7 | ... = ... |
| local_dataflow.rb:2:7:2:7 | a | local_dataflow.rb:2:3:2:7 | ... = ... |
| local_dataflow.rb:2:7:2:7 | a | local_dataflow.rb:3:10:3:10 | a |
| local_dataflow.rb:3:7:3:14 | (...; ...) | local_dataflow.rb:3:3:3:14 | ... = ... |
| local_dataflow.rb:3:7:3:14 | ( ... ) | local_dataflow.rb:3:3:3:14 | ... = ... |
| local_dataflow.rb:3:10:3:10 | [post] a | local_dataflow.rb:4:11:4:11 | a |
| local_dataflow.rb:3:10:3:10 | a | local_dataflow.rb:4:11:4:11 | a |
| local_dataflow.rb:3:13:3:13 | b | local_dataflow.rb:3:7:3:14 | (...; ...) |
| local_dataflow.rb:3:13:3:13 | b | local_dataflow.rb:3:7:3:14 | ( ... ) |
| local_dataflow.rb:3:13:3:13 | b | local_dataflow.rb:6:13:6:13 | b |
| local_dataflow.rb:4:7:4:11 | ... = ... | local_dataflow.rb:4:3:4:11 | ... = ... |
| local_dataflow.rb:4:11:4:11 | a | local_dataflow.rb:4:7:4:11 | ... = ... |
| local_dataflow.rb:4:11:4:11 | a | local_dataflow.rb:5:12:5:12 | a |
| local_dataflow.rb:5:7:5:13 | (... = ...) | local_dataflow.rb:5:3:5:13 | ... = ... |
| local_dataflow.rb:5:8:5:12 | ... = ... | local_dataflow.rb:5:7:5:13 | (... = ...) |
| local_dataflow.rb:5:7:5:13 | ( ... ) | local_dataflow.rb:5:3:5:13 | ... = ... |
| local_dataflow.rb:5:8:5:12 | ... = ... | local_dataflow.rb:5:7:5:13 | ( ... ) |
| local_dataflow.rb:5:12:5:12 | a | local_dataflow.rb:5:8:5:12 | ... = ... |
| local_dataflow.rb:5:12:5:12 | a | local_dataflow.rb:6:8:6:8 | a |
| local_dataflow.rb:6:7:6:14 | (... += ...) | local_dataflow.rb:6:3:6:14 | ... = ... |
| local_dataflow.rb:6:8:6:13 | ... += ... | local_dataflow.rb:6:7:6:14 | (... += ...) |
| local_dataflow.rb:6:7:6:14 | ( ... ) | local_dataflow.rb:6:3:6:14 | ... = ... |
| local_dataflow.rb:6:8:6:13 | ... += ... | local_dataflow.rb:6:7:6:14 | ( ... ) |
| local_dataflow.rb:9:1:9:15 | ... = ... | local_dataflow.rb:10:14:10:18 | array |
| local_dataflow.rb:9:9:9:15 | [...] | local_dataflow.rb:9:1:9:15 | ... = ... |
| local_dataflow.rb:9:9:9:15 | [...] | local_dataflow.rb:9:1:9:15 | ... = ... |
@@ -24,12 +24,15 @@
| local_dataflow.rb:10:9:10:9 | x | local_dataflow.rb:12:5:12:5 | x |
| local_dataflow.rb:10:14:10:18 | array | local_dataflow.rb:10:5:13:3 | for ... in ... |
| local_dataflow.rb:10:14:10:18 | array | local_dataflow.rb:15:10:15:14 | array |
| local_dataflow.rb:12:3:12:5 | call to p | local_dataflow.rb:10:19:13:3 | do ... |
| local_dataflow.rb:15:10:15:14 | array | local_dataflow.rb:15:1:17:3 | for ... in ... |
| local_dataflow.rb:15:10:15:14 | array | local_dataflow.rb:19:10:19:14 | array |
| local_dataflow.rb:16:3:16:10 | break | local_dataflow.rb:15:1:17:3 | for ... in ... |
| local_dataflow.rb:16:9:16:10 | 10 | local_dataflow.rb:16:3:16:10 | break |
| local_dataflow.rb:19:5:19:5 | x | local_dataflow.rb:20:6:20:6 | x |
| local_dataflow.rb:19:10:19:14 | array | local_dataflow.rb:19:1:21:3 | for ... in ... |
| local_dataflow.rb:20:3:20:25 | if ... | local_dataflow.rb:19:16:21:3 | do ... |
| local_dataflow.rb:20:12:20:21 | then ... | local_dataflow.rb:20:3:20:25 | if ... |
| local_dataflow.rb:20:17:20:21 | break | local_dataflow.rb:19:1:21:3 | for ... in ... |
| local_dataflow.rb:24:2:24:8 | break | local_dataflow.rb:23:1:25:3 | while ... |
| local_dataflow.rb:24:8:24:8 | 5 | local_dataflow.rb:24:2:24:8 | break |
@@ -40,8 +43,10 @@
| local_dataflow.rb:32:5:32:25 | bar | local_dataflow.rb:32:1:32:25 | ... = ... |
| local_dataflow.rb:32:5:32:25 | bar | local_dataflow.rb:32:1:32:25 | ... = ... |
| local_dataflow.rb:34:7:34:7 | x | local_dataflow.rb:35:6:35:6 | x |
| local_dataflow.rb:35:12:36:13 | then ... | local_dataflow.rb:35:3:37:5 | if ... |
| local_dataflow.rb:36:13:36:13 | 7 | local_dataflow.rb:36:6:36:13 | return |
| local_dataflow.rb:41:7:41:7 | x | local_dataflow.rb:42:6:42:6 | x |
| local_dataflow.rb:42:12:43:13 | then ... | local_dataflow.rb:42:3:44:5 | if ... |
| local_dataflow.rb:43:13:43:13 | 7 | local_dataflow.rb:43:6:43:13 | return |
| local_dataflow.rb:45:10:45:10 | 6 | local_dataflow.rb:45:3:45:10 | return |
| local_dataflow.rb:49:3:53:3 | <captured> | local_dataflow.rb:50:18:50:18 | x |