Skip to content
Browse files

output pops correctly in compiler

  • Loading branch information...
1 parent 8249089 commit ee51b26eabf1aad64a454ae89bafe66c7085a006 @charliesome committed
Showing with 6 additions and 4 deletions.
  1. +6 −4 compiler/jsx_compiler.rb
View
10 compiler/jsx_compiler.rb
@@ -471,9 +471,7 @@ def Function(node, in_hoist_stage = false)
def ExpressionStatement(node)
compile_node node.expr
- if node.expr.is_a? Twostroke::AST::Call
- output :pop
- end
+ output :pop
end
def MultiExpression(node)
@@ -587,6 +585,7 @@ def Assignment(node)
else
output :setglobal, node.left.name
end
+ output :pop if type(node.left) == :Declaration
elsif type(node.left) == :MemberAccess
compile_node node.left.object
compile_node node.right
@@ -689,7 +688,10 @@ def ForLoop(node, continue_label = nil)
@break_stack.push end_label
compile_node node.body if node.body
output [:label, next_label]
- compile_node node.increment if node.increment
+ if node.increment
+ compile_node node.increment
+ output :pop
+ end
output :jmp, [:ref, start_label]
output [:label, end_label]
@continue_stack.pop

0 comments on commit ee51b26

Please sign in to comment.
Something went wrong with that request. Please try again.