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.
@@ -1198,19 +1198,8 @@ class ANodeVisitor {
1198
1198
  }
1199
1199
  }
1200
1200
  class NodeVisitor extends ANodeVisitor {
1201
- visit(node) {
1202
- const methodName = `visit${node.constructor.name}`;
1203
- // const fn = Object.getPrototypeOf(this)[methodName];
1204
- const fn = this._nodesVisitors[methodName];
1205
- return fn?.call(this, node);
1206
- }
1207
- }
1208
- class MEvento extends NodeVisitor {
1209
1201
  constructor() {
1210
1202
  super();
1211
- this._memory = {};
1212
- this.debug = false;
1213
- this._functionsRegistry = {};
1214
1203
  this.registerVisitor(RootAST, this.visitRootAST);
1215
1204
  this.registerVisitor(BlockStatementAST, this.visitBlockStatementAST);
1216
1205
  this.registerVisitor(IdentifierAST, this.visitIdentifierAST);
@@ -1230,6 +1219,29 @@ class MEvento extends NodeVisitor {
1230
1219
  this.registerVisitor(ForLoopStatement, this.visitForLoopStatement);
1231
1220
  this.registerVisitor(ForOfStatement, this.visitForOfStatement);
1232
1221
  this.registerVisitor(BreakAST, this.visitBreakAST);
1222
+ }
1223
+ visit(node) {
1224
+ const methodName = `visit${node.constructor.name}`;
1225
+ // const fn = Object.getPrototypeOf(this)[methodName];
1226
+ const fn = this._nodesVisitors[methodName];
1227
+ return fn?.call(this, node);
1228
+ }
1229
+ assignProperty(owner, property, value) {
1230
+ if (Array.isArray(owner)) {
1231
+ owner[property] = value;
1232
+ }
1233
+ else if (typeof owner === 'object') {
1234
+ owner[property] = value;
1235
+ }
1236
+ else { }
1237
+ }
1238
+ }
1239
+ class MEvento extends NodeVisitor {
1240
+ constructor() {
1241
+ super();
1242
+ this._memory = {};
1243
+ this.debug = false;
1244
+ this._functionsRegistry = {};
1233
1245
  this._functionsRegistry = { ...MEvento._globalFunctionsRegistry };
1234
1246
  }
1235
1247
  log(message) {
@@ -1277,15 +1289,6 @@ class MEvento extends NodeVisitor {
1277
1289
  }
1278
1290
  return value;
1279
1291
  }
1280
- assignProperty(owner, property, value) {
1281
- if (Array.isArray(owner)) {
1282
- owner[property] = value;
1283
- }
1284
- else if (typeof owner === 'object') {
1285
- owner[property] = value;
1286
- }
1287
- else { }
1288
- }
1289
1292
  visitExpressionStatementAST(node) {
1290
1293
  const expr = node.expression;
1291
1294
  return this.visit(expr);