From 186797a7459f9f2161e86e11388191246b339dce Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 11 Jan 2010 22:16:23 -0500 Subject: [PATCH] got compile_pattern_match about as small as its going to get --- lib/coffee_script/nodes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/coffee_script/nodes.rb b/lib/coffee_script/nodes.rb index 11fcc559..ff208a9e 100644 --- a/lib/coffee_script/nodes.rb +++ b/lib/coffee_script/nodes.rb @@ -472,13 +472,13 @@ module CoffeeScript def compile_pattern_match(o) val_var = o[:scope].free_variable assigns = ["#{idt}#{val_var} = #{@value.compile(o)};"] + o.merge!(:top => true, :as_statement => true) @variable.base.objects.each_with_index do |obj, i| obj, i = obj.value, obj.variable.base if @variable.object? access_class = @variable.array? ? IndexNode : AccessorNode assigns << AssignNode.new( - obj, - ValueNode.new(Value.new(val_var), [access_class.new(Value.new(i.to_s))]) - ).compile(o.merge(:top => true, :as_statement => true)) + obj, ValueNode.new(Value.new(val_var), [access_class.new(Value.new(i.to_s))]) + ).compile(o) end write(assigns.join("\n")) end