diff options
author | kpdecker <kpdecker@gmail.com> | 2014-01-04 17:09:00 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-01-06 02:55:13 -0600 |
commit | daeecf825cda40d5903095cb86e6b2872870c472 (patch) | |
tree | 88e1e54b038ef3c52d4f5c650e375dc8a76466e0 /lib/handlebars/compiler/javascript-compiler.js | |
parent | 607748af3bd3135fc3113bdbfdd285e5d9edb97b (diff) | |
download | handlebars.js-daeecf825cda40d5903095cb86e6b2872870c472.zip handlebars.js-daeecf825cda40d5903095cb86e6b2872870c472.tar.gz handlebars.js-daeecf825cda40d5903095cb86e6b2872870c472.tar.bz2 |
Track stringParams mode in local state vars
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r-- | lib/handlebars/compiler/javascript-compiler.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 8cbb9e4..2136724 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -61,6 +61,7 @@ JavaScriptCompiler.prototype = { compile: function(environment, options, context, asObject) { this.environment = environment; this.options = options || {}; + this.stringParams = this.options.stringParams; log('debug', this.environment.disassemble() + "\n\n"); @@ -418,7 +419,7 @@ JavaScriptCompiler.prototype = { emptyHash: function() { this.pushStackLiteral('{}'); - if (this.options.stringParams) { + if (this.stringParams) { this.push('{}'); // hashContexts this.push('{}'); // hashTypes } @@ -433,7 +434,7 @@ JavaScriptCompiler.prototype = { var hash = this.hash; this.hash = this.hashes.pop(); - if (this.options.stringParams) { + if (this.stringParams) { this.push('{' + hash.contexts.join(',') + '}'); this.push('{' + hash.types.join(',') + '}'); } @@ -596,7 +597,7 @@ JavaScriptCompiler.prototype = { context, type; - if (this.options.stringParams) { + if (this.stringParams) { type = this.popStack(); context = this.popStack(); } @@ -842,7 +843,7 @@ JavaScriptCompiler.prototype = { options.push("hash:" + this.popStack()); - if (this.options.stringParams) { + if (this.stringParams) { options.push("hashTypes:" + this.popStack()); options.push("hashContexts:" + this.popStack()); } @@ -871,13 +872,13 @@ JavaScriptCompiler.prototype = { param = this.popStack(); params.push(param); - if(this.options.stringParams) { + if(this.stringParams) { types.push(this.popStack()); contexts.push(this.popStack()); } } - if (this.options.stringParams) { + if (this.stringParams) { options.push("contexts:[" + contexts.join(",") + "]"); options.push("types:[" + types.join(",") + "]"); } |