got about as far as I think I can with operator nodes for now, without zach's optimizations

This commit is contained in:
Jeremy Ashkenas
2010-02-10 00:05:56 -05:00
parent 9339058fc3
commit 76dac9c09c
5 changed files with 223 additions and 122 deletions

View File

@@ -783,9 +783,8 @@ module CoffeeScript
def compile_assignment(o)
first, second = @first.compile(o), @second.compile(o)
o[:scope].find(first) if @first.unwrap.is_a?(Value)
sym = @operator[0..1]
return "#{first} = #{ExistenceNode.compile_test(o, @first)} ? #{first} : #{second}" if @operator == '?='
"#{first} = #{first} #{sym} #{second}"
"#{first} = #{first} #{@operator[0..1]} #{second}"
end
def compile_existence(o)