Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Perlito5 - js - fix an infinite recursion in the runtime
  • Loading branch information
fglock committed Dec 3, 2012
1 parent d69c95a commit d604898
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
36 changes: 18 additions & 18 deletions html/perlito5.js
Expand Up @@ -330,30 +330,30 @@ Object.defineProperty( Object.prototype, "p5hset", {
Object.defineProperty( Object.prototype, "p5incr", {
enumerable : false,
value : function (i) {
this[i] = p5incr(this[i]);
this[i] = p5incr_(this[i]);
return this[i];
}
});
Object.defineProperty( Object.prototype, "p5postincr", {
enumerable : false,
value : function (i) {
var v = this[i];
this[i] = p5incr(this[i]);
this[i] = p5incr_(this[i]);
return v;
}
});
Object.defineProperty( Object.prototype, "p5decr", {
enumerable : false,
value : function (i) {
this[i] = p5decr(this[i]);
this[i] = p5decr_(this[i]);
return this[i];
}
});
Object.defineProperty( Object.prototype, "p5postdecr", {
enumerable : false,
value : function (i) {
var v = this[i];
this[i] = p5decr(this[i]);
this[i] = p5decr_(this[i]);
return v;
}
});
Expand Down Expand Up @@ -520,14 +520,14 @@ p5bool = function(o) {
return false;
};

p5incr = function(o) {
p5incr_ = function(o) {
if (typeof o === "number") {
return o + 1;
}
return p5str_inc(p5str(o));
};

p5decr = function(o) {
p5decr_ = function(o) {
if (typeof o === "number") {
return o - 1;
}
Expand Down Expand Up @@ -837,7 +837,7 @@ Object.defineProperty( Array.prototype, "p5incr", {
enumerable : false,
value : function (i) {
if (i < 0) { i = this.length + i };
this[i] = p5incr(this[i]);
this[i] = p5incr_(this[i]);
return this[i];
}
});
Expand All @@ -846,15 +846,15 @@ Object.defineProperty( Array.prototype, "p5postincr", {
value : function (i) {
if (i < 0) { i = this.length + i };
var v = this[i];
this[i] = p5incr(this[i]);
this[i] = p5incr_(this[i]);
return v;
}
});
Object.defineProperty( Array.prototype, "p5decr", {
enumerable : false,
value : function (i) {
if (i < 0) { i = this.length + i };
this[i] = p5decr(this[i]);
this[i] = p5decr_(this[i]);
return this[i];
}
});
Expand All @@ -863,7 +863,7 @@ Object.defineProperty( Array.prototype, "p5postdecr", {
value : function (i) {
if (i < 0) { i = this.length + i };
var v = this[i];
this[i] = p5decr(this[i]);
this[i] = p5decr_(this[i]);
return v;
}
});
Expand Down Expand Up @@ -947,7 +947,7 @@ p5tie_array = function(v, List__) {
enumerable : false,
configurable : true,
value : function (i) {
var value = p5incr(p5call(res, 'FETCH', [i]));
var value = p5incr_(p5call(res, 'FETCH', [i]));
p5call(res, 'STORE', [i, value]);
return value;
}
Expand All @@ -957,15 +957,15 @@ p5tie_array = function(v, List__) {
configurable : true,
value : function (i) {
var value = p5call(res, 'FETCH', [i]);
p5call(res, 'STORE', [i, p5incr(value)]);
p5call(res, 'STORE', [i, p5incr_(value)]);
return value;
}
});
Object.defineProperty( v, "p5decr", {
enumerable : false,
configurable : true,
value : function (i) {
var value = p5decr(p5call(res, 'FETCH', [i]));
var value = p5decr_(p5call(res, 'FETCH', [i]));
p5call(res, 'STORE', [i, value]);
return value;
}
Expand All @@ -975,7 +975,7 @@ p5tie_array = function(v, List__) {
configurable : true,
value : function (i) {
var value = p5call(res, 'FETCH', [i]);
p5call(res, 'STORE', [i, p5decr(value)]);
p5call(res, 'STORE', [i, p5decr_(value)]);
return value;
}
});
Expand Down Expand Up @@ -1090,24 +1090,24 @@ function p5ArrayOfAlias(o) {
}
this.p5incr = function (i) {
if (i < 0) { i = this.length + i };
this._array_[i+i][this._array_[i+i+1]] = p5incr(this._array_[i+i][this._array_[i+i+1]]);
this._array_[i+i][this._array_[i+i+1]] = p5incr_(this._array_[i+i][this._array_[i+i+1]]);
return this._array_[i+i][this._array_[i+i+1]];
}
this.p5postincr = function (i) {
if (i < 0) { i = this.length + i };
var v = this._array_[i+i][this._array_[i+i+1]];
this._array_[i+i][this._array_[i+i+1]] = p5incr(this._array_[i+i][this._array_[i+i+1]]);
this._array_[i+i][this._array_[i+i+1]] = p5incr_(this._array_[i+i][this._array_[i+i+1]]);
return v;
}
this.p5decr = function (i) {
if (i < 0) { i = this.length + i };
this._array_[i+i][this._array_[i+i+1]] = p5decr(this._array_[i+i][this._array_[i+i+1]]);
this._array_[i+i][this._array_[i+i+1]] = p5decr_(this._array_[i+i][this._array_[i+i+1]]);
return this._array_[i+i][this._array_[i+i+1]];
}
this.p5postdecr = function (i) {
if (i < 0) { i = this.length + i };
var v = this._array_[i+i][this._array_[i+i+1]];
this._array_[i+i][this._array_[i+i+1]] = p5decr(this._array_[i+i][this._array_[i+i+1]]);
this._array_[i+i][this._array_[i+i+1]] = p5decr_(this._array_[i+i][this._array_[i+i+1]]);
return v;
}
this.p5aget_array = function (i) {
Expand Down
4 changes: 2 additions & 2 deletions perlito5.pl

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src5/lib/Perlito5/Javascript2/Array.pm
Expand Up @@ -45,7 +45,7 @@ Object.defineProperty( Array.prototype, "p5incr", {
enumerable : false,
value : function (i) {
if (i < 0) { i = this.length + i };
this[i] = p5incr(this[i]);
this[i] = p5incr_(this[i]);
return this[i];
}
});
Expand All @@ -54,15 +54,15 @@ Object.defineProperty( Array.prototype, "p5postincr", {
value : function (i) {
if (i < 0) { i = this.length + i };
var v = this[i];
this[i] = p5incr(this[i]);
this[i] = p5incr_(this[i]);
return v;
}
});
Object.defineProperty( Array.prototype, "p5decr", {
enumerable : false,
value : function (i) {
if (i < 0) { i = this.length + i };
this[i] = p5decr(this[i]);
this[i] = p5decr_(this[i]);
return this[i];
}
});
Expand All @@ -71,7 +71,7 @@ Object.defineProperty( Array.prototype, "p5postdecr", {
value : function (i) {
if (i < 0) { i = this.length + i };
var v = this[i];
this[i] = p5decr(this[i]);
this[i] = p5decr_(this[i]);
return v;
}
});
Expand Down Expand Up @@ -155,7 +155,7 @@ p5tie_array = function(v, List__) {
enumerable : false,
configurable : true,
value : function (i) {
var value = p5incr(p5call(res, 'FETCH', [i]));
var value = p5incr_(p5call(res, 'FETCH', [i]));
p5call(res, 'STORE', [i, value]);
return value;
}
Expand All @@ -165,15 +165,15 @@ p5tie_array = function(v, List__) {
configurable : true,
value : function (i) {
var value = p5call(res, 'FETCH', [i]);
p5call(res, 'STORE', [i, p5incr(value)]);
p5call(res, 'STORE', [i, p5incr_(value)]);
return value;
}
});
Object.defineProperty( v, "p5decr", {
enumerable : false,
configurable : true,
value : function (i) {
var value = p5decr(p5call(res, 'FETCH', [i]));
var value = p5decr_(p5call(res, 'FETCH', [i]));
p5call(res, 'STORE', [i, value]);
return value;
}
Expand All @@ -183,7 +183,7 @@ p5tie_array = function(v, List__) {
configurable : true,
value : function (i) {
var value = p5call(res, 'FETCH', [i]);
p5call(res, 'STORE', [i, p5decr(value)]);
p5call(res, 'STORE', [i, p5decr_(value)]);
return value;
}
});
Expand Down Expand Up @@ -298,24 +298,24 @@ function p5ArrayOfAlias(o) {
}
this.p5incr = function (i) {
if (i < 0) { i = this.length + i };
this._array_[i+i][this._array_[i+i+1]] = p5incr(this._array_[i+i][this._array_[i+i+1]]);
this._array_[i+i][this._array_[i+i+1]] = p5incr_(this._array_[i+i][this._array_[i+i+1]]);
return this._array_[i+i][this._array_[i+i+1]];
}
this.p5postincr = function (i) {
if (i < 0) { i = this.length + i };
var v = this._array_[i+i][this._array_[i+i+1]];
this._array_[i+i][this._array_[i+i+1]] = p5incr(this._array_[i+i][this._array_[i+i+1]]);
this._array_[i+i][this._array_[i+i+1]] = p5incr_(this._array_[i+i][this._array_[i+i+1]]);
return v;
}
this.p5decr = function (i) {
if (i < 0) { i = this.length + i };
this._array_[i+i][this._array_[i+i+1]] = p5decr(this._array_[i+i][this._array_[i+i+1]]);
this._array_[i+i][this._array_[i+i+1]] = p5decr_(this._array_[i+i][this._array_[i+i+1]]);
return this._array_[i+i][this._array_[i+i+1]];
}
this.p5postdecr = function (i) {
if (i < 0) { i = this.length + i };
var v = this._array_[i+i][this._array_[i+i+1]];
this._array_[i+i][this._array_[i+i+1]] = p5decr(this._array_[i+i][this._array_[i+i+1]]);
this._array_[i+i][this._array_[i+i+1]] = p5decr_(this._array_[i+i][this._array_[i+i+1]]);
return v;
}
this.p5aget_array = function (i) {
Expand Down
12 changes: 6 additions & 6 deletions src5/lib/Perlito5/Javascript2/Runtime.pm
Expand Up @@ -336,30 +336,30 @@ Object.defineProperty( Object.prototype, "p5hset", {
Object.defineProperty( Object.prototype, "p5incr", {
enumerable : false,
value : function (i) {
this[i] = p5incr(this[i]);
this[i] = p5incr_(this[i]);
return this[i];
}
});
Object.defineProperty( Object.prototype, "p5postincr", {
enumerable : false,
value : function (i) {
var v = this[i];
this[i] = p5incr(this[i]);
this[i] = p5incr_(this[i]);
return v;
}
});
Object.defineProperty( Object.prototype, "p5decr", {
enumerable : false,
value : function (i) {
this[i] = p5decr(this[i]);
this[i] = p5decr_(this[i]);
return this[i];
}
});
Object.defineProperty( Object.prototype, "p5postdecr", {
enumerable : false,
value : function (i) {
var v = this[i];
this[i] = p5decr(this[i]);
this[i] = p5decr_(this[i]);
return v;
}
});
Expand Down Expand Up @@ -526,14 +526,14 @@ p5bool = function(o) {
return false;
};
p5incr = function(o) {
p5incr_ = function(o) {
if (typeof o === "number") {
return o + 1;
}
return p5str_inc(p5str(o));
};
p5decr = function(o) {
p5decr_ = function(o) {
if (typeof o === "number") {
return o - 1;
}
Expand Down

0 comments on commit d604898

Please sign in to comment.