Track stringParams mode in local state vars
This commit is contained in:
@@ -73,6 +73,7 @@ Compiler.prototype = {
|
||||
this.children = [];
|
||||
this.depths = {list: []};
|
||||
this.options = options;
|
||||
this.stringParams = options.stringParams;
|
||||
|
||||
// These changes will propagate to the other compiler components
|
||||
var knownHelpers = this.options.knownHelpers;
|
||||
@@ -193,7 +194,7 @@ Compiler.prototype = {
|
||||
pair = pairs[i];
|
||||
val = pair[1];
|
||||
|
||||
if (this.options.stringParams) {
|
||||
if (this.stringParams) {
|
||||
if(val.depth) {
|
||||
this.addDepth(val.depth);
|
||||
}
|
||||
@@ -386,7 +387,7 @@ Compiler.prototype = {
|
||||
while(i--) {
|
||||
param = params[i];
|
||||
|
||||
if(this.options.stringParams) {
|
||||
if(this.stringParams) {
|
||||
if(param.depth) {
|
||||
this.addDepth(param.depth);
|
||||
}
|
||||
|
||||
@@ -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(",") + "]");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user