Merge pull request #7394 from aibaars/ruby-cfg-expr-post

Ruby: CFG: make all expressions "post-order" nodes
This commit is contained in:
Arthur Baars
2021-12-21 16:36:42 +01:00
committed by GitHub
15 changed files with 327 additions and 262 deletions

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: [WhenExpr] when ...
# 107| getBranch: [WhenClause] 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: [WhenExpr] when ...
# 111| getBranch: [WhenClause] 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: [WhenExpr] when ...
# 9| getBranch: [WhenClause] when ...
# 9| getPattern: [LocalVariableAccess] b
# 9| getBody: [StmtSequence] then ...
# 10| getStmt: [IntegerLiteral] 100
# 11| getBranch: [WhenExpr] when ...
# 11| getBranch: [WhenClause] when ...
# 11| getPattern: [LocalVariableAccess] c
# 11| getPattern: [LocalVariableAccess] d
# 11| getBody: [StmtSequence] then ...
@@ -701,19 +701,19 @@ control/cases.rb:
# 13| getBranch/getElseBranch: [StmtSequence] else ...
# 14| getStmt: [IntegerLiteral] 300
# 18| getStmt: [CaseExpr] case ...
# 19| getBranch: [WhenExpr] when ...
# 19| getBranch: [WhenClause] 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: [WhenExpr] when ...
# 20| getBranch: [WhenClause] 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: [WhenExpr] when ...
# 21| getBranch: [WhenClause] when ...
# 21| getPattern: [LTExpr] ... < ...
# 21| getAnOperand/getLeftOperand/getLesserOperand/getReceiver: [LocalVariableAccess] a
# 21| getAnOperand/getArgument/getGreaterOperand/getRightOperand: [LocalVariableAccess] b

View File

@@ -10,10 +10,10 @@ 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) {
query predicate caseWhenBranches(CaseExpr c, WhenClause when, int pIndex, Expr p, StmtSequence body) {
when = c.getABranch() and
p = when.getPattern(pIndex) and
body = when.getBody()
}
query predicate caseAllBranches(CaseExpr c, int n, Expr branch) { branch = c.getBranch(n) }
query predicate caseAllBranches(CaseExpr c, int n, AstNode branch) { branch = c.getBranch(n) }

View File

@@ -486,7 +486,7 @@ break_ensure.rb:
case.rb:
# 1| enter if_in_case
#-----| -> case ...
#-----| -> self
# 1| enter case.rb
#-----| -> if_in_case
@@ -505,7 +505,7 @@ case.rb:
#-----| -> exit case.rb
# 2| case ...
#-----| -> self
#-----| -> exit if_in_case (normal)
# 2| call to x1
#-----| -> when ...
@@ -521,7 +521,7 @@ case.rb:
#-----| match -> self
# 3| then ...
#-----| -> exit if_in_case (normal)
#-----| -> case ...
# 3| ( ... )
#-----| -> then ...
@@ -552,11 +552,11 @@ case.rb:
#-----| -> 2
# 4| 2
#-----| no-match -> case ...
#-----| match -> self
#-----| no-match -> exit if_in_case (normal)
# 4| then ...
#-----| -> exit if_in_case (normal)
#-----| -> case ...
# 4| call to puts
#-----| -> then ...
@@ -579,10 +579,10 @@ case.rb:
#-----| -> exit case_match
# 8| value
#-----| -> case ...
#-----| -> value
# 9| case ...
#-----| -> value
#-----| -> exit case_match (normal)
# 9| value
#-----| -> in ... then ...
@@ -591,8 +591,8 @@ case.rb:
#-----| -> 0
# 10| 0
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match (normal)
# 11| in ... then ...
#-----| -> 1
@@ -602,7 +602,7 @@ case.rb:
#-----| match -> 3
# 11| then ...
#-----| -> exit case_match (normal)
#-----| -> case ...
# 11| 3
#-----| -> then ...
@@ -615,7 +615,7 @@ case.rb:
#-----| match -> 4
# 12| then ...
#-----| -> exit case_match (normal)
#-----| -> case ...
# 13| 4
#-----| -> then ...
@@ -637,7 +637,7 @@ case.rb:
#-----| -> ... == ...
# 14| then ...
#-----| -> exit case_match (normal)
#-----| -> case ...
# 14| 6
#-----| -> then ...
@@ -659,13 +659,13 @@ case.rb:
#-----| -> ... < ...
# 15| then ...
#-----| -> exit case_match (normal)
#-----| -> case ...
# 15| 7
#-----| -> then ...
# 16| else ...
#-----| -> exit case_match (normal)
#-----| -> case ...
# 16| 8
#-----| -> else ...
@@ -685,10 +685,10 @@ case.rb:
#-----| -> exit case_match_no_match
# 20| value
#-----| -> case ...
#-----| -> value
# 21| case ...
#-----| -> value
#-----| -> exit case_match_no_match (normal)
# 21| value
#-----| -> in ... then ...
@@ -697,8 +697,8 @@ case.rb:
#-----| -> 1
# 22| 1
#-----| match -> case ...
#-----| raise -> exit case_match_no_match (abnormal)
#-----| match -> exit case_match_no_match (normal)
# 26| enter case_match_raise
#-----| -> value
@@ -715,10 +715,10 @@ case.rb:
#-----| -> exit case_match_raise
# 26| value
#-----| -> case ...
#-----| -> value
# 27| case ...
#-----| -> value
#-----| -> exit case_match_raise (normal)
# 27| value
#-----| -> in ... then ...
@@ -730,8 +730,8 @@ case.rb:
#-----| -> x
# 28| -> { ... }
#-----| match -> case ...
#-----| raise -> exit case_match_raise (abnormal)
#-----| match -> exit case_match_raise (normal)
# 28| exit -> { ... }
@@ -765,10 +765,10 @@ case.rb:
#-----| -> exit case_match_array
# 32| value
#-----| -> case ...
#-----| -> value
# 33| case ...
#-----| -> value
#-----| -> exit case_match_array (normal)
# 33| value
#-----| -> in ... then ...
@@ -777,8 +777,8 @@ case.rb:
#-----| -> [ ..., * ]
# 34| [ ..., * ]
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_array (normal)
# 35| in ... then ...
#-----| -> [ ..., * ]
@@ -788,7 +788,7 @@ case.rb:
#-----| match -> x
# 35| x
#-----| match -> exit case_match_array (normal)
#-----| match -> case ...
# 36| in ... then ...
#-----| -> [ ..., * ]
@@ -798,7 +798,7 @@ case.rb:
#-----| match -> x
# 36| x
#-----| match -> exit case_match_array (normal)
#-----| match -> case ...
# 37| in ... then ...
#-----| -> Bar
@@ -824,7 +824,7 @@ case.rb:
#-----| match -> e
# 37| e
#-----| match -> exit case_match_array (normal)
#-----| match -> case ...
# 41| enter case_match_find
#-----| -> value
@@ -841,10 +841,10 @@ case.rb:
#-----| -> exit case_match_find
# 41| value
#-----| -> case ...
#-----| -> value
# 42| case ...
#-----| -> value
#-----| -> exit case_match_find (normal)
# 42| value
#-----| -> in ... then ...
@@ -868,7 +868,7 @@ case.rb:
#-----| raise -> exit case_match_find (abnormal)
# 43| y
#-----| -> exit case_match_find (normal)
#-----| -> case ...
# 47| enter case_match_hash
#-----| -> value
@@ -885,10 +885,10 @@ case.rb:
#-----| -> exit case_match_hash
# 47| value
#-----| -> case ...
#-----| -> value
# 48| case ...
#-----| -> value
#-----| -> exit case_match_hash (normal)
# 48| value
#-----| -> in ... then ...
@@ -912,7 +912,7 @@ case.rb:
#-----| match -> rest
# 49| rest
#-----| -> exit case_match_hash (normal)
#-----| -> case ...
# 50| in ... then ...
#-----| -> Bar
@@ -926,15 +926,15 @@ case.rb:
#-----| no-match -> in ... then ...
# 50| 1
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_hash (normal)
# 51| in ... then ...
#-----| -> Bar
# 51| { ..., ** }
#-----| match -> case ...
#-----| raise -> exit case_match_hash (abnormal)
#-----| match -> exit case_match_hash (normal)
# 51| Bar
#-----| match -> { ..., ** }
@@ -952,10 +952,10 @@ case.rb:
#-----| -> exit case_match_variable
# 55| value
#-----| -> case ...
#-----| -> value
# 56| case ...
#-----| -> value
#-----| -> exit case_match_variable (normal)
# 56| value
#-----| -> in ... then ...
@@ -964,14 +964,14 @@ case.rb:
#-----| -> 5
# 57| 5
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_variable (normal)
# 58| in ... then ...
#-----| -> var
# 58| var
#-----| match -> exit case_match_variable (normal)
#-----| match -> case ...
# 63| enter case_match_underscore
#-----| -> value
@@ -985,10 +985,10 @@ case.rb:
#-----| -> exit case_match_underscore
# 63| value
#-----| -> case ...
#-----| -> value
# 64| case ...
#-----| -> value
#-----| -> exit case_match_underscore (normal)
# 64| value
#-----| -> in ... then ...
@@ -1000,11 +1000,11 @@ case.rb:
#-----| -> 5
# 65| 5
#-----| match -> case ...
#-----| no-match -> _
#-----| match -> exit case_match_underscore (normal)
# 65| _
#-----| match -> exit case_match_underscore (normal)
#-----| match -> case ...
# 69| enter case_match_various
#-----| -> value
@@ -1024,7 +1024,7 @@ case.rb:
#-----| -> foo
# 70| ... = ...
#-----| -> case ...
#-----| -> value
# 70| foo
#-----| -> 42
@@ -1033,7 +1033,7 @@ case.rb:
#-----| -> ... = ...
# 72| case ...
#-----| -> value
#-----| -> exit case_match_various (normal)
# 72| value
#-----| -> in ... then ...
@@ -1042,8 +1042,8 @@ case.rb:
#-----| -> 5
# 73| 5
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 74| in ... then ...
#-----| -> ^...
@@ -1052,22 +1052,22 @@ case.rb:
#-----| -> foo
# 74| foo
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 75| in ... then ...
#-----| -> "string"
# 75| "string"
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 76| in ... then ...
#-----| -> Array
# 76| call to []
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 76| Array
#-----| -> "foo"
@@ -1082,8 +1082,8 @@ case.rb:
#-----| -> Array
# 77| call to []
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 77| Array
#-----| -> :"foo"
@@ -1098,8 +1098,8 @@ case.rb:
#-----| -> /.*abc[0-9]/
# 78| /.*abc[0-9]/
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 79| in ... then ...
#-----| -> 5
@@ -1108,8 +1108,8 @@ case.rb:
#-----| -> 10
# 79| _ .. _
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 79| 10
#-----| -> _ .. _
@@ -1118,8 +1118,8 @@ case.rb:
#-----| -> 10
# 80| _ .. _
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 80| 10
#-----| -> _ .. _
@@ -1131,8 +1131,8 @@ case.rb:
#-----| -> _ .. _
# 81| _ .. _
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 82| in ... then ...
#-----| -> ... => ...
@@ -1145,7 +1145,7 @@ case.rb:
#-----| match -> x
# 82| x
#-----| -> exit case_match_various (normal)
#-----| -> case ...
# 83| in ... then ...
#-----| -> ... | ...
@@ -1154,26 +1154,26 @@ case.rb:
#-----| -> 5
# 83| 5
#-----| match -> case ...
#-----| no-match -> ^...
#-----| match -> exit case_match_various (normal)
# 83| ^...
#-----| -> foo
# 83| foo
#-----| match -> case ...
#-----| no-match -> "string"
#-----| match -> exit case_match_various (normal)
# 83| "string"
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 84| in ... then ...
#-----| -> Foo
# 84| Bar
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 84| Foo
#-----| -> Bar
@@ -1185,8 +1185,8 @@ case.rb:
#-----| -> x
# 85| -> { ... }
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 85| exit -> { ... }
@@ -1209,15 +1209,15 @@ case.rb:
#-----| -> :foo
# 86| :foo
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 87| in ... then ...
#-----| -> :"foo bar"
# 87| :"foo bar"
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 88| in ... then ...
#-----| -> ... | ...
@@ -1226,15 +1226,15 @@ case.rb:
#-----| -> 5
# 88| - ...
#-----| match -> case ...
#-----| no-match -> 10
#-----| match -> exit case_match_various (normal)
# 88| 5
#-----| -> - ...
# 88| + ...
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 88| 10
#-----| -> + ...
@@ -1246,32 +1246,32 @@ case.rb:
#-----| -> nil
# 89| nil
#-----| match -> case ...
#-----| no-match -> self
#-----| match -> exit case_match_various (normal)
# 89| self
#-----| match -> case ...
#-----| no-match -> true
#-----| match -> exit case_match_various (normal)
# 89| true
#-----| match -> case ...
#-----| no-match -> false
#-----| match -> exit case_match_various (normal)
# 89| false
#-----| match -> case ...
#-----| no-match -> __LINE__
#-----| match -> exit case_match_various (normal)
# 89| __LINE__
#-----| match -> case ...
#-----| no-match -> __FILE__
#-----| match -> exit case_match_various (normal)
# 89| __FILE__
#-----| match -> case ...
#-----| no-match -> __ENCODING__
#-----| match -> exit case_match_various (normal)
# 89| __ENCODING__
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 90| in ... then ...
#-----| -> ( ... )
@@ -1283,8 +1283,8 @@ case.rb:
#-----| -> _ .. _
# 90| _ .. _
#-----| match -> case ...
#-----| no-match -> in ... then ...
#-----| match -> exit case_match_various (normal)
# 91| in ... then ...
#-----| -> ( ... )
@@ -1296,20 +1296,20 @@ case.rb:
#-----| -> 0
# 91| 0
#-----| match -> case ...
#-----| no-match -> ""
#-----| match -> exit case_match_various (normal)
# 91| ""
#-----| no-match -> [ ..., * ]
#-----| match -> exit case_match_various (normal)
#-----| match -> case ...
# 91| [ ..., * ]
#-----| match -> case ...
#-----| no-match -> { ..., ** }
#-----| match -> exit case_match_various (normal)
# 91| { ..., ** }
#-----| match -> case ...
#-----| raise -> exit case_match_various (abnormal)
#-----| match -> exit case_match_various (normal)
# 95| enter case_match_guard_no_else
#-----| -> value
@@ -1326,10 +1326,10 @@ case.rb:
#-----| -> exit case_match_guard_no_else
# 95| value
#-----| -> case ...
#-----| -> value
# 96| case ...
#-----| -> value
#-----| -> exit case_match_guard_no_else (normal)
# 96| value
#-----| -> in ... then ...
@@ -1351,7 +1351,7 @@ case.rb:
#-----| -> ... == ...
# 97| then ...
#-----| -> exit case_match_guard_no_else (normal)
#-----| -> case ...
# 97| 6
#-----| -> then ...
@@ -1703,7 +1703,7 @@ cfg.rb:
#-----| false -> if ...
# 39| call to puts
#-----| -> case ...
#-----| -> 10
# 39| self
#-----| -> 42
@@ -1712,7 +1712,7 @@ cfg.rb:
#-----| -> call to puts
# 41| case ...
#-----| -> 10
#-----| -> when ...
# 41| 10
#-----| -> when ...
@@ -1776,7 +1776,7 @@ cfg.rb:
#-----| -> call to puts
# 47| case ...
#-----| -> when ...
#-----| -> chained
# 48| when ...
#-----| -> b
@@ -1792,7 +1792,7 @@ cfg.rb:
#-----| -> ... == ...
# 48| then ...
#-----| -> chained
#-----| -> case ...
# 48| call to puts
#-----| -> then ...
@@ -1817,7 +1817,7 @@ cfg.rb:
#-----| -> ... == ...
# 49| ... > ...
#-----| false -> chained
#-----| false -> case ...
#-----| true -> self
# 49| b
@@ -1827,7 +1827,7 @@ cfg.rb:
#-----| -> ... > ...
# 49| then ...
#-----| -> chained
#-----| -> case ...
# 49| call to puts
#-----| -> then ...
@@ -1847,6 +1847,9 @@ cfg.rb:
# 52| "a"
#-----| -> chained
# 52| "..." "..."
#-----| -> ... = ...
# 52| "#{...}"
#-----| -> "string"
@@ -1857,7 +1860,7 @@ cfg.rb:
#-----| -> #{...}
# 52| "string"
#-----| -> ... = ...
#-----| -> "..." "..."
# 54| ... = ...
#-----| -> Silly
@@ -2416,13 +2419,13 @@ cfg.rb:
#-----| -> b
# 108| self
#-----| -> <<SQL
#-----| -> table
# 108| ( ... )
#-----| -> call to puts
# 108| <<SQL
#-----| -> table
#-----| -> ( ... )
# 109| #{...}
#-----| -> type
@@ -2431,7 +2434,7 @@ cfg.rb:
#-----| -> #{...}
# 110| #{...}
#-----| -> ( ... )
#-----| -> <<SQL
# 110| type
#-----| -> #{...}
@@ -2641,23 +2644,23 @@ cfg.rb:
#-----| -> EmptyModule
# 134| EmptyModule
#-----| -> ... rescue ...
#-----| -> 1
# 136| ... / ...
#-----| -> ... rescue ...
#-----| raise -> self
#-----| -> __synth__0
# 136| 1
#-----| -> 0
# 136| ... rescue ...
#-----| -> 1
#-----| -> __synth__0
# 136| 0
#-----| -> ... / ...
# 136| call to puts
#-----| -> __synth__0
#-----| -> ... rescue ...
# 136| self
#-----| -> "div by zero"
@@ -2704,6 +2707,9 @@ cfg.rb:
# 138| __synth__0
#-----| -> -1
# 138| ..., ...
#-----| -> * ...
# 138| 1
#-----| -> 2
@@ -2720,7 +2726,7 @@ cfg.rb:
#-----| -> 3
# 138| 3
#-----| -> * ...
#-----| -> ..., ...
# 140| M
#-----| -> Constant
@@ -3270,6 +3276,9 @@ cfg.rb:
#-----| -> b
# 197| b
#-----| -> ...
# 197| ...
#-----| -> call to bar
desugar.rb:
@@ -4905,7 +4914,7 @@ raise.rb:
#-----| true -> self
# 17| call to raise
#-----| raise -> rescue ...
#-----| raise -> ExceptionA
# 17| self
#-----| -> ExceptionA
@@ -4914,14 +4923,14 @@ raise.rb:
#-----| -> call to raise
# 19| rescue ...
#-----| -> ExceptionA
#-----| -> self
# 19| ExceptionA
#-----| match -> self
#-----| raise -> exit m2 (abnormal)
# 19| then ...
#-----| -> self
#-----| -> rescue ...
# 20| call to puts
#-----| -> then ...
@@ -4963,7 +4972,7 @@ raise.rb:
#-----| true -> self
# 28| call to raise
#-----| raise -> rescue ...
#-----| raise -> self
# 28| self
#-----| -> ExceptionA
@@ -4975,7 +4984,7 @@ raise.rb:
#-----| -> self
# 30| then ...
#-----| -> self
#-----| -> rescue ...
# 31| call to puts
#-----| -> then ...
@@ -5017,7 +5026,7 @@ raise.rb:
#-----| true -> self
# 39| call to raise
#-----| raise -> rescue ...
#-----| raise -> e
# 39| self
#-----| -> ExceptionA
@@ -5026,13 +5035,13 @@ raise.rb:
#-----| -> call to raise
# 41| rescue ...
#-----| -> e
#-----| -> self
# 41| e
#-----| -> self
# 41| then ...
#-----| -> self
#-----| -> rescue ...
# 42| call to puts
#-----| -> then ...
@@ -5074,7 +5083,7 @@ raise.rb:
#-----| true -> self
# 50| call to raise
#-----| raise -> rescue ...
#-----| raise -> e
# 50| self
#-----| -> ExceptionA
@@ -5083,10 +5092,10 @@ raise.rb:
#-----| -> call to raise
# 52| rescue ...
#-----| -> e
#-----| -> self
# 52| e
#-----| -> self
#-----| -> rescue ...
# 54| call to puts
#-----| -> exit m5 (normal)
@@ -5122,7 +5131,7 @@ raise.rb:
#-----| true -> self
# 60| call to raise
#-----| raise -> rescue ...
#-----| raise -> ExceptionA
# 60| self
#-----| -> ExceptionA
@@ -5131,7 +5140,7 @@ raise.rb:
#-----| -> call to raise
# 62| rescue ...
#-----| -> ExceptionA
#-----| -> self
# 62| ExceptionA
#-----| no-match -> ExceptionB
@@ -5145,7 +5154,7 @@ raise.rb:
#-----| -> self
# 62| then ...
#-----| -> self
#-----| -> rescue ...
# 63| call to puts
#-----| -> then ...
@@ -5804,7 +5813,7 @@ raise.rb:
#-----| true -> self
# 131| call to raise
#-----| raise -> rescue ...
#-----| raise -> ExceptionA
# 131| self
#-----| -> ExceptionA
@@ -5813,21 +5822,21 @@ raise.rb:
#-----| -> call to raise
# 133| rescue ...
#-----| -> ExceptionA
#-----| -> self
# 133| ExceptionA
#-----| no-match -> rescue ...
#-----| match -> self
#-----| match -> rescue ...
#-----| no-match -> ExceptionB
# 134| rescue ...
#-----| -> ExceptionB
#-----| -> self
# 134| ExceptionB
#-----| match -> self
#-----| raise -> [ensure: raise] self
# 134| then ...
#-----| -> self
#-----| -> rescue ...
# 135| call to puts
#-----| -> then ...

View File

@@ -191,6 +191,7 @@ positionalArguments
| cfg.rb:191:3:191:10 | yield ... | cfg.rb:191:9:191:10 | 42 |
| cfg.rb:194:16:194:21 | call to puts | cfg.rb:194:21:194:21 | x |
| cfg.rb:197:3:197:13 | call to bar | cfg.rb:197:7:197:7 | b |
| cfg.rb:197:3:197:13 | call to bar | cfg.rb:197:10:197:12 | ... |
| desugar.rb:2:5:2:6 | ... + ... | desugar.rb:2:8:2:8 | 1 |
| desugar.rb:6:3:6:13 | call to count= | desugar.rb:6:3:6:13 | ... = ... |
| desugar.rb:10:3:10:10 | call to []= | desugar.rb:10:3:10:10 | ... = ... |

View File

@@ -70,3 +70,33 @@
| local_dataflow.rb:50:18:50:18 | [post] x | local_dataflow.rb:51:20:51:20 | x |
| local_dataflow.rb:50:18:50:18 | x | local_dataflow.rb:51:20:51:20 | x |
| local_dataflow.rb:51:9:51:15 | "break" | local_dataflow.rb:51:3:51:15 | break |
| local_dataflow.rb:60:15:60:15 | x | local_dataflow.rb:60:15:60:15 | x |
| local_dataflow.rb:60:15:60:15 | x | local_dataflow.rb:61:12:61:12 | x |
| local_dataflow.rb:61:7:68:5 | case ... | local_dataflow.rb:61:3:68:5 | ... = ... |
| local_dataflow.rb:61:12:61:12 | x | local_dataflow.rb:63:15:63:15 | x |
| local_dataflow.rb:61:12:61:12 | x | local_dataflow.rb:65:6:65:6 | x |
| local_dataflow.rb:61:12:61:12 | x | local_dataflow.rb:67:5:67:5 | x |
| local_dataflow.rb:61:12:61:12 | x | local_dataflow.rb:69:12:69:12 | x |
| local_dataflow.rb:62:10:62:15 | then ... | local_dataflow.rb:61:7:68:5 | case ... |
| local_dataflow.rb:62:15:62:15 | 3 | local_dataflow.rb:62:10:62:15 | then ... |
| local_dataflow.rb:63:10:63:15 | then ... | local_dataflow.rb:61:7:68:5 | case ... |
| local_dataflow.rb:63:15:63:15 | x | local_dataflow.rb:63:10:63:15 | then ... |
| local_dataflow.rb:63:15:63:15 | x | local_dataflow.rb:69:12:69:12 | x |
| local_dataflow.rb:64:9:65:6 | then ... | local_dataflow.rb:61:7:68:5 | case ... |
| local_dataflow.rb:65:6:65:6 | x | local_dataflow.rb:64:9:65:6 | then ... |
| local_dataflow.rb:65:6:65:6 | x | local_dataflow.rb:69:12:69:12 | x |
| local_dataflow.rb:66:3:67:5 | else ... | local_dataflow.rb:61:7:68:5 | case ... |
| local_dataflow.rb:67:5:67:5 | x | local_dataflow.rb:66:3:67:5 | else ... |
| local_dataflow.rb:67:5:67:5 | x | local_dataflow.rb:69:12:69:12 | x |
| local_dataflow.rb:69:7:76:5 | case ... | local_dataflow.rb:69:3:76:5 | ... = ... |
| local_dataflow.rb:69:12:69:12 | x | local_dataflow.rb:71:13:71:13 | x |
| local_dataflow.rb:69:12:69:12 | x | local_dataflow.rb:73:7:73:7 | x |
| local_dataflow.rb:69:12:69:12 | x | local_dataflow.rb:75:6:75:6 | x |
| local_dataflow.rb:70:8:70:13 | then ... | local_dataflow.rb:69:7:76:5 | case ... |
| local_dataflow.rb:70:13:70:13 | 4 | local_dataflow.rb:70:8:70:13 | then ... |
| local_dataflow.rb:71:8:71:13 | then ... | local_dataflow.rb:69:7:76:5 | case ... |
| local_dataflow.rb:71:13:71:13 | x | local_dataflow.rb:71:8:71:13 | then ... |
| local_dataflow.rb:72:7:73:7 | then ... | local_dataflow.rb:69:7:76:5 | case ... |
| local_dataflow.rb:73:7:73:7 | x | local_dataflow.rb:72:7:73:7 | then ... |
| local_dataflow.rb:74:3:75:6 | else ... | local_dataflow.rb:69:7:76:5 | case ... |
| local_dataflow.rb:75:6:75:6 | x | local_dataflow.rb:74:3:75:6 | else ... |

View File

@@ -12,6 +12,7 @@ ret
| local_dataflow.rb:50:3:50:13 | next |
| local_dataflow.rb:51:3:51:15 | break |
| local_dataflow.rb:52:3:52:10 | "normal" |
| local_dataflow.rb:69:3:76:5 | ... = ... |
arg
| local_dataflow.rb:3:8:3:10 | self | local_dataflow.rb:3:8:3:10 | call to p | -1 |
| local_dataflow.rb:3:10:3:10 | a | local_dataflow.rb:3:8:3:10 | call to p | 0 |

View File

@@ -56,3 +56,23 @@ foo([1, 2, 3])
def foo x
end
def test_case x
y = case x
when 1 then 3
when 2 then x
when 3
x
else
x
end
z = case x
in 1 then 4
in 2 then x
in 3
x
else
x
end
end