diff options
author | kpdecker <kpdecker@gmail.com> | 2014-11-26 09:18:33 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-11-26 09:18:33 -0600 |
commit | df421f1e4b43773c61bc7c2c3cd06e0ff9ec4905 (patch) | |
tree | 8323023702dba63dece9a62707849669e376592c /lib/handlebars/compiler/compiler.js | |
parent | 61dd721ca2a9055036d0f350970d033ca5227411 (diff) | |
download | handlebars.js-df421f1e4b43773c61bc7c2c3cd06e0ff9ec4905.zip handlebars.js-df421f1e4b43773c61bc7c2c3cd06e0ff9ec4905.tar.gz handlebars.js-df421f1e4b43773c61bc7c2c3cd06e0ff9ec4905.tar.bz2 |
Update ProgramNode to better match SpiderMonkey
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index d80bfac..683e3e5 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -74,12 +74,12 @@ Compiler.prototype = { return this[node.type](node); }, - program: function(program) { - var statements = program.statements; - - for(var i=0, l=statements.length; i<l; i++) { - this.accept(statements[i]); + Program: function(program) { + var body = program.body; + for(var i=0, l=body.length; i<l; i++) { + this.accept(body[i]); } + this.isSimple = l === 1; this.depths.list = this.depths.list.sort(function(a, b) { @@ -377,7 +377,7 @@ Compiler.prototype = { }; export function precompile(input, options, env) { - if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) { + if (input == null || (typeof input !== 'string' && input.type !== 'Program')) { throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input); } @@ -395,7 +395,7 @@ export function precompile(input, options, env) { } export function compile(input, options, env) { - if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) { + if (input == null || (typeof input !== 'string' && input.type !== 'Program')) { throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input); } |