Track stringParams mode in local state vars

This commit is contained in:
kpdecker
2014-01-04 17:09:00 -06:00
parent 607748af3b
commit daeecf825c
2 changed files with 10 additions and 8 deletions
@@ -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(",") + "]");
}