Altered bound functions with do to just use call(this) rather than binding.

This commit is contained in:
Timothy Jones
2010-10-25 00:18:54 +13:00
parent d096f69c78
commit 9619fa66eb
5 changed files with 23 additions and 2 deletions

View File

@@ -108,7 +108,7 @@
],
Do: [
o("DO Code", function() {
return new Call($2, $2.params);
return $2["do"]();
})
],
Code: [

View File

@@ -1048,6 +1048,14 @@
Code.prototype.traverseChildren = function(crossScope, func) {
return crossScope ? Code.__super__.traverseChildren.call(this, crossScope, func) : undefined;
};
Code.prototype["do"] = function() {
if (this.bound) {
this.bound = false;
return new Call(new Value(this, [new Accessor(new Literal('call'))]), [new Literal('this')].concat(this.params));
} else {
return new Call(this, this.params);
}
};
return Code;
})();
exports.Param = (function() {