diff options
author | kpdecker <kpdecker@gmail.com> | 2012-12-30 17:10:38 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2012-12-30 17:10:38 -0600 |
commit | 51fd64c3341a37c18f0a301d5028fd07a07a1ce2 (patch) | |
tree | 4f6277456e69934b303440bee62e21f9cef02c63 /lib/handlebars/compiler/compiler.js | |
parent | dfaf698b4494aa2748f21b32dd34bea8dcab34fd (diff) | |
parent | 28f377d169e878959619b922661a9377d3e22e97 (diff) | |
download | handlebars.js-51fd64c3341a37c18f0a301d5028fd07a07a1ce2.zip handlebars.js-51fd64c3341a37c18f0a301d5028fd07a07a1ce2.tar.gz handlebars.js-51fd64c3341a37c18f0a301d5028fd07a07a1ce2.tar.bz2 |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 7578dd2..297a553 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -160,7 +160,7 @@ Handlebars.JavaScriptCompiler = function() {}; }, partial: function(partial) { - var id = partial.id; + var partialName = partial.partialName; this.usePartial = true; if(partial.context) { @@ -169,7 +169,7 @@ Handlebars.JavaScriptCompiler = function() {}; this.opcode('push', 'depth0'); } - this.opcode('invokePartial', id.original); + this.opcode('invokePartial', partialName.name); this.opcode('append'); }, @@ -1035,16 +1035,28 @@ Handlebars.JavaScriptCompiler = function() {}; })(Handlebars.Compiler, Handlebars.JavaScriptCompiler); Handlebars.precompile = function(string, options) { - options = options || {}; + if (typeof string !== 'string') { + throw new Handlebars.Exception("You must pass a string to Handlebars.compile. You passed " + string); + } + options = options || {}; + if (!('data' in options)) { + options.data = true; + } var ast = Handlebars.parse(string); var environment = new Handlebars.Compiler().compile(ast, options); return new Handlebars.JavaScriptCompiler().compile(environment, options); }; Handlebars.compile = function(string, options) { - options = options || {}; + if (typeof string !== 'string') { + throw new Handlebars.Exception("You must pass a string to Handlebars.compile. You passed " + string); + } + options = options || {}; + if (!('data' in options)) { + options.data = true; + } var compiled; function compile() { var ast = Handlebars.parse(string); |