mevento 1.2.2 → 1.4.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/esm2020/lib/mevento.mjs +24 -21
- package/fesm2015/mevento.mjs +23 -20
- package/fesm2015/mevento.mjs.map +1 -1
- package/fesm2020/mevento.mjs +23 -20
- package/fesm2020/mevento.mjs.map +1 -1
- package/lib/mevento.d.ts +21 -1
- package/package.json +1 -1
package/fesm2015/mevento.mjs
CHANGED
|
@@ -1210,19 +1210,8 @@ class ANodeVisitor {
|
|
|
1210
1210
|
}
|
|
1211
1211
|
}
|
|
1212
1212
|
class NodeVisitor extends ANodeVisitor {
|
|
1213
|
-
visit(node) {
|
|
1214
|
-
const methodName = `visit${node.constructor.name}`;
|
|
1215
|
-
// const fn = Object.getPrototypeOf(this)[methodName];
|
|
1216
|
-
const fn = this._nodesVisitors[methodName];
|
|
1217
|
-
return fn === null || fn === void 0 ? void 0 : fn.call(this, node);
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
class MEvento extends NodeVisitor {
|
|
1221
1213
|
constructor() {
|
|
1222
1214
|
super();
|
|
1223
|
-
this._memory = {};
|
|
1224
|
-
this.debug = false;
|
|
1225
|
-
this._functionsRegistry = {};
|
|
1226
1215
|
this.registerVisitor(RootAST, this.visitRootAST);
|
|
1227
1216
|
this.registerVisitor(BlockStatementAST, this.visitBlockStatementAST);
|
|
1228
1217
|
this.registerVisitor(IdentifierAST, this.visitIdentifierAST);
|
|
@@ -1242,6 +1231,29 @@ class MEvento extends NodeVisitor {
|
|
|
1242
1231
|
this.registerVisitor(ForLoopStatement, this.visitForLoopStatement);
|
|
1243
1232
|
this.registerVisitor(ForOfStatement, this.visitForOfStatement);
|
|
1244
1233
|
this.registerVisitor(BreakAST, this.visitBreakAST);
|
|
1234
|
+
}
|
|
1235
|
+
visit(node) {
|
|
1236
|
+
const methodName = `visit${node.constructor.name}`;
|
|
1237
|
+
// const fn = Object.getPrototypeOf(this)[methodName];
|
|
1238
|
+
const fn = this._nodesVisitors[methodName];
|
|
1239
|
+
return fn === null || fn === void 0 ? void 0 : fn.call(this, node);
|
|
1240
|
+
}
|
|
1241
|
+
assignProperty(owner, property, value) {
|
|
1242
|
+
if (Array.isArray(owner)) {
|
|
1243
|
+
owner[property] = value;
|
|
1244
|
+
}
|
|
1245
|
+
else if (typeof owner === 'object') {
|
|
1246
|
+
owner[property] = value;
|
|
1247
|
+
}
|
|
1248
|
+
else { }
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
class MEvento extends NodeVisitor {
|
|
1252
|
+
constructor() {
|
|
1253
|
+
super();
|
|
1254
|
+
this._memory = {};
|
|
1255
|
+
this.debug = false;
|
|
1256
|
+
this._functionsRegistry = {};
|
|
1245
1257
|
this._functionsRegistry = Object.assign({}, MEvento._globalFunctionsRegistry);
|
|
1246
1258
|
}
|
|
1247
1259
|
log(message) {
|
|
@@ -1289,15 +1301,6 @@ class MEvento extends NodeVisitor {
|
|
|
1289
1301
|
}
|
|
1290
1302
|
return value;
|
|
1291
1303
|
}
|
|
1292
|
-
assignProperty(owner, property, value) {
|
|
1293
|
-
if (Array.isArray(owner)) {
|
|
1294
|
-
owner[property] = value;
|
|
1295
|
-
}
|
|
1296
|
-
else if (typeof owner === 'object') {
|
|
1297
|
-
owner[property] = value;
|
|
1298
|
-
}
|
|
1299
|
-
else { }
|
|
1300
|
-
}
|
|
1301
1304
|
visitExpressionStatementAST(node) {
|
|
1302
1305
|
const expr = node.expression;
|
|
1303
1306
|
return this.visit(expr);
|