Wrap all compiler assignments in begin/end

This is much safer than having to explicitly call "wrap" in a potential
large amount of places.
This commit is contained in:
Yorick Peterse committed 2015-08-19 20:14:24 +02:00
1 parent aaba0049ab
commit 4b50a161ed
4 files changed
+16 -48

No files matched your search

+5 -1
View File
@@ -21,7 +21,11 @@ describe Oga::Ruby::Generator do
val = Oga::Ruby::Node.new(:lit, %w{10})
assign = var.assign(val)
@generator.on_assign(assign).should == 'number = 10'
@generator.on_assign(assign).should == <<-EOF
number = begin
10
end
EOF
end
end
+5 -1
View File
@@ -34,7 +34,11 @@ describe Oga::Ruby::Node do
node = left.assign(right)
node.type.should == :assign
node.to_a.should == [left, right]
node.to_a[0].should == left
node.to_a[1].type.should == :begin
node.to_a[1].to_a[0].should == right
end
end