diff options
author | kpdecker <kpdecker@gmail.com> | 2013-05-27 14:40:52 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-05-27 14:40:52 -0500 |
commit | 822a8911ecd4ffe822fd82afbf7b24704e79f787 (patch) | |
tree | 4f72b0d6a06522f6b25c25e2f46da711d3daf10d /lib/handlebars/compiler/compiler.js | |
parent | 5f349913aa1e3efebcd0a6835d33161c7c81d7a9 (diff) | |
download | handlebars.js-822a8911ecd4ffe822fd82afbf7b24704e79f787.zip handlebars.js-822a8911ecd4ffe822fd82afbf7b24704e79f787.tar.gz handlebars.js-822a8911ecd4ffe822fd82afbf7b24704e79f787.tar.bz2 |
Add support for complex ids in @data references
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 98f5396..d40e5f8 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -301,7 +301,15 @@ Compiler.prototype = { DATA: function(data) { this.options.data = true; - this.opcode('lookupData', data.id); + if (data.id.isScoped || data.id.depth) { + throw new Handlebars.Exception('Scoped data references are not supported: ' + data.original); + } + + this.opcode('lookupData'); + var parts = data.id.parts; + for(var i=0, l=parts.length; i<l; i++) { + this.opcode('lookup', parts[i]); + } }, STRING: function(string) { @@ -749,7 +757,7 @@ JavaScriptCompiler.prototype = { // // Push the result of looking up `id` on the current data lookupData: function(id) { - this.push(this.nameLookup('data', id, 'data')); + this.push('data'); }, // [pushStringParam] |