Re-enabling garbage collection of tempvars, only at function boundaries.

This commit is contained in:
Jeremy Ashkenas
2010-10-06 21:19:05 -04:00
parent d4dac214ab
commit 69d2048ccc
7 changed files with 69 additions and 29 deletions

View File

@@ -785,7 +785,7 @@
ObjectNode.prototype.children = ['properties'];
ObjectNode.prototype.topSensitive = YES;
ObjectNode.prototype.compileNode = function(o) {
var _i, _len, _len2, _ref2, _ref3, _result, _result2, i, indent, join, lastNoncom, nonComments, obj, prop, props, top;
var _i, _len, _ref2, _result, i, indent, join, lastNoncom, nonComments, obj, prop, props, top;
top = del(o, 'top');
o.indent = this.idt(1);
nonComments = (function() {
@@ -800,10 +800,10 @@
}).call(this);
lastNoncom = last(nonComments);
props = (function() {
_result2 = []; _ref3 = this.properties;
for (i = 0, _len2 = _ref3.length; i < _len2; i++) {
prop = _ref3[i];
_result2.push((function() {
_result = []; _ref2 = this.properties;
for (i = 0, _len = _ref2.length; i < _len; i++) {
prop = _ref2[i];
_result.push((function() {
join = ",\n";
if ((prop === lastNoncom) || (prop instanceof CommentNode)) {
join = "\n";
@@ -820,7 +820,7 @@
return indent + prop.compile(o) + join;
}).call(this));
}
return _result2;
return _result;
}).call(this);
props = props.join('');
obj = '{' + (props ? '\n' + props + '\n' + this.idt() : '') + '}';
@@ -1102,7 +1102,7 @@
__extends(CodeNode, BaseNode);
CodeNode.prototype.children = ['params', 'body'];
CodeNode.prototype.compileNode = function(o) {
var _i, _j, _len, _len2, _len3, _ref2, _ref3, _result, close, code, empty, func, i, open, param, params, sharedScope, splat, top, value;
var _i, _len, _len2, _ref2, _ref3, _result, close, code, empty, func, i, open, param, params, sharedScope, splat, top, value;
sharedScope = del(o, 'sharedScope');
top = del(o, 'top');
o.scope = sharedScope || new Scope(o.scope, this.body, this);
@@ -1139,6 +1139,7 @@
}
}
}
o.scope.startLevel();
params = (function() {
_result = [];
for (_i = 0, _len2 = params.length; _i < _len2; _i++) {
@@ -1150,8 +1151,8 @@
if (!(empty)) {
this.body.makeReturn();
}
for (_j = 0, _len3 = params.length; _j < _len3; _j++) {
param = params[_j];
for (_i = 0, _len2 = params.length; _i < _len2; _i++) {
param = params[_i];
(o.scope.parameter(param));
}
if (this.className) {
@@ -1161,6 +1162,7 @@
open = this.className ? ("(function() {\n" + (this.idt(1)) + "return function " + (this.className) + "(") : "function(";
close = this.className ? ("" + (code && this.idt(1)) + "};\n" + (this.tab) + "})()") : ("" + (code && this.tab) + "}");
func = ("" + open + (params.join(', ')) + ") {" + code + close);
o.scope.endLevel();
if (this.bound) {
return ("" + (utility('bind')) + "(" + func + ", " + (this.context) + ")");
}