summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-11-28 23:56:41 -0600
committerkpdecker <kpdecker@gmail.com>2014-11-29 18:02:58 -0600
commitb6ba2dcdb0684bc9623e2d79e4548339640fb009 (patch)
treed8955b30e5f680c42c9c373583845f55cf6b23ee /lib/handlebars/compiler/compiler.js
parent5b0efc7e91e6f563301fb0b1823a0fe9cf4cc40e (diff)
downloadhandlebars.js-b6ba2dcdb0684bc9623e2d79e4548339640fb009.zip
handlebars.js-b6ba2dcdb0684bc9623e2d79e4548339640fb009.tar.gz
handlebars.js-b6ba2dcdb0684bc9623e2d79e4548339640fb009.tar.bz2
Move compileProgram out of visitor methods
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 4b5b0af..534ddb8 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -91,6 +91,24 @@ Compiler.prototype = {
return this.accept(program);
},
+ compileProgram: function(program) {
+ var result = new this.compiler().compile(program, this.options);
+ var guid = this.guid++, depth;
+
+ 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); }
+ }
+
+ return guid;
+ },
+
accept: function(node) {
this.sourceNode.unshift(node);
var ret = this[node.type](node);
@@ -114,24 +132,6 @@ Compiler.prototype = {
return this;
},
- compileProgram: function(program) {
- var result = new this.compiler().compile(program, this.options);
- var guid = this.guid++, depth;
-
- 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); }
- }
-
- return guid;
- },
-
BlockStatement: function(block) {
var sexpr = block.sexpr,
program = block.program,