Remove Compiler.depths parameter

This is no longer necessary with the depths array tracking and adds compiler overhead.
This commit is contained in:
kpdecker
2014-12-01 01:23:15 -06:00
parent ae8c1d229f
commit 0d396ccd30
2 changed files with 7 additions and 19 deletions
+5 -15
View File
@@ -98,13 +98,7 @@ Compiler.prototype = {
this.usePartial = this.usePartial || result.usePartial;
this.children[guid] = result;
for(var i=0, l=result.depths.list.length; i<l; i++) {
depth = result.depths.list[i];
if(depth < 2) { continue; }
else { this.addDepth(depth - 1); }
}
this.useDepths = this.useDepths || result.useDepths;
return guid;
},
@@ -125,9 +119,6 @@ Compiler.prototype = {
this.isSimple = l === 1;
this.depths.list = this.depths.list.sort(function(a, b) {
return a - b;
});
return this;
},
@@ -303,12 +294,11 @@ Compiler.prototype = {
},
addDepth: function(depth) {
if(depth === 0) { return; }
if(!this.depths[depth]) {
this.depths[depth] = true;
this.depths.list.push(depth);
if (!depth) {
return;
}
this.useDepths = true;
},
classifySexpr: function(sexpr) {
@@ -80,7 +80,7 @@ JavaScriptCompiler.prototype = {
this.compileChildren(environment, options);
this.useDepths = this.useDepths || environment.depths.list.length || this.options.compat;
this.useDepths = this.useDepths || environment.useDepths || this.options.compat;
var opcodes = environment.opcodes,
opcode,
@@ -710,9 +710,7 @@ JavaScriptCompiler.prototype = {
programExpression: function(guid) {
var child = this.environment.children[guid],
depths = child.depths.list,
useDepths = this.useDepths,
depth;
useDepths = this.useDepths;
var programParams = [child.index, 'data'];