Track stringParams mode in local state vars
This commit is contained in:
@@ -73,6 +73,7 @@ Compiler.prototype = {
|
|||||||
this.children = [];
|
this.children = [];
|
||||||
this.depths = {list: []};
|
this.depths = {list: []};
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
this.stringParams = options.stringParams;
|
||||||
|
|
||||||
// These changes will propagate to the other compiler components
|
// These changes will propagate to the other compiler components
|
||||||
var knownHelpers = this.options.knownHelpers;
|
var knownHelpers = this.options.knownHelpers;
|
||||||
@@ -193,7 +194,7 @@ Compiler.prototype = {
|
|||||||
pair = pairs[i];
|
pair = pairs[i];
|
||||||
val = pair[1];
|
val = pair[1];
|
||||||
|
|
||||||
if (this.options.stringParams) {
|
if (this.stringParams) {
|
||||||
if(val.depth) {
|
if(val.depth) {
|
||||||
this.addDepth(val.depth);
|
this.addDepth(val.depth);
|
||||||
}
|
}
|
||||||
@@ -386,7 +387,7 @@ Compiler.prototype = {
|
|||||||
while(i--) {
|
while(i--) {
|
||||||
param = params[i];
|
param = params[i];
|
||||||
|
|
||||||
if(this.options.stringParams) {
|
if(this.stringParams) {
|
||||||
if(param.depth) {
|
if(param.depth) {
|
||||||
this.addDepth(param.depth);
|
this.addDepth(param.depth);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ JavaScriptCompiler.prototype = {
|
|||||||
compile: function(environment, options, context, asObject) {
|
compile: function(environment, options, context, asObject) {
|
||||||
this.environment = environment;
|
this.environment = environment;
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
|
this.stringParams = this.options.stringParams;
|
||||||
|
|
||||||
log('debug', this.environment.disassemble() + "\n\n");
|
log('debug', this.environment.disassemble() + "\n\n");
|
||||||
|
|
||||||
@@ -418,7 +419,7 @@ JavaScriptCompiler.prototype = {
|
|||||||
emptyHash: function() {
|
emptyHash: function() {
|
||||||
this.pushStackLiteral('{}');
|
this.pushStackLiteral('{}');
|
||||||
|
|
||||||
if (this.options.stringParams) {
|
if (this.stringParams) {
|
||||||
this.push('{}'); // hashContexts
|
this.push('{}'); // hashContexts
|
||||||
this.push('{}'); // hashTypes
|
this.push('{}'); // hashTypes
|
||||||
}
|
}
|
||||||
@@ -433,7 +434,7 @@ JavaScriptCompiler.prototype = {
|
|||||||
var hash = this.hash;
|
var hash = this.hash;
|
||||||
this.hash = this.hashes.pop();
|
this.hash = this.hashes.pop();
|
||||||
|
|
||||||
if (this.options.stringParams) {
|
if (this.stringParams) {
|
||||||
this.push('{' + hash.contexts.join(',') + '}');
|
this.push('{' + hash.contexts.join(',') + '}');
|
||||||
this.push('{' + hash.types.join(',') + '}');
|
this.push('{' + hash.types.join(',') + '}');
|
||||||
}
|
}
|
||||||
@@ -596,7 +597,7 @@ JavaScriptCompiler.prototype = {
|
|||||||
context,
|
context,
|
||||||
type;
|
type;
|
||||||
|
|
||||||
if (this.options.stringParams) {
|
if (this.stringParams) {
|
||||||
type = this.popStack();
|
type = this.popStack();
|
||||||
context = this.popStack();
|
context = this.popStack();
|
||||||
}
|
}
|
||||||
@@ -842,7 +843,7 @@ JavaScriptCompiler.prototype = {
|
|||||||
|
|
||||||
options.push("hash:" + this.popStack());
|
options.push("hash:" + this.popStack());
|
||||||
|
|
||||||
if (this.options.stringParams) {
|
if (this.stringParams) {
|
||||||
options.push("hashTypes:" + this.popStack());
|
options.push("hashTypes:" + this.popStack());
|
||||||
options.push("hashContexts:" + this.popStack());
|
options.push("hashContexts:" + this.popStack());
|
||||||
}
|
}
|
||||||
@@ -871,13 +872,13 @@ JavaScriptCompiler.prototype = {
|
|||||||
param = this.popStack();
|
param = this.popStack();
|
||||||
params.push(param);
|
params.push(param);
|
||||||
|
|
||||||
if(this.options.stringParams) {
|
if(this.stringParams) {
|
||||||
types.push(this.popStack());
|
types.push(this.popStack());
|
||||||
contexts.push(this.popStack());
|
contexts.push(this.popStack());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.options.stringParams) {
|
if (this.stringParams) {
|
||||||
options.push("contexts:[" + contexts.join(",") + "]");
|
options.push("contexts:[" + contexts.join(",") + "]");
|
||||||
options.push("types:[" + types.join(",") + "]");
|
options.push("types:[" + types.join(",") + "]");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user