added children macro to Node, using it so that all nodes now have a 'children' method -- used for safe references to 'this' within closure wrappers

This commit is contained in:
Jeremy Ashkenas
2010-01-16 11:24:10 -05:00
parent 701cdb4c13
commit 1cd7fa8ebe
5 changed files with 100 additions and 42 deletions

View File

@@ -19,4 +19,22 @@ obj: {
}
obj.unbound()
obj.bound()
obj.bound()
# When when a closure wrapper is generated for expression conversion, make sure
# that references to "this" within the wrapper are safely converted as well.
obj: {
num: 5
func: =>
this.result: if false
10
else
"a"
"b"
this.num
}
print(obj.num is obj.func())
print(obj.num is obj.result)