greybel-interpreter 2.1.7 → 2.1.9

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/dist/cps.js CHANGED
@@ -57,6 +57,7 @@ const visit = (context, stack, item) => __awaiter(void 0, void 0, void 0, functi
57
57
  case greyscript_core_1.ASTType.MemberExpression:
58
58
  case greyscript_core_1.ASTType.Identifier:
59
59
  case greyscript_core_1.ASTType.IndexExpression:
60
+ case greyscript_core_1.ASTType.SliceExpression:
60
61
  return new resolve_1.Resolve(item, currentTarget).build(defaultVisit);
61
62
  case greyscript_core_1.ASTType.FunctionDeclaration:
62
63
  return new function_1.FunctionOperation(item, currentTarget).build(defaultVisit);
@@ -114,17 +114,17 @@ class Resolve extends operation_1.Operation {
114
114
  case greyscript_core_1.ASTType.IndexExpression: {
115
115
  const indexExpr = node;
116
116
  yield this.buildProcessor(indexExpr.base, visit);
117
- if (indexExpr.index.type === greyscript_core_1.ASTType.SliceExpression) {
118
- const sliceExpr = indexExpr.index;
119
- const left = yield visit(sliceExpr.left);
120
- const right = yield visit(sliceExpr.right);
121
- const sliceSegment = new SliceSegment(left, right);
122
- this.path.push(sliceSegment);
123
- }
124
- else {
125
- const indexSegment = new IndexSegment(yield visit(indexExpr.index));
126
- this.path.push(indexSegment);
127
- }
117
+ const indexSegment = new IndexSegment(yield visit(indexExpr.index));
118
+ this.path.push(indexSegment);
119
+ break;
120
+ }
121
+ case greyscript_core_1.ASTType.SliceExpression: {
122
+ const sliceExpr = node;
123
+ yield this.buildProcessor(sliceExpr.base, visit);
124
+ const left = yield visit(sliceExpr.left);
125
+ const right = yield visit(sliceExpr.right);
126
+ const sliceSegment = new SliceSegment(left, right);
127
+ this.path.push(sliceSegment);
128
128
  break;
129
129
  }
130
130
  case greyscript_core_1.ASTType.Identifier: {
@@ -221,13 +221,18 @@ class Resolve extends operation_1.Operation {
221
221
  }
222
222
  if (result.handle instanceof with_intrinsics_1.CustomValueWithIntrinsics) {
223
223
  const customValueCtx = result.handle;
224
+ if (this.path.isSuper() && customValueCtx instanceof map_1.CustomMap) {
225
+ const superChild = customValueCtx.isa.get(result.path);
226
+ if (autoCall && superChild instanceof function_1.CustomFunction) {
227
+ if (ctx.functionState.context) {
228
+ return superChild.run(ctx.functionState.context, [], ctx, customValueCtx.isa);
229
+ }
230
+ return superChild.run(customValueCtx, [], ctx);
231
+ }
232
+ return superChild;
233
+ }
224
234
  const child = customValueCtx.get(result.path);
225
235
  if (autoCall && child instanceof function_1.CustomFunction) {
226
- if (this.path.isSuper() &&
227
- ctx.functionState.context &&
228
- customValueCtx instanceof map_1.CustomMap) {
229
- return child.run(ctx.functionState.context, [], ctx, customValueCtx.isa);
230
- }
231
236
  return child.run(customValueCtx, [], ctx);
232
237
  }
233
238
  return child;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",
@@ -48,8 +48,8 @@
48
48
  "typescript": "^5.0.4"
49
49
  },
50
50
  "dependencies": {
51
- "greybel-core": "^0.9.4",
52
- "greyscript-core": "^0.9.6"
51
+ "greybel-core": "^0.9.5",
52
+ "greyscript-core": "^0.9.7"
53
53
  },
54
54
  "keywords": [
55
55
  "greyscript",