Cleanup and fix ProxyContext.

This commit is contained in:
Jonathan Puckey 2012-03-01 23:20:15 +01:00
parent 507ff8bb23
commit b75e75f586

View file

@ -68,9 +68,9 @@ var ProxyContext = new function() {
if (name == 'restore') { if (name == 'restore') {
this._indents--; this._indents--;
} }
var args = Array.prototype.slice.call(arguments, 0); var args = Array.prototype.slice.call(arguments, 0).join(', '),
var string = 'ctx.' + name + '(' + args.join(', ') + ')'; string = 'ctx.' + name + '(' + args + ');';
console.log(this.getIndentation() + string + ';'); console.log(this.getIndentation() + string);
this._ctx[name].apply(this._ctx, arguments); this._ctx[name].apply(this._ctx, arguments);
if (name == 'save') { if (name == 'save') {
this._indents++; this._indents++;
@ -79,11 +79,9 @@ var ProxyContext = new function() {
} else { } else {
var capitalized = Base.capitalize(name); var capitalized = Base.capitalize(name);
param['set' + capitalized] = function(value) { param['set' + capitalized] = function(value) {
if (value.substring) { var logValue = value.substring ? '\'' + value + '\'' : value,
value = '\'' + value + '\''; string = 'ctx.' + name + ' = ' + logValue + ';';
} console.log(this.getIndentation() + string);
var string = 'ctx.' + name + ' = ' + value;
console.log(this.getIndentation() + string + ';');
return this._ctx[name] = value; return this._ctx[name] = value;
}; };
param['get' + capitalized] = function() { param['get' + capitalized] = function() {