JavaScript lib: fixed bug where an integer was returned by print().

This commit is contained in:
bringert
2007-01-04 22:27:38 +00:00
parent 988772ba37
commit a47a95b4e2

View File

@@ -66,15 +66,15 @@ Fun.prototype.isComplete = function() {
/* Concrete syntax terms */
function Arr() { this.values = copy_arguments(arguments, 0); }
Arr.prototype.print = function() { return this.values[0].print(); };
Arr.prototype.sel = function(i) { return this.values[i.toIndex()]; };
function Arr() { this.arr = copy_arguments(arguments, 0); }
Arr.prototype.print = function() { return this.arr[0].print(); };
Arr.prototype.sel = function(i) { return this.arr[i.toIndex()]; };
function Seq() { this.values = copy_arguments(arguments, 0); }
Seq.prototype.print = function() { return join_print(this.values, " "); };
function Seq() { this.seq = copy_arguments(arguments, 0); }
Seq.prototype.print = function() { return join_print(this.seq, " "); };
function Variants() { this.values = copy_arguments(arguments, 0); }
Variants.prototype.print = function() { return /*join_print(this.values, "/");*/ this.values[0].print(); };
function Variants() { this.variants = copy_arguments(arguments, 0); }
Variants.prototype.print = function() { return this.variants[0].print(); };
function Rp(index,value) { this.index = index; this.value = value; }
Rp.prototype.print = function() { return this.index; };
@@ -93,7 +93,7 @@ function Str(value) { this.value = value; }
Str.prototype.print = function() { return this.value; };
function Int(value) { this.value = value; }
Int.prototype.print = function() { return this.value; };
Int.prototype.print = function() { return this.value.toString(); };
Int.prototype.toIndex = function() { return this.value; };
/* Type annotation */
@@ -192,6 +192,7 @@ function isArray(a) { return a && typeof a == 'object' && a.constructor == Array
function isUndefined(a) { return typeof a == 'undefined'; }
function isBoolean(a) { return typeof a == 'boolean'; }
function isNumber(a) { return typeof a == 'number' && isFinite(a); }
function isFunction(a) { return typeof a == 'function'; }
function dumpObject (obj) {
if (isUndefined(obj)) {