From 8cfff2c2fa776495a0d6d798ecda15707ee1faa8 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 17 Jan 2012 15:20:46 +0000 Subject: [PATCH] Refactored JavaScriptParseTree handling of output array --- js/JavaScriptParseTree.js | 99 +++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 50 deletions(-) diff --git a/js/JavaScriptParseTree.js b/js/JavaScriptParseTree.js index a86f3831a..17463c089 100644 --- a/js/JavaScriptParseTree.js +++ b/js/JavaScriptParseTree.js @@ -27,112 +27,111 @@ var JavaScriptParseTree = function(tree) { // Render the entire JavaScript tree object to JavaScript source code JavaScriptParseTree.prototype.render = function() { - this.output = []; - this.renderSubTree(this.tree); - var r = this.output.join(""); - this.output = null; + var output = []; + this.renderSubTree(output,this.tree); + var r = output.join(""); return r; }; // Render a subtree of the parse tree to an array of fragments of JavaScript source code -JavaScriptParseTree.prototype.renderSubTree = function(tree) { +JavaScriptParseTree.prototype.renderSubTree = function(output,tree) { for(var t=0; t