_this to __this, for consistency. (StanAngeloff)

This commit is contained in:
Jeremy Ashkenas
2010-07-24 08:11:42 -07:00
parent 85ed376748
commit 93d77e2354
3 changed files with 38 additions and 38 deletions

View File

@@ -185,11 +185,11 @@ exports.Expressions: class Expressions extends BaseNode
@expressions[idx]: last.makeReturn()
this
# A bound function uses a local `_this` variable instead of the real `this`.
# A bound function uses a local `__this` variable instead of the real `this`.
rewriteThis: ->
@traverseChildren false, (child) ->
if child instanceof ValueNode and child.base.value is 'this'
child.base: literal '_this'
child.base: literal '__this'
# An **Expressions** is the only node that can serve as the root.
compile: (o) ->
@@ -892,7 +892,7 @@ exports.CodeNode: class CodeNode extends BaseNode
func: "function(${ params.join(', ') }) {$code${ code and @idt(if @bound then 1 else 0) }}"
func: "($func)" if top and not @bound
return func unless @bound
"(function(_this) {\n${@idt(1)}return $func;\n$@tab})(this)"
"(function(__this) {\n${@idt(1)}return $func;\n$@tab})(this)"
topSensitive: ->
true