continuing to life out types
This commit is contained in:
parent
bc8546bae0
commit
1d1a6e9492
|
@ -1,8 +1,8 @@
|
||||||
// Exceptions
|
// Exceptions
|
||||||
|
|
||||||
(function(baselib) {
|
(function(baselib) {
|
||||||
var exceptions = {};
|
var exports = {};
|
||||||
baselib.boxes = exceptions;
|
baselib.boxes = exports;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
@ -25,30 +25,30 @@
|
||||||
|
|
||||||
Box.prototype.toString = function(cache) {
|
Box.prototype.toString = function(cache) {
|
||||||
cache.put(this, true);
|
cache.put(this, true);
|
||||||
return "#&" + toWrittenString(this.val, cache);
|
return "#&" + plt.baselib.format.toWrittenString(this.val, cache);
|
||||||
};
|
};
|
||||||
|
|
||||||
Box.prototype.toWrittenString = function(cache) {
|
Box.prototype.toWrittenString = function(cache) {
|
||||||
cache.put(this, true);
|
cache.put(this, true);
|
||||||
return "#&" + toWrittenString(this.val, cache);
|
return "#&" + plt.baselib.format.toWrittenString(this.val, cache);
|
||||||
};
|
};
|
||||||
|
|
||||||
Box.prototype.toDisplayedString = function(cache) {
|
Box.prototype.toDisplayedString = function(cache) {
|
||||||
cache.put(this, true);
|
cache.put(this, true);
|
||||||
return "#&" + toDisplayedString(this.val, cache);
|
return "#&" + plt.baselib.format.toDisplayedString(this.val, cache);
|
||||||
};
|
};
|
||||||
|
|
||||||
Box.prototype.toDomNode = function(cache) {
|
Box.prototype.toDomNode = function(cache) {
|
||||||
cache.put(this, true);
|
cache.put(this, true);
|
||||||
var parent = document.createElement("span");
|
var parent = document.createElement("span");
|
||||||
parent.appendChild(document.createTextNode('#&'));
|
parent.appendChild(document.createTextNode('#&'));
|
||||||
parent.appendChild(toDomNode(this.val, cache));
|
parent.appendChild(plt.baselib.format.toDomNode(this.val, cache));
|
||||||
return parent;
|
return parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
Box.prototype.equals = function(other, aUnionFind) {
|
Box.prototype.equals = function(other, aUnionFind) {
|
||||||
return ((other instanceof Box) &&
|
return ((other instanceof Box) &&
|
||||||
equals(this.val, other.val, aUnionFind));
|
plt.baselib.equality.equals(this.val, other.val, aUnionFind));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Path.prototype.toString = function() {
|
Path.prototype.toString = function() {
|
||||||
return this.path;
|
return String(this.path);
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
49
js-assembler/runtime-src/baselib_placeholders.js
Normal file
49
js-assembler/runtime-src/baselib_placeholders.js
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
// Exceptions
|
||||||
|
|
||||||
|
(function(baselib) {
|
||||||
|
var exports = {};
|
||||||
|
baselib.placeholders = exports;
|
||||||
|
|
||||||
|
|
||||||
|
// Placeholders: same thing as boxes. Distinct type just to support make-reader-graph.
|
||||||
|
|
||||||
|
var Placeholder = function(x, mutable) {
|
||||||
|
this.val = x;
|
||||||
|
};
|
||||||
|
|
||||||
|
Placeholder.prototype.ref = function() {
|
||||||
|
return this.val;
|
||||||
|
};
|
||||||
|
|
||||||
|
Placeholder.prototype.set = function(newVal) {
|
||||||
|
this.val = newVal;
|
||||||
|
};
|
||||||
|
|
||||||
|
Placeholder.prototype.toString = function(cache) {
|
||||||
|
return "#<placeholder>";
|
||||||
|
};
|
||||||
|
|
||||||
|
Placeholder.prototype.toWrittenString = function(cache) {
|
||||||
|
return "#<placeholder>";
|
||||||
|
};
|
||||||
|
|
||||||
|
Placeholder.prototype.toDisplayedString = function(cache) {
|
||||||
|
return "#<placeholder>";
|
||||||
|
};
|
||||||
|
|
||||||
|
Placeholder.prototype.toDomNode = function(cache) {
|
||||||
|
var parent = document.createElement("span");
|
||||||
|
parent.appendChild(document.createTextNode('#<placeholder>'));
|
||||||
|
return parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
Placeholder.prototype.equals = function(other, aUnionFind) {
|
||||||
|
return ((other instanceof Placeholder) &&
|
||||||
|
plt.baselib.equality.equals(this.val, other.val, aUnionFind));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.Placeholder = Placeholder;
|
||||||
|
|
||||||
|
|
||||||
|
})(this['plt'].baselib);
|
|
@ -84,42 +84,6 @@ if (! this['plt']) { this['plt'] = {}; }
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Placeholders: same thing as boxes. Distinct type just to support make-reader-graph.
|
|
||||||
|
|
||||||
var Placeholder = function(x, mutable) {
|
|
||||||
this.val = x;
|
|
||||||
};
|
|
||||||
|
|
||||||
Placeholder.prototype.ref = function() {
|
|
||||||
return this.val;
|
|
||||||
};
|
|
||||||
|
|
||||||
Placeholder.prototype.set = function(newVal) {
|
|
||||||
this.val = newVal;
|
|
||||||
};
|
|
||||||
|
|
||||||
Placeholder.prototype.toString = function(cache) {
|
|
||||||
return "#<placeholder>";
|
|
||||||
};
|
|
||||||
|
|
||||||
Placeholder.prototype.toWrittenString = function(cache) {
|
|
||||||
return "#<placeholder>";
|
|
||||||
};
|
|
||||||
|
|
||||||
Placeholder.prototype.toDisplayedString = function(cache) {
|
|
||||||
return "#<placeholder>";
|
|
||||||
};
|
|
||||||
|
|
||||||
Placeholder.prototype.toDomNode = function(cache) {
|
|
||||||
var parent = document.createElement("span");
|
|
||||||
parent.appendChild(document.createTextNode('#<placeholder>'));
|
|
||||||
return parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
Placeholder.prototype.equals = function(other, aUnionFind) {
|
|
||||||
return ((other instanceof Placeholder) &&
|
|
||||||
equals(this.val, other.val, aUnionFind));
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user