adding recur method to params to make it easier to recursively call toDomNode.

This commit is contained in:
Danny Yoo 2011-09-19 18:14:36 -04:00
parent 602086e46b
commit 3aa90e6b40

View File

@ -209,9 +209,22 @@
this[k] = params[k]; this[k] = params[k];
} }
} }
this.objectCounter = 0; if (this.depth === undefined) {
this.depth = 0;
}
if (this.objectCounter === undefined) {
this.objectCounter = 0;
}
}; };
ToDomNodeParameters.prototype.incrementDepth = function() {
return new ToDomNodeParameters({ mode : this.mode,
depth: this.depth + 1,
objectCounter: objectCounter });
};
// getMode: -> (U "print" "display" "write") // getMode: -> (U "print" "display" "write")
ToDomNodeParameters.prototype.getMode = function() { ToDomNodeParameters.prototype.getMode = function() {
if (this.mode) { if (this.mode) {
@ -241,6 +254,10 @@
return this.cache.put(x, this.objectCounter); return this.cache.put(x, this.objectCounter);
}; };
ToDomNodeParameters.prototype.recur = function(x) {
return toDomNode(x, this.incrementDepth());
};
// rationalToDomNode: rational -> dom-node // rationalToDomNode: rational -> dom-node