adding @property for this.property

This commit is contained in:
Jeremy Ashkenas
2010-02-02 20:36:46 -05:00
parent c5c841f2fc
commit cb7a1033fa
5 changed files with 1307 additions and 1178 deletions

View File

@@ -429,6 +429,18 @@ module CoffeeScript
end
end
# A this-reference, using '@'.
class ThisNode < Node
def initialize(property=nil)
@property = property
end
def compile_node(o)
prop = @property ? ".#{@property}" : ''
write("this#{prop}")
end
end
# A range literal. Ranges can be used to extract portions (slices) of arrays,
# or to specify a range for array comprehensions.
class RangeNode < Node