@graffiticode/basis 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/compiler.js +20 -15
package/package.json
CHANGED
package/src/compiler.js
CHANGED
|
@@ -25,20 +25,25 @@ class Visitor {
|
|
|
25
25
|
this.root = code.root;
|
|
26
26
|
}
|
|
27
27
|
visit(nid, options, resume) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
try {
|
|
29
|
+
assert(nid);
|
|
30
|
+
let node;
|
|
31
|
+
if (typeof nid === "object") {
|
|
32
|
+
node = nid;
|
|
33
|
+
} else {
|
|
34
|
+
node = this.nodePool[nid];
|
|
35
|
+
}
|
|
36
|
+
assert(node && node.tag && node.elts, "2000: Visitor.visit() tag=" + node.tag + " elts= " + JSON.stringify(node.elts));
|
|
37
|
+
assert(this[node.tag], "2000: Visitor function not defined for: " + node.tag);
|
|
38
|
+
assert(typeof resume === "function", message(1003));
|
|
39
|
+
if (!options.SYNC && ASYNC) {
|
|
40
|
+
// This is used to keep from blowing the call stack.
|
|
41
|
+
setTimeout(() => this[node.tag](node, options, resume), 0);
|
|
42
|
+
} else {
|
|
43
|
+
this[node.tag](node, options, resume);
|
|
44
|
+
}
|
|
45
|
+
} catch (x) {
|
|
46
|
+
resume(error(x.stack));
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
node(nid) {
|
|
@@ -139,7 +144,7 @@ export class Checker extends Visitor {
|
|
|
139
144
|
}
|
|
140
145
|
JSON(node, options, resume) {
|
|
141
146
|
this.visit(node.elts[0], options, (e0, v0) => {
|
|
142
|
-
assert(v0.tag === "STR");
|
|
147
|
+
assert(v0.tag === "STR", JSON.stringify(v0, null, 2));
|
|
143
148
|
const err = [];
|
|
144
149
|
const val = node;
|
|
145
150
|
resume(err, val);
|