greybel-interpreter 1.7.1 → 1.7.2

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.
Files changed (95) hide show
  1. package/dist/context.d.ts +9 -9
  2. package/dist/context.js +19 -22
  3. package/dist/cps.d.ts +3 -3
  4. package/dist/cps.js +56 -59
  5. package/dist/handler/output.d.ts +4 -4
  6. package/dist/handler/output.js +2 -2
  7. package/dist/handler-container.d.ts +1 -1
  8. package/dist/handler-container.js +2 -1
  9. package/dist/index.d.ts +42 -42
  10. package/dist/index.js +43 -46
  11. package/dist/interpreter.d.ts +9 -9
  12. package/dist/interpreter.js +33 -59
  13. package/dist/operations/assign.d.ts +5 -5
  14. package/dist/operations/assign.js +9 -11
  15. package/dist/operations/block.d.ts +4 -4
  16. package/dist/operations/block.js +6 -8
  17. package/dist/operations/break.d.ts +4 -4
  18. package/dist/operations/break.js +6 -8
  19. package/dist/operations/call.d.ts +5 -5
  20. package/dist/operations/call.js +12 -14
  21. package/dist/operations/chunk.d.ts +6 -6
  22. package/dist/operations/chunk.js +8 -10
  23. package/dist/operations/continue.d.ts +4 -4
  24. package/dist/operations/continue.js +6 -8
  25. package/dist/operations/debugger-statement.d.ts +5 -5
  26. package/dist/operations/debugger-statement.js +6 -8
  27. package/dist/operations/envar.d.ts +5 -5
  28. package/dist/operations/envar.js +6 -8
  29. package/dist/operations/evaluate.d.ts +6 -5
  30. package/dist/operations/evaluate.js +109 -112
  31. package/dist/operations/for.d.ts +6 -6
  32. package/dist/operations/for.js +15 -17
  33. package/dist/operations/function-reference.d.ts +5 -5
  34. package/dist/operations/function-reference.js +8 -10
  35. package/dist/operations/function.d.ts +5 -5
  36. package/dist/operations/function.js +17 -20
  37. package/dist/operations/if-statement.d.ts +6 -6
  38. package/dist/operations/if-statement.js +12 -15
  39. package/dist/operations/import.d.ts +7 -7
  40. package/dist/operations/import.js +15 -18
  41. package/dist/operations/include.d.ts +5 -5
  42. package/dist/operations/include.js +4 -6
  43. package/dist/operations/list.d.ts +5 -5
  44. package/dist/operations/list.js +6 -8
  45. package/dist/operations/literal.d.ts +5 -5
  46. package/dist/operations/literal.js +12 -14
  47. package/dist/operations/map.d.ts +5 -5
  48. package/dist/operations/map.js +8 -10
  49. package/dist/operations/negated-binary.d.ts +5 -5
  50. package/dist/operations/negated-binary.js +7 -9
  51. package/dist/operations/new-instance.d.ts +5 -5
  52. package/dist/operations/new-instance.js +8 -10
  53. package/dist/operations/noop.d.ts +5 -5
  54. package/dist/operations/noop.js +6 -8
  55. package/dist/operations/not.d.ts +5 -5
  56. package/dist/operations/not.js +6 -8
  57. package/dist/operations/operation.d.ts +3 -3
  58. package/dist/operations/operation.js +2 -1
  59. package/dist/operations/reference.d.ts +4 -4
  60. package/dist/operations/reference.js +4 -6
  61. package/dist/operations/resolve.d.ts +6 -6
  62. package/dist/operations/resolve.js +27 -30
  63. package/dist/operations/return.d.ts +5 -5
  64. package/dist/operations/return.js +8 -10
  65. package/dist/operations/while.d.ts +6 -6
  66. package/dist/operations/while.js +9 -11
  67. package/dist/types/base.d.ts +1 -1
  68. package/dist/types/base.js +2 -1
  69. package/dist/types/boolean.d.ts +2 -2
  70. package/dist/types/boolean.js +4 -7
  71. package/dist/types/default.d.ts +7 -7
  72. package/dist/types/default.js +9 -8
  73. package/dist/types/function.d.ts +5 -5
  74. package/dist/types/function.js +27 -30
  75. package/dist/types/interface.d.ts +4 -4
  76. package/dist/types/interface.js +10 -13
  77. package/dist/types/list.d.ts +4 -4
  78. package/dist/types/list.js +21 -24
  79. package/dist/types/map.d.ts +5 -5
  80. package/dist/types/map.js +26 -29
  81. package/dist/types/nil.d.ts +2 -2
  82. package/dist/types/nil.js +4 -7
  83. package/dist/types/number.d.ts +4 -4
  84. package/dist/types/number.js +8 -11
  85. package/dist/types/string.d.ts +4 -4
  86. package/dist/types/string.js +19 -22
  87. package/dist/types/with-intrinsics.d.ts +4 -4
  88. package/dist/types/with-intrinsics.js +2 -5
  89. package/dist/utils/deep-equal.d.ts +1 -1
  90. package/dist/utils/deep-equal.js +4 -3
  91. package/dist/utils/object-value.d.ts +2 -2
  92. package/dist/utils/object-value.js +6 -8
  93. package/dist/utils/path.d.ts +1 -1
  94. package/dist/utils/path.js +2 -1
  95. package/package.json +2 -2
@@ -8,17 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.For = void 0;
15
13
  const context_1 = require("../context");
16
- const default_1 = __importDefault(require("../types/default"));
17
- const number_1 = __importDefault(require("../types/number"));
18
- const string_1 = __importDefault(require("../types/string"));
19
- const block_1 = __importDefault(require("./block"));
20
- const operation_1 = __importDefault(require("./operation"));
21
- class For extends operation_1.default {
14
+ const default_1 = require("../types/default");
15
+ const number_1 = require("../types/number");
16
+ const string_1 = require("../types/string");
17
+ const block_1 = require("./block");
18
+ const operation_1 = require("./operation");
19
+ class For extends operation_1.Operation {
22
20
  constructor(item, target) {
23
21
  super(null, target);
24
22
  this.item = item;
@@ -26,7 +24,7 @@ class For extends operation_1.default {
26
24
  build(visit) {
27
25
  return __awaiter(this, void 0, void 0, function* () {
28
26
  const stack = yield Promise.all(this.item.body.map((child) => visit(child)));
29
- this.block = new block_1.default(this.item, stack);
27
+ this.block = new block_1.Block(this.item, stack);
30
28
  this.variable = this.item.variable;
31
29
  this.iterator = yield visit(this.item.iterator);
32
30
  return this;
@@ -41,29 +39,29 @@ class For extends operation_1.default {
41
39
  const identifier = this.variable.name;
42
40
  const iteratorValue = (yield this.iterator.handle(ctx));
43
41
  if (typeof iteratorValue[Symbol.iterator] !== 'function') {
44
- return Promise.resolve(default_1.default.Void);
42
+ return Promise.resolve(default_1.DefaultType.Void);
45
43
  }
46
44
  const loopState = new context_1.LoopState();
47
45
  let index = 0;
48
46
  forCtx.loopState = loopState;
49
47
  return new Promise((resolve, reject) => {
50
48
  const iterator = iteratorValue[Symbol.iterator]();
51
- const idxIdentifier = new string_1.default(`__${identifier}_idx`);
52
- const varIdentifier = new string_1.default(identifier);
49
+ const idxIdentifier = new string_1.CustomString(`__${identifier}_idx`);
50
+ const varIdentifier = new string_1.CustomString(identifier);
53
51
  let iteratorResult = iterator.next();
54
52
  const iteration = () => __awaiter(this, void 0, void 0, function* () {
55
53
  try {
56
54
  if (iteratorResult.done) {
57
- resolve(default_1.default.Void);
55
+ resolve(default_1.DefaultType.Void);
58
56
  return;
59
57
  }
60
58
  const current = iteratorResult.value;
61
59
  loopState.isContinue = false;
62
- forCtx.set(idxIdentifier, new number_1.default(index++));
60
+ forCtx.set(idxIdentifier, new number_1.CustomNumber(index++));
63
61
  forCtx.set(varIdentifier, current);
64
62
  yield this.block.handle(forCtx);
65
63
  if (loopState.isBreak || ctx.isExit()) {
66
- resolve(default_1.default.Void);
64
+ resolve(default_1.DefaultType.Void);
67
65
  return;
68
66
  }
69
67
  iteratorResult = iterator.next();
@@ -78,4 +76,4 @@ class For extends operation_1.default {
78
76
  });
79
77
  }
80
78
  }
81
- exports.default = For;
79
+ exports.For = For;
@@ -1,9 +1,9 @@
1
1
  import { ASTUnaryExpression } from 'greyscript-core';
2
- import OperationContext from '../context';
3
- import CustomValue from '../types/base';
4
- import Operation, { CPSVisit } from './operation';
5
- import Resolve from './resolve';
6
- export default class FunctionReference extends Operation {
2
+ import { OperationContext } from '../context';
3
+ import { CustomValue } from '../types/base';
4
+ import { CPSVisit, Operation } from './operation';
5
+ import { Resolve } from './resolve';
6
+ export declare class FunctionReference extends Operation {
7
7
  readonly item: ASTUnaryExpression;
8
8
  ref: Resolve;
9
9
  constructor(item: ASTUnaryExpression, target?: string);
@@ -8,21 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const default_1 = __importDefault(require("../types/default"));
16
- const operation_1 = __importDefault(require("./operation"));
17
- const resolve_1 = __importDefault(require("./resolve"));
18
- class FunctionReference extends operation_1.default {
12
+ exports.FunctionReference = void 0;
13
+ const default_1 = require("../types/default");
14
+ const operation_1 = require("./operation");
15
+ const resolve_1 = require("./resolve");
16
+ class FunctionReference extends operation_1.Operation {
19
17
  constructor(item, target) {
20
18
  super(null, target);
21
19
  this.item = item;
22
20
  }
23
21
  build(visit) {
24
22
  return __awaiter(this, void 0, void 0, function* () {
25
- this.ref = new resolve_1.default(this.item.argument);
23
+ this.ref = new resolve_1.Resolve(this.item.argument);
26
24
  yield this.ref.build(visit);
27
25
  return this;
28
26
  });
@@ -30,7 +28,7 @@ class FunctionReference extends operation_1.default {
30
28
  handle(ctx) {
31
29
  return __awaiter(this, void 0, void 0, function* () {
32
30
  const refResult = yield this.ref.getResult(ctx);
33
- if (refResult.handle !== default_1.default.Void) {
31
+ if (refResult.handle !== default_1.DefaultType.Void) {
34
32
  if (refResult.path.count() === 0) {
35
33
  return refResult.handle;
36
34
  }
@@ -41,4 +39,4 @@ class FunctionReference extends operation_1.default {
41
39
  });
42
40
  }
43
41
  }
44
- exports.default = FunctionReference;
42
+ exports.FunctionReference = FunctionReference;
@@ -1,11 +1,11 @@
1
1
  import { ASTFunctionStatement } from 'greyscript-core';
2
- import OperationContext from '../context';
3
- import CustomValue from '../types/base';
4
- import CustomString from '../types/string';
5
- import Operation, { CPSVisit } from './operation';
2
+ import { OperationContext } from '../context';
3
+ import { CustomValue } from '../types/base';
4
+ import { CustomString } from '../types/string';
5
+ import { CPSVisit, Operation } from './operation';
6
6
  export declare const SELF_PROPERTY: CustomString;
7
7
  export declare const SUPER_PROPERTY: CustomString;
8
- export default class FunctionOperation extends Operation {
8
+ export declare class FunctionOperation extends Operation {
9
9
  readonly item: ASTFunctionStatement;
10
10
  block: Operation;
11
11
  args: Map<string, Operation>;
@@ -8,22 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.SUPER_PROPERTY = exports.SELF_PROPERTY = void 0;
12
+ exports.FunctionOperation = exports.SUPER_PROPERTY = exports.SELF_PROPERTY = void 0;
16
13
  const greyscript_core_1 = require("greyscript-core");
17
14
  const context_1 = require("../context");
18
- const default_1 = __importDefault(require("../types/default"));
19
- const function_1 = __importDefault(require("../types/function"));
20
- const string_1 = __importDefault(require("../types/string"));
21
- const block_1 = __importDefault(require("./block"));
22
- const operation_1 = __importDefault(require("./operation"));
23
- const reference_1 = __importDefault(require("./reference"));
24
- exports.SELF_PROPERTY = new string_1.default('self');
25
- exports.SUPER_PROPERTY = new string_1.default('super');
26
- class FunctionOperation extends operation_1.default {
15
+ const default_1 = require("../types/default");
16
+ const function_1 = require("../types/function");
17
+ const string_1 = require("../types/string");
18
+ const block_1 = require("./block");
19
+ const operation_1 = require("./operation");
20
+ const reference_1 = require("./reference");
21
+ exports.SELF_PROPERTY = new string_1.CustomString('self');
22
+ exports.SUPER_PROPERTY = new string_1.CustomString('super');
23
+ class FunctionOperation extends operation_1.Operation {
27
24
  constructor(item, target) {
28
25
  super(null, target);
29
26
  this.item = item;
@@ -31,7 +28,7 @@ class FunctionOperation extends operation_1.default {
31
28
  build(visit) {
32
29
  return __awaiter(this, void 0, void 0, function* () {
33
30
  const stack = yield Promise.all(this.item.body.map((child) => visit(child)));
34
- this.block = new block_1.default(this.item, stack);
31
+ this.block = new block_1.Block(this.item, stack);
35
32
  this.args = new Map();
36
33
  const defers = this.item.parameters.map((child) => __awaiter(this, void 0, void 0, function* () {
37
34
  switch (child.type) {
@@ -43,7 +40,7 @@ class FunctionOperation extends operation_1.default {
43
40
  }
44
41
  case greyscript_core_1.ASTType.Identifier: {
45
42
  const identifierKey = child;
46
- this.args.set(identifierKey.name, new reference_1.default(default_1.default.Void));
43
+ this.args.set(identifierKey.name, new reference_1.Reference(default_1.DefaultType.Void));
47
44
  break;
48
45
  }
49
46
  default:
@@ -55,7 +52,7 @@ class FunctionOperation extends operation_1.default {
55
52
  });
56
53
  }
57
54
  handle(ctx) {
58
- const func = new function_1.default(ctx, 'anonymous', (fnCtx, self, args, next) => __awaiter(this, void 0, void 0, function* () {
55
+ const func = new function_1.CustomFunction(ctx, 'anonymous', (fnCtx, self, args, next) => __awaiter(this, void 0, void 0, function* () {
59
56
  const functionState = new context_1.FunctionState();
60
57
  fnCtx.set(exports.SELF_PROPERTY, self);
61
58
  functionState.context = self;
@@ -63,10 +60,10 @@ class FunctionOperation extends operation_1.default {
63
60
  fnCtx.set(exports.SUPER_PROPERTY, next);
64
61
  functionState.super = next;
65
62
  }
66
- fnCtx.set(new string_1.default('locals'), fnCtx.locals.scope);
67
- fnCtx.set(new string_1.default('outer'), fnCtx.previous.locals.scope);
63
+ fnCtx.set(new string_1.CustomString('locals'), fnCtx.locals.scope);
64
+ fnCtx.set(new string_1.CustomString('outer'), fnCtx.previous.locals.scope);
68
65
  for (const [key, value] of args) {
69
- fnCtx.set(new string_1.default(key), value);
66
+ fnCtx.set(new string_1.CustomString(key), value);
70
67
  }
71
68
  fnCtx.functionState = functionState;
72
69
  yield this.block.handle(fnCtx);
@@ -78,4 +75,4 @@ class FunctionOperation extends operation_1.default {
78
75
  return Promise.resolve(func);
79
76
  }
80
77
  }
81
- exports.default = FunctionOperation;
78
+ exports.FunctionOperation = FunctionOperation;
@@ -1,19 +1,19 @@
1
1
  import { ASTElseClause, ASTIfClause, ASTIfStatement } from 'greyscript-core';
2
- import context from '../context';
3
- import CustomValue from '../types/base';
4
- import Block from './block';
5
- import Operation, { CPSVisit } from './operation';
2
+ import { OperationContext } from '../context';
3
+ import { CustomValue } from '../types/base';
4
+ import { Block } from './block';
5
+ import { CPSVisit, Operation } from './operation';
6
6
  export declare class Clause {
7
7
  readonly condition: Operation;
8
8
  readonly block: Block;
9
9
  constructor(condition: Operation, block: Block);
10
10
  }
11
- export default class IfStatement extends Operation {
11
+ export declare class IfStatement extends Operation {
12
12
  readonly item: ASTIfStatement;
13
13
  clauses: Array<Clause>;
14
14
  constructor(item: ASTIfStatement, target?: string);
15
15
  buildIfClause(node: ASTIfClause, visit: CPSVisit): Promise<void>;
16
16
  buildElseClause(node: ASTElseClause, visit: CPSVisit): Promise<void>;
17
17
  build(visit: CPSVisit): Promise<Operation>;
18
- handle(ctx: context): Promise<CustomValue>;
18
+ handle(ctx: OperationContext): Promise<CustomValue>;
19
19
  }
@@ -8,17 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.Clause = void 0;
12
+ exports.IfStatement = exports.Clause = void 0;
16
13
  const greyscript_core_1 = require("greyscript-core");
17
- const boolean_1 = __importDefault(require("../types/boolean"));
18
- const default_1 = __importDefault(require("../types/default"));
19
- const block_1 = __importDefault(require("./block"));
20
- const operation_1 = __importDefault(require("./operation"));
21
- const reference_1 = __importDefault(require("./reference"));
14
+ const boolean_1 = require("../types/boolean");
15
+ const default_1 = require("../types/default");
16
+ const block_1 = require("./block");
17
+ const operation_1 = require("./operation");
18
+ const reference_1 = require("./reference");
22
19
  class Clause {
23
20
  constructor(condition, block) {
24
21
  this.condition = condition;
@@ -26,7 +23,7 @@ class Clause {
26
23
  }
27
24
  }
28
25
  exports.Clause = Clause;
29
- class IfStatement extends operation_1.default {
26
+ class IfStatement extends operation_1.Operation {
30
27
  constructor(item, target) {
31
28
  super(null, target);
32
29
  this.item = item;
@@ -35,15 +32,15 @@ class IfStatement extends operation_1.default {
35
32
  return __awaiter(this, void 0, void 0, function* () {
36
33
  const condition = yield visit(node.condition);
37
34
  const stack = yield Promise.all(node.body.map((child) => visit(child)));
38
- const block = new block_1.default(this.item, stack);
35
+ const block = new block_1.Block(this.item, stack);
39
36
  this.clauses.push(new Clause(condition, block));
40
37
  });
41
38
  }
42
39
  buildElseClause(node, visit) {
43
40
  return __awaiter(this, void 0, void 0, function* () {
44
- const condition = new reference_1.default(new boolean_1.default(true));
41
+ const condition = new reference_1.Reference(new boolean_1.CustomBoolean(true));
45
42
  const stack = yield Promise.all(node.body.map((child) => visit(child)));
46
- const block = new block_1.default(this.item, stack);
43
+ const block = new block_1.Block(this.item, stack);
47
44
  this.clauses.push(new Clause(condition, block));
48
45
  });
49
46
  }
@@ -78,8 +75,8 @@ class IfStatement extends operation_1.default {
78
75
  break;
79
76
  }
80
77
  }
81
- return default_1.default.Void;
78
+ return default_1.DefaultType.Void;
82
79
  });
83
80
  }
84
81
  }
85
- exports.default = IfStatement;
82
+ exports.IfStatement = IfStatement;
@@ -1,19 +1,19 @@
1
1
  import { ASTFeatureImportExpression } from 'greybel-core';
2
2
  import { ASTBase } from 'greyscript-core';
3
- import context from '../context';
4
- import CustomValue from '../types/base';
5
- import CustomString from '../types/string';
6
- import Path from '../utils/path';
7
- import Operation, { CPSVisit } from './operation';
3
+ import { OperationContext } from '../context';
4
+ import { CustomValue } from '../types/base';
5
+ import { CustomString } from '../types/string';
6
+ import { Path } from '../utils/path';
7
+ import { CPSVisit, Operation } from './operation';
8
8
  export declare const MODULE_PROPERTY: CustomString;
9
9
  export declare const EXPORTS_PROPERTY: CustomString;
10
10
  export declare const EXPORTS_PATH: Path<CustomString>;
11
- export default class Import extends Operation {
11
+ export declare class Import extends Operation {
12
12
  readonly item: ASTFeatureImportExpression;
13
13
  code: string;
14
14
  chunk: ASTBase;
15
15
  top: Operation;
16
16
  constructor(item: ASTFeatureImportExpression, target: string, code: string);
17
17
  build(visit: CPSVisit): Promise<Operation>;
18
- handle(ctx: context): Promise<CustomValue>;
18
+ handle(ctx: OperationContext): Promise<CustomValue>;
19
19
  }
@@ -8,22 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.EXPORTS_PATH = exports.EXPORTS_PROPERTY = exports.MODULE_PROPERTY = void 0;
12
+ exports.Import = exports.EXPORTS_PATH = exports.EXPORTS_PROPERTY = exports.MODULE_PROPERTY = void 0;
16
13
  const greybel_core_1 = require("greybel-core");
17
14
  const context_1 = require("../context");
18
- const default_1 = __importDefault(require("../types/default"));
19
- const map_1 = __importDefault(require("../types/map"));
20
- const string_1 = __importDefault(require("../types/string"));
21
- const path_1 = __importDefault(require("../utils/path"));
22
- const operation_1 = __importDefault(require("./operation"));
23
- exports.MODULE_PROPERTY = new string_1.default('module');
24
- exports.EXPORTS_PROPERTY = new string_1.default('exports');
25
- exports.EXPORTS_PATH = new path_1.default([exports.MODULE_PROPERTY, exports.EXPORTS_PROPERTY]);
26
- class Import extends operation_1.default {
15
+ const default_1 = require("../types/default");
16
+ const map_1 = require("../types/map");
17
+ const string_1 = require("../types/string");
18
+ const path_1 = require("../utils/path");
19
+ const operation_1 = require("./operation");
20
+ exports.MODULE_PROPERTY = new string_1.CustomString('module');
21
+ exports.EXPORTS_PROPERTY = new string_1.CustomString('exports');
22
+ exports.EXPORTS_PATH = new path_1.Path([exports.MODULE_PROPERTY, exports.EXPORTS_PROPERTY]);
23
+ class Import extends operation_1.Operation {
27
24
  constructor(item, target, code) {
28
25
  super(null, target);
29
26
  this.item = item;
@@ -44,15 +41,15 @@ class Import extends operation_1.default {
44
41
  state: context_1.ContextState.Default,
45
42
  target: this.target
46
43
  });
47
- importCtx.locals.scope.set(exports.MODULE_PROPERTY, new map_1.default());
44
+ importCtx.locals.scope.set(exports.MODULE_PROPERTY, new map_1.CustomMap());
48
45
  yield this.top.handle(importCtx);
49
46
  const item = importCtx.locals.scope.has(exports.EXPORTS_PATH)
50
47
  ? importCtx.scope.get(exports.EXPORTS_PATH)
51
- : default_1.default.Void;
48
+ : default_1.DefaultType.Void;
52
49
  const identifier = this.item.name;
53
- ctx.set(new string_1.default(identifier.name), item);
54
- return default_1.default.Void;
50
+ ctx.set(new string_1.CustomString(identifier.name), item);
51
+ return default_1.DefaultType.Void;
55
52
  });
56
53
  }
57
54
  }
58
- exports.default = Import;
55
+ exports.Import = Import;
@@ -1,13 +1,13 @@
1
1
  import { ASTBase } from 'greyscript-core';
2
- import context from '../context';
3
- import CustomValue from '../types/base';
4
- import Operation, { CPSVisit } from './operation';
5
- export default class Include extends Operation {
2
+ import { OperationContext } from '../context';
3
+ import { CustomValue } from '../types/base';
4
+ import { CPSVisit, Operation } from './operation';
5
+ export declare class Include extends Operation {
6
6
  readonly item: ASTBase;
7
7
  code: string;
8
8
  chunk: ASTBase;
9
9
  top: Operation;
10
10
  constructor(item: ASTBase, target: string, code: string);
11
11
  build(visit: CPSVisit): Promise<Operation>;
12
- handle(ctx: context): Promise<CustomValue>;
12
+ handle(ctx: OperationContext): Promise<CustomValue>;
13
13
  }
@@ -8,14 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Include = void 0;
15
13
  const greybel_core_1 = require("greybel-core");
16
14
  const context_1 = require("../context");
17
- const operation_1 = __importDefault(require("./operation"));
18
- class Include extends operation_1.default {
15
+ const operation_1 = require("./operation");
16
+ class Include extends operation_1.Operation {
19
17
  constructor(item, target, code) {
20
18
  super(null, target);
21
19
  this.item = item;
@@ -38,4 +36,4 @@ class Include extends operation_1.default {
38
36
  return this.top.handle(importCtx);
39
37
  }
40
38
  }
41
- exports.default = Include;
39
+ exports.Include = Include;
@@ -1,11 +1,11 @@
1
1
  import { ASTListConstructorExpression } from 'greyscript-core';
2
- import context from '../context';
3
- import CustomValue from '../types/base';
4
- import Operation, { CPSVisit } from './operation';
5
- export default class List extends Operation {
2
+ import { OperationContext } from '../context';
3
+ import { CustomValue } from '../types/base';
4
+ import { CPSVisit, Operation } from './operation';
5
+ export declare class List extends Operation {
6
6
  readonly item: ASTListConstructorExpression;
7
7
  fields: Array<Operation>;
8
8
  constructor(item: ASTListConstructorExpression, target?: string);
9
9
  build(visit: CPSVisit): Promise<Operation>;
10
- handle(ctx: context): Promise<CustomValue>;
10
+ handle(ctx: OperationContext): Promise<CustomValue>;
11
11
  }
@@ -8,13 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const list_1 = __importDefault(require("../types/list"));
16
- const operation_1 = __importDefault(require("./operation"));
17
- class List extends operation_1.default {
12
+ exports.List = void 0;
13
+ const list_1 = require("../types/list");
14
+ const operation_1 = require("./operation");
15
+ class List extends operation_1.Operation {
18
16
  constructor(item, target) {
19
17
  super(null, target);
20
18
  this.item = item;
@@ -35,8 +33,8 @@ class List extends operation_1.default {
35
33
  const child = this.fields[index];
36
34
  fields.push(yield child.handle(ctx));
37
35
  }
38
- return new list_1.default(fields);
36
+ return new list_1.CustomList(fields);
39
37
  });
40
38
  }
41
39
  }
42
- exports.default = List;
40
+ exports.List = List;
@@ -1,11 +1,11 @@
1
1
  import { ASTLiteral } from 'greyscript-core';
2
- import context from '../context';
3
- import CustomValue from '../types/base';
4
- import Operation, { CPSVisit } from './operation';
5
- export default class Literal extends Operation {
2
+ import { OperationContext } from '../context';
3
+ import { CustomValue } from '../types/base';
4
+ import { CPSVisit, Operation } from './operation';
5
+ export declare class Literal extends Operation {
6
6
  readonly item: ASTLiteral;
7
7
  value: CustomValue;
8
8
  constructor(item: ASTLiteral, target?: string);
9
9
  build(_visit: CPSVisit): Promise<Operation>;
10
- handle(_ctx: context): Promise<CustomValue>;
10
+ handle(_ctx: OperationContext): Promise<CustomValue>;
11
11
  }
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Literal = void 0;
6
4
  const greyscript_core_1 = require("greyscript-core");
7
- const boolean_1 = __importDefault(require("../types/boolean"));
8
- const default_1 = __importDefault(require("../types/default"));
9
- const number_1 = __importDefault(require("../types/number"));
10
- const string_1 = __importDefault(require("../types/string"));
11
- const operation_1 = __importDefault(require("./operation"));
12
- class Literal extends operation_1.default {
5
+ const boolean_1 = require("../types/boolean");
6
+ const default_1 = require("../types/default");
7
+ const number_1 = require("../types/number");
8
+ const string_1 = require("../types/string");
9
+ const operation_1 = require("./operation");
10
+ class Literal extends operation_1.Operation {
13
11
  constructor(item, target) {
14
12
  super(null, target);
15
13
  this.item = item;
@@ -17,16 +15,16 @@ class Literal extends operation_1.default {
17
15
  build(_visit) {
18
16
  switch (this.item.type) {
19
17
  case greyscript_core_1.ASTType.BooleanLiteral:
20
- this.value = new boolean_1.default(this.item.value);
18
+ this.value = new boolean_1.CustomBoolean(this.item.value);
21
19
  break;
22
20
  case greyscript_core_1.ASTType.StringLiteral:
23
- this.value = new string_1.default(this.item.value);
21
+ this.value = new string_1.CustomString(this.item.value);
24
22
  break;
25
23
  case greyscript_core_1.ASTType.NumericLiteral:
26
- this.value = new number_1.default(this.item.value);
24
+ this.value = new number_1.CustomNumber(this.item.value);
27
25
  break;
28
26
  case greyscript_core_1.ASTType.NilLiteral:
29
- this.value = default_1.default.Void;
27
+ this.value = default_1.DefaultType.Void;
30
28
  break;
31
29
  default:
32
30
  throw new Error('Unexpected literal type.');
@@ -37,4 +35,4 @@ class Literal extends operation_1.default {
37
35
  return Promise.resolve(this.value);
38
36
  }
39
37
  }
40
- exports.default = Literal;
38
+ exports.Literal = Literal;
@@ -1,11 +1,11 @@
1
1
  import { ASTMapConstructorExpression } from 'greyscript-core';
2
- import context from '../context';
3
- import CustomValue from '../types/base';
4
- import Operation, { CPSVisit } from './operation';
5
- export default class MapOperation extends Operation {
2
+ import { OperationContext } from '../context';
3
+ import { CustomValue } from '../types/base';
4
+ import { CPSVisit, Operation } from './operation';
5
+ export declare class MapOperation extends Operation {
6
6
  readonly item: ASTMapConstructorExpression;
7
7
  fields: Map<Operation, Operation>;
8
8
  constructor(item: ASTMapConstructorExpression, target?: string);
9
9
  build(visit: CPSVisit): Promise<Operation>;
10
- handle(ctx: context): Promise<CustomValue>;
10
+ handle(ctx: OperationContext): Promise<CustomValue>;
11
11
  }
@@ -8,14 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const map_1 = __importDefault(require("../types/map"));
16
- const object_value_1 = __importDefault(require("../utils/object-value"));
17
- const operation_1 = __importDefault(require("./operation"));
18
- class MapOperation extends operation_1.default {
12
+ exports.MapOperation = void 0;
13
+ const map_1 = require("../types/map");
14
+ const object_value_1 = require("../utils/object-value");
15
+ const operation_1 = require("./operation");
16
+ class MapOperation extends operation_1.Operation {
19
17
  constructor(item, target) {
20
18
  super(null, target);
21
19
  this.item = item;
@@ -33,12 +31,12 @@ class MapOperation extends operation_1.default {
33
31
  }
34
32
  handle(ctx) {
35
33
  return __awaiter(this, void 0, void 0, function* () {
36
- const newMap = new object_value_1.default();
34
+ const newMap = new object_value_1.ObjectValue();
37
35
  for (const [key, value] of this.fields) {
38
36
  newMap.set(yield key.handle(ctx), yield value.handle(ctx));
39
37
  }
40
- return new map_1.default(newMap);
38
+ return new map_1.CustomMap(newMap);
41
39
  });
42
40
  }
43
41
  }
44
- exports.default = MapOperation;
42
+ exports.MapOperation = MapOperation;
@@ -1,11 +1,11 @@
1
1
  import { ASTUnaryExpression } from 'greyscript-core';
2
- import context from '../context';
3
- import CustomValue from '../types/base';
4
- import Operation, { CPSVisit } from './operation';
5
- export default class NegatedBinary extends Operation {
2
+ import { OperationContext } from '../context';
3
+ import { CustomValue } from '../types/base';
4
+ import { CPSVisit, Operation } from './operation';
5
+ export declare class NegatedBinary extends Operation {
6
6
  readonly item: ASTUnaryExpression;
7
7
  arg: Operation;
8
8
  constructor(item: ASTUnaryExpression, target?: string);
9
9
  build(visit: CPSVisit): Promise<Operation>;
10
- handle(ctx: context): Promise<CustomValue>;
10
+ handle(ctx: OperationContext): Promise<CustomValue>;
11
11
  }