@graffiticode/basis 1.5.5 → 1.5.7
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 +4 -1
- package/src/compiler.js +8 -4
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graffiticode/basis",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.7",
|
|
5
5
|
"description": "The basis library for creating Graffiticode languages",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "jest"
|
|
9
9
|
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": "22.x"
|
|
12
|
+
},
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
12
15
|
"url": "git+https://github.com/graffiticode/basis.git"
|
package/src/compiler.js
CHANGED
|
@@ -33,14 +33,19 @@ class Visitor {
|
|
|
33
33
|
} else {
|
|
34
34
|
node = this.nodePool[nid];
|
|
35
35
|
}
|
|
36
|
+
// console.log(
|
|
37
|
+
// "Visitor/visit()",
|
|
38
|
+
// "node.tag=" + node.tag,
|
|
39
|
+
// );
|
|
40
|
+
const fn = (this[node.tag] || this["CATCH_ALL"]).bind(this);
|
|
36
41
|
assert(node && node.tag && node.elts, "2000: Visitor.visit() tag=" + node.tag + " elts= " + JSON.stringify(node.elts));
|
|
37
|
-
assert(
|
|
42
|
+
assert(fn, "2000: Visitor function not defined for: " + node.tag);
|
|
38
43
|
assert(typeof resume === "function", message(1003));
|
|
39
44
|
if (!options.SYNC && ASYNC) {
|
|
40
45
|
// This is used to keep from blowing the call stack.
|
|
41
|
-
setTimeout(() =>
|
|
46
|
+
setTimeout(() => fn(node, options, resume), 0);
|
|
42
47
|
} else {
|
|
43
|
-
|
|
48
|
+
fn(node, options, resume);
|
|
44
49
|
}
|
|
45
50
|
} catch (x) {
|
|
46
51
|
resume(error(x.stack));
|
|
@@ -407,7 +412,6 @@ export class Transformer extends Visitor {
|
|
|
407
412
|
return matches;
|
|
408
413
|
}
|
|
409
414
|
|
|
410
|
-
|
|
411
415
|
PROG(node, options, resume) {
|
|
412
416
|
if (!options) {
|
|
413
417
|
options = {};
|