Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4aa8ff5

Browse files
committed
Update yarv compiler and decompiler to stop using Elsif node
1 parent b3673e4 commit 4aa8ff5

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

lib/syntax_tree/yarv/compiler.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -911,17 +911,6 @@ def visit_else(node)
911911
iseq.pop unless last_statement?
912912
end
913913

914-
def visit_elsif(node)
915-
visit_if(
916-
IfNode.new(
917-
predicate: node.predicate,
918-
statements: node.statements,
919-
consequent: node.consequent,
920-
location: node.location
921-
)
922-
)
923-
end
924-
925914
def visit_ensure(node)
926915
end
927916

@@ -1057,7 +1046,8 @@ def visit_if_op(node)
10571046
statements: node.falsy,
10581047
location: Location.default
10591048
),
1060-
location: Location.default
1049+
location: Location.default,
1050+
beginning: "if"
10611051
)
10621052
)
10631053
end

lib/syntax_tree/yarv/decompiler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def decompile(iseq)
7777
Next(Args([]))
7878
]
7979

80-
clause << IfNode(clause.pop, Statements(body), nil)
80+
clause << IfNode(clause.pop, Statements(body), nil, "if")
8181
when Dup
8282
clause << clause.last
8383
when DupHash

0 commit comments

Comments
 (0)