Removing the notion of a ThisNode so that we don't have to worry about the special cases. Fixes Issue 180

This commit is contained in:
Jeremy Ashkenas
2010-02-19 07:51:52 -05:00
parent 45c0d4c2ea
commit dd753d3b78
6 changed files with 19 additions and 37 deletions

View File

@@ -240,7 +240,7 @@ ValueNode: exports.ValueNode: inherit Node, {
this
has_properties: ->
@properties.length or @base instanceof ThisNode
!!@properties.length
is_array: ->
@base instanceof ArrayNode and not @has_properties()
@@ -423,19 +423,6 @@ IndexNode: exports.IndexNode: inherit Node, {
}
# A this-reference, using '@'.
ThisNode: exports.ThisNode: inherit Node, {
type: 'This'
constructor: (property) ->
@property: property or null
this
compile_node: (o) ->
'this' + (if @property then '.' + @property.compile(o) else '')
}
# A range literal. Ranges can be used to extract portions (slices) of arrays,
# or to specify a range for list comprehensions.
RangeNode: exports.RangeNode: inherit Node, {