mlogjs 0.1.10 → 0.2.1
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/LICENSE +21 -21
- package/README.md +68 -18
- package/build/Compiler.d.ts +18 -18
- package/build/Compiler.js +99 -92
- package/build/Compiler.js.map +1 -1
- package/build/Scope.d.ts +26 -26
- package/build/Scope.js +60 -60
- package/build/Scope.js.map +1 -1
- package/build/bin.d.ts +2 -2
- package/build/bin.js +59 -33
- package/build/bin.js.map +1 -1
- package/build/handlers/BlockStatement.d.ts +2 -2
- package/build/handlers/BlockStatement.js +13 -13
- package/build/handlers/BlockStatement.js.map +1 -1
- package/build/handlers/CallExpression.d.ts +3 -3
- package/build/handlers/CallExpression.js +19 -19
- package/build/handlers/CallExpression.js.map +1 -1
- package/build/handlers/ForStatement.d.ts +2 -2
- package/build/handlers/ForStatement.js +31 -31
- package/build/handlers/ForStatement.js.map +1 -1
- package/build/handlers/Function.d.ts +4 -4
- package/build/handlers/Function.js +35 -32
- package/build/handlers/Function.js.map +1 -1
- package/build/handlers/Identifier.d.ts +2 -2
- package/build/handlers/Identifier.js +7 -7
- package/build/handlers/Identifier.js.map +1 -1
- package/build/handlers/IfStatement.d.ts +2 -2
- package/build/handlers/IfStatement.js +24 -24
- package/build/handlers/IfStatement.js.map +1 -1
- package/build/handlers/Literal.d.ts +2 -2
- package/build/handlers/Literal.js +17 -15
- package/build/handlers/Literal.js.map +1 -1
- package/build/handlers/Object.d.ts +4 -4
- package/build/handlers/Object.js +43 -43
- package/build/handlers/Object.js.map +1 -1
- package/build/handlers/OperationExpressions.d.ts +7 -7
- package/build/handlers/OperationExpressions.js +32 -31
- package/build/handlers/OperationExpressions.js.map +1 -1
- package/build/handlers/Program.d.ts +2 -2
- package/build/handlers/Program.js +8 -8
- package/build/handlers/Program.js.map +1 -1
- package/build/handlers/Statements.d.ts +5 -5
- package/build/handlers/Statements.js +29 -27
- package/build/handlers/Statements.js.map +1 -1
- package/build/handlers/TemplateExpression.d.ts +2 -2
- package/build/handlers/TemplateExpression.js +17 -17
- package/build/handlers/TemplateExpression.js.map +1 -1
- package/build/handlers/VariableDeclaration.d.ts +3 -3
- package/build/handlers/VariableDeclaration.js +55 -31
- package/build/handlers/VariableDeclaration.js.map +1 -1
- package/build/handlers/WhileStatement.d.ts +2 -2
- package/build/handlers/WhileStatement.js +22 -22
- package/build/handlers/WhileStatement.js.map +1 -1
- package/build/handlers/index.d.ts +14 -14
- package/build/handlers/index.js +30 -26
- package/build/handlers/index.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/initScope.d.ts +2 -0
- package/build/initScope.js +40 -0
- package/build/initScope.js.map +1 -0
- package/build/instructions/AddressResolver.d.ts +12 -12
- package/build/instructions/AddressResolver.js +30 -31
- package/build/instructions/AddressResolver.js.map +1 -1
- package/build/instructions/ControlInstructions.d.ts +11 -11
- package/build/instructions/ControlInstructions.js +22 -22
- package/build/instructions/ControlInstructions.js.map +1 -1
- package/build/instructions/EndInstruction.d.ts +4 -4
- package/build/instructions/EndInstruction.js +10 -10
- package/build/instructions/EndInstruction.js.map +1 -1
- package/build/instructions/InstructionBase.d.ts +10 -10
- package/build/instructions/InstructionBase.js +20 -20
- package/build/instructions/InstructionBase.js.map +1 -1
- package/build/instructions/JumpInstruction.d.ts +15 -15
- package/build/instructions/JumpInstruction.js +21 -21
- package/build/instructions/JumpInstruction.js.map +1 -1
- package/build/instructions/OperationInstruction.d.ts +5 -5
- package/build/instructions/OperationInstruction.js +10 -10
- package/build/instructions/OperationInstruction.js.map +1 -1
- package/build/instructions/SetCounterInstruction.d.ts +5 -5
- package/build/instructions/SetCounterInstruction.js +10 -10
- package/build/instructions/SetCounterInstruction.js.map +1 -1
- package/build/instructions/SetInstruction.d.ts +5 -5
- package/build/instructions/SetInstruction.js +10 -10
- package/build/instructions/SetInstruction.js.map +1 -1
- package/build/instructions/ZeroSpaceInstruction.d.ts +4 -4
- package/build/instructions/ZeroSpaceInstruction.js +10 -10
- package/build/instructions/ZeroSpaceInstruction.js.map +1 -1
- package/build/instructions/index.d.ts +9 -9
- package/build/instructions/index.js +25 -21
- package/build/instructions/index.js.map +1 -1
- package/build/macros/Building.d.ts +11 -0
- package/build/macros/Building.js +81 -0
- package/build/macros/Building.js.map +1 -0
- package/build/macros/Function.d.ts +12 -12
- package/build/macros/Function.js +19 -19
- package/build/macros/Function.js.map +1 -1
- package/build/macros/Math.d.ts +5 -5
- package/build/macros/Math.js +56 -56
- package/build/macros/Math.js.map +1 -1
- package/build/macros/{Blocks.d.ts → Memory.d.ts} +5 -5
- package/build/macros/Memory.js +61 -0
- package/build/macros/Memory.js.map +1 -0
- package/build/macros/Namespace.d.ts +21 -0
- package/build/macros/Namespace.js +98 -0
- package/build/macros/Namespace.js.map +1 -0
- package/build/macros/Other.d.ts +5 -8
- package/build/macros/Other.js +19 -28
- package/build/macros/Other.js.map +1 -1
- package/build/macros/{Draw.d.ts → RawValue.d.ts} +5 -5
- package/build/macros/RawValue.js +16 -0
- package/build/macros/RawValue.js.map +1 -0
- package/build/macros/commands/Control.d.ts +5 -0
- package/build/macros/commands/Control.js +25 -0
- package/build/macros/commands/Control.js.map +1 -0
- package/build/macros/commands/Draw.d.ts +5 -0
- package/build/macros/{Draw.js → commands/Draw.js} +38 -33
- package/build/macros/commands/Draw.js.map +1 -0
- package/build/macros/commands/DrawFlush.d.ts +5 -0
- package/build/macros/commands/DrawFlush.js +17 -0
- package/build/macros/commands/DrawFlush.js.map +1 -0
- package/build/macros/commands/GetLink.d.ts +5 -0
- package/build/macros/commands/GetLink.js +21 -0
- package/build/macros/commands/GetLink.js.map +1 -0
- package/build/macros/commands/Lookup.d.ts +5 -0
- package/build/macros/commands/Lookup.js +24 -0
- package/build/macros/commands/Lookup.js.map +1 -0
- package/build/macros/commands/Print.d.ts +5 -0
- package/build/macros/commands/Print.js +14 -0
- package/build/macros/commands/Print.js.map +1 -0
- package/build/macros/commands/PrintFlush.d.ts +5 -0
- package/build/macros/commands/PrintFlush.js +17 -0
- package/build/macros/commands/PrintFlush.js.map +1 -0
- package/build/macros/commands/Radar.d.ts +7 -0
- package/build/macros/commands/Radar.js +61 -0
- package/build/macros/commands/Radar.js.map +1 -0
- package/build/macros/commands/Sensor.d.ts +5 -0
- package/build/macros/commands/Sensor.js +20 -0
- package/build/macros/commands/Sensor.js.map +1 -0
- package/build/macros/commands/UnitBind.d.ts +5 -0
- package/build/macros/commands/UnitBind.js +17 -0
- package/build/macros/commands/UnitBind.js.map +1 -0
- package/build/macros/commands/UnitControl.d.ts +5 -0
- package/build/macros/commands/UnitControl.js +68 -0
- package/build/macros/commands/UnitControl.js.map +1 -0
- package/build/macros/commands/UnitLocate.d.ts +5 -0
- package/build/macros/commands/UnitLocate.js +55 -0
- package/build/macros/commands/UnitLocate.js.map +1 -0
- package/build/macros/commands/UnitRadar.d.ts +5 -0
- package/build/macros/commands/UnitRadar.js +41 -0
- package/build/macros/commands/UnitRadar.js.map +1 -0
- package/build/macros/commands/Wait.d.ts +5 -0
- package/build/macros/commands/Wait.js +18 -0
- package/build/macros/commands/Wait.js.map +1 -0
- package/build/macros/commands/index.d.ts +14 -0
- package/build/macros/commands/index.js +33 -0
- package/build/macros/commands/index.js.map +1 -0
- package/build/macros/index.d.ts +7 -5
- package/build/macros/index.js +39 -17
- package/build/macros/index.js.map +1 -1
- package/build/operators.d.ts +25 -22
- package/build/operators.js +101 -38
- package/build/operators.js.map +1 -1
- package/build/types.d.ts +49 -49
- package/build/types.js +27 -23
- package/build/types.js.map +1 -1
- package/build/utils.d.ts +3 -2
- package/build/utils.js +12 -8
- package/build/utils.js.map +1 -1
- package/build/values/BaseValue.d.ts +5 -5
- package/build/values/BaseValue.js +111 -101
- package/build/values/BaseValue.js.map +1 -1
- package/build/values/FunctionValue.d.ts +34 -34
- package/build/values/FunctionValue.js +103 -100
- package/build/values/FunctionValue.js.map +1 -1
- package/build/values/LiteralValue.d.ts +12 -12
- package/build/values/LiteralValue.js +87 -88
- package/build/values/LiteralValue.js.map +1 -1
- package/build/values/ObjectValue.d.ts +17 -17
- package/build/values/ObjectValue.js +49 -49
- package/build/values/ObjectValue.js.map +1 -1
- package/build/values/StoreValue.d.ts +11 -11
- package/build/values/StoreValue.js +30 -30
- package/build/values/StoreValue.js.map +1 -1
- package/build/values/TempValue.d.ts +12 -12
- package/build/values/TempValue.js +66 -52
- package/build/values/TempValue.js.map +1 -1
- package/build/values/VoidValue.d.ts +11 -11
- package/build/values/VoidValue.js +30 -30
- package/build/values/VoidValue.js.map +1 -1
- package/build/values/index.d.ts +6 -6
- package/build/values/index.js +22 -18
- package/build/values/index.js.map +1 -1
- package/dist/mlogjs.es.js +6366 -0
- package/dist/mlogjs.umd.js +8 -0
- package/lib/commands.d.ts +326 -0
- package/lib/eslib/index.d.ts +3 -0
- package/lib/eslib/lib.d.ts +9 -0
- package/lib/eslib/lib.es2015.collection.d.ts +89 -0
- package/lib/eslib/lib.es2015.core.d.ts +16 -0
- package/lib/eslib/lib.es2015.d.ts +30 -0
- package/lib/eslib/lib.es2015.generator.d.ts +79 -0
- package/lib/eslib/lib.es2015.iterable.d.ts +70 -0
- package/lib/eslib/lib.es5.d.ts +295 -0
- package/lib/eslib/lib.es6.d.ts +18 -0
- package/lib/globals.d.ts +328 -0
- package/lib/helpers.d.ts +23 -0
- package/lib/index.d.ts +7 -0
- package/lib/kinds.d.ts +36 -0
- package/lib/memory.d.ts +17 -0
- package/lib/traits.d.ts +121 -0
- package/lib/util.d.ts +32 -0
- package/package.json +73 -37
- package/.gitattributes +0 -2
- package/build/macros/Blocks.js +0 -134
- package/build/macros/Blocks.js.map +0 -1
- package/build/macros/Draw.js.map +0 -1
- package/build/macros/TypeFactory.d.ts +0 -8
- package/build/macros/TypeFactory.js +0 -22
- package/build/macros/TypeFactory.js.map +0 -1
- package/build/scopes/FunctionScope.d.ts +0 -5
- package/build/scopes/FunctionScope.js +0 -13
- package/build/scopes/FunctionScope.js.map +0 -1
- package/build/scopes/LoopScope.d.ts +0 -5
- package/build/scopes/LoopScope.js +0 -13
- package/build/scopes/LoopScope.js.map +0 -1
- package/build/scopes/Scope.d.ts +0 -36
- package/build/scopes/Scope.js +0 -93
- package/build/scopes/Scope.js.map +0 -1
- package/build/scopes/index.d.ts +0 -3
- package/build/scopes/index.js +0 -16
- package/build/scopes/index.js.map +0 -1
- package/dist/bundle.js +0 -553
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -17
- package/docs/_coverpage.md +0 -8
- package/docs/_sidebar.md +0 -3
- package/docs/data-types.md +0 -56
- package/docs/getting-started.md +0 -19
- package/docs/index.html +0 -41
- package/docs/mlogjs.png +0 -0
- package/mlogjs.d.ts +0 -72
- package/tsconfig.json +0 -22
- package/webpack.config.js +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionValue.js","sourceRoot":"","sources":["../../src/values/FunctionValue.ts"],"names":[],"mappings":";;;AACA,kDAMyB;
|
|
1
|
+
{"version":3,"file":"FunctionValue.js","sourceRoot":"","sources":["../../src/values/FunctionValue.ts"],"names":[],"mappings":";;;AACA,kDAMyB;AASzB,iDAA8C;AAC9C,6CAA0C;AAC1C,2CAAwC;AACxC,2CAAwC;AAExC,MAAa,aAAc,SAAQ,qBAAS;IAqC1C,YACE,KAAa,EACb,IAAY,EACZ,UAAoB,EACpB,WAAyB,EACzB,IAAuB,EACvB,CAAW;QAEX,KAAK,CAAC,KAAK,CAAC,CAAC;QA5Cf,aAAQ,GAAG,IAAI,CAAC;QAChB,UAAK,GAAG,IAAI,CAAC;QAeL,YAAO,GAAY,KAAK,CAAC;QA8B/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,CAAC,GAAG,CA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AAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAChD,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QAC/D,IAAI,IAAI,CAAC,MAAM,IAAI,UAAU,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,UAAU,CAAC;QAClE,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,GAAW;QAC/B,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE;YACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SACnB;QACD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpB,CAAC;CACF;AAtID,sCAsIC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IScope, IBindableValue, TLiteral, TValueInstructions, IValue } from "../types";
|
|
2
|
-
import { BaseValue } from ".";
|
|
3
|
-
export declare class LiteralValue extends BaseValue implements IBindableValue {
|
|
4
|
-
data: TLiteral;
|
|
5
|
-
constant: boolean;
|
|
6
|
-
constructor(scope: IScope, data: TLiteral);
|
|
7
|
-
eval(scope: IScope): TValueInstructions;
|
|
8
|
-
toString(): string;
|
|
9
|
-
get(scope: IScope, name: IValue): TValueInstructions;
|
|
10
|
-
get num(): number;
|
|
11
|
-
typeof(scope: IScope): TValueInstructions;
|
|
12
|
-
}
|
|
1
|
+
import { IScope, IBindableValue, TLiteral, TValueInstructions, IValue } from "../types";
|
|
2
|
+
import { BaseValue } from ".";
|
|
3
|
+
export declare class LiteralValue extends BaseValue implements IBindableValue {
|
|
4
|
+
data: TLiteral;
|
|
5
|
+
constant: boolean;
|
|
6
|
+
constructor(scope: IScope, data: TLiteral);
|
|
7
|
+
eval(scope: IScope): TValueInstructions;
|
|
8
|
+
toString(): string;
|
|
9
|
+
get(scope: IScope, name: IValue): TValueInstructions;
|
|
10
|
+
get num(): number;
|
|
11
|
+
typeof(scope: IScope): TValueInstructions;
|
|
12
|
+
}
|
|
@@ -1,89 +1,88 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LiteralValue = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
const literalMethods = {
|
|
6
|
-
length: function (scope) {
|
|
7
|
-
if (typeof this.data !== "string")
|
|
8
|
-
throw new Error("Length method only works on string literal values.");
|
|
9
|
-
return new LiteralValue(scope, this.data.length);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
class LiteralValue extends _1.BaseValue {
|
|
13
|
-
constructor(scope, data) {
|
|
14
|
-
super(scope);
|
|
15
|
-
this.constant = true;
|
|
16
|
-
this.data = data;
|
|
17
|
-
}
|
|
18
|
-
eval(scope) {
|
|
19
|
-
return [this, []];
|
|
20
|
-
}
|
|
21
|
-
toString() {
|
|
22
|
-
return JSON.stringify(this.data);
|
|
23
|
-
}
|
|
24
|
-
get(scope, name) {
|
|
25
|
-
if (!(name instanceof LiteralValue && typeof name.data === "string"))
|
|
26
|
-
return super.get(scope, name);
|
|
27
|
-
const method = literalMethods[name.data];
|
|
28
|
-
if (!method)
|
|
29
|
-
throw new Error(`Method ${name.data} does not exist on literal values.`);
|
|
30
|
-
return [method.apply(this, [scope]), []];
|
|
31
|
-
}
|
|
32
|
-
get num() {
|
|
33
|
-
if (this.data === null)
|
|
34
|
-
return 0;
|
|
35
|
-
if (typeof this.data === "string")
|
|
36
|
-
return 1;
|
|
37
|
-
return this.data;
|
|
38
|
-
}
|
|
39
|
-
typeof(scope) {
|
|
40
|
-
return [new LiteralValue(scope, "literal"), []];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.LiteralValue = LiteralValue;
|
|
44
|
-
const operatorMap = {
|
|
45
|
-
"==": (a, b) => +(a == b),
|
|
46
|
-
"===": (a, b) => +(a === b),
|
|
47
|
-
"!=": (a, b) => +(a != b),
|
|
48
|
-
"!==": (a, b) => +(a !== b),
|
|
49
|
-
"<": (a, b) => +(a < b),
|
|
50
|
-
">": (a, b) => +(a > b),
|
|
51
|
-
"<=": (a, b) => +(a <= b),
|
|
52
|
-
">=": (a, b) => +(a >= b),
|
|
53
|
-
"+": (a, b) => a + b,
|
|
54
|
-
"-": (a, b) => a - b,
|
|
55
|
-
"*": (a, b) => a * b,
|
|
56
|
-
"/": (a, b) => a / b,
|
|
57
|
-
"%": (a, b) => a % b,
|
|
58
|
-
"**": (a, b) =>
|
|
59
|
-
"|": (a, b) => a | b,
|
|
60
|
-
"&": (a, b) => a & b,
|
|
61
|
-
"^": (a, b) => a ^ b,
|
|
62
|
-
">>": (a, b) => a >> b,
|
|
63
|
-
">>>": (a, b) => a >> b,
|
|
64
|
-
"<<": (a, b) => a << b,
|
|
65
|
-
"&&": (a, b) => +(a && b),
|
|
66
|
-
"||": (a, b) => +(a || b),
|
|
67
|
-
};
|
|
68
|
-
for (const key in operatorMap) {
|
|
69
|
-
const fn = operatorMap[key];
|
|
70
|
-
LiteralValue.prototype[key] = function (scope, value) {
|
|
71
|
-
if (!(value instanceof LiteralValue)) {
|
|
72
|
-
return _1.BaseValue.prototype[key].apply(this, [scope, value]);
|
|
73
|
-
}
|
|
74
|
-
;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LiteralValue = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const literalMethods = {
|
|
6
|
+
length: function (scope) {
|
|
7
|
+
if (typeof this.data !== "string")
|
|
8
|
+
throw new Error("Length method only works on string literal values.");
|
|
9
|
+
return new LiteralValue(scope, this.data.length);
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
class LiteralValue extends _1.BaseValue {
|
|
13
|
+
constructor(scope, data) {
|
|
14
|
+
super(scope);
|
|
15
|
+
this.constant = true;
|
|
16
|
+
this.data = data;
|
|
17
|
+
}
|
|
18
|
+
eval(scope) {
|
|
19
|
+
return [this, []];
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
return JSON.stringify(this.data);
|
|
23
|
+
}
|
|
24
|
+
get(scope, name) {
|
|
25
|
+
if (!(name instanceof LiteralValue && typeof name.data === "string"))
|
|
26
|
+
return super.get(scope, name);
|
|
27
|
+
const method = literalMethods[name.data];
|
|
28
|
+
if (!method)
|
|
29
|
+
throw new Error(`Method ${name.data} does not exist on literal values.`);
|
|
30
|
+
return [method.apply(this, [scope]), []];
|
|
31
|
+
}
|
|
32
|
+
get num() {
|
|
33
|
+
if (this.data === null)
|
|
34
|
+
return 0;
|
|
35
|
+
if (typeof this.data === "string")
|
|
36
|
+
return 1;
|
|
37
|
+
return this.data;
|
|
38
|
+
}
|
|
39
|
+
typeof(scope) {
|
|
40
|
+
return [new LiteralValue(scope, "literal"), []];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.LiteralValue = LiteralValue;
|
|
44
|
+
const operatorMap = {
|
|
45
|
+
"==": (a, b) => +(a == b),
|
|
46
|
+
"===": (a, b) => +(a === b),
|
|
47
|
+
"!=": (a, b) => +(a != b),
|
|
48
|
+
"!==": (a, b) => +(a !== b),
|
|
49
|
+
"<": (a, b) => +(a < b),
|
|
50
|
+
">": (a, b) => +(a > b),
|
|
51
|
+
"<=": (a, b) => +(a <= b),
|
|
52
|
+
">=": (a, b) => +(a >= b),
|
|
53
|
+
"+": (a, b) => a + b,
|
|
54
|
+
"-": (a, b) => a - b,
|
|
55
|
+
"*": (a, b) => a * b,
|
|
56
|
+
"/": (a, b) => a / b,
|
|
57
|
+
"%": (a, b) => a % b,
|
|
58
|
+
"**": (a, b) => a ** b,
|
|
59
|
+
"|": (a, b) => a | b,
|
|
60
|
+
"&": (a, b) => a & b,
|
|
61
|
+
"^": (a, b) => a ^ b,
|
|
62
|
+
">>": (a, b) => a >> b,
|
|
63
|
+
">>>": (a, b) => a >> b,
|
|
64
|
+
"<<": (a, b) => a << b,
|
|
65
|
+
"&&": (a, b) => +(a && b),
|
|
66
|
+
"||": (a, b) => +(a || b),
|
|
67
|
+
};
|
|
68
|
+
for (const key in operatorMap) {
|
|
69
|
+
const fn = operatorMap[key];
|
|
70
|
+
LiteralValue.prototype[key] = function (scope, value) {
|
|
71
|
+
if (!(value instanceof LiteralValue)) {
|
|
72
|
+
return _1.BaseValue.prototype[key].apply(this, [scope, value]);
|
|
73
|
+
}
|
|
74
|
+
return [new LiteralValue(scope, fn(this.num, value.num)), []];
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const unaryOperatorMap = {
|
|
78
|
+
"!": v => +!v,
|
|
79
|
+
"~": v => ~v,
|
|
80
|
+
"u-": v => -v,
|
|
81
|
+
};
|
|
82
|
+
for (const key in unaryOperatorMap) {
|
|
83
|
+
LiteralValue.prototype[key] = function (scope) {
|
|
84
|
+
const fn = unaryOperatorMap[key];
|
|
85
|
+
return [new LiteralValue(scope, fn(this.num)), []];
|
|
86
|
+
};
|
|
87
|
+
}
|
|
89
88
|
//# sourceMappingURL=LiteralValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiteralValue.js","sourceRoot":"","sources":["../../src/values/LiteralValue.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"LiteralValue.js","sourceRoot":"","sources":["../../src/values/LiteralValue.ts"],"names":[],"mappings":";;;AAOA,wBAA8B;AAG9B,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,UAA8B,KAAa;QACjD,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;YAC/B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACF,CAAC;AAEF,MAAa,YAAa,SAAQ,YAAS;IAGzC,YAAY,KAAa,EAAE,IAAc;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QAFf,aAAQ,GAAG,IAAI,CAAC;QAGd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,IAAI,CAAC,KAAa;QAChB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpB,CAAC;IACD,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,GAAG,CAAC,KAAa,EAAE,IAAY;QAC7B,IAAI,CAAC,CAAC,IAAI,YAAY,YAAY,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;YAClE,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM;YACT,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,CAAC,IAAI,oCAAoC,CAAC,CAAC;QAC3E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CA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EACb,KAAmB;QAEnB,IAAI,CAAC,CAAC,KAAK,YAAY,YAAY,CAAC,EAAE;YACpC,OAAO,YAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;SAC7D;QACD,OAAO,CAAC,IAAI,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChE,CAAC,CAAC;CACH;AAED,MAAM,gBAAgB,GAA4C;IAChE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACb,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACZ,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACL,CAAC;AAEX,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE;IAClC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,UAE5B,KAAa;QAEb,MAAM,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAiB,CAAC;QACjD,OAAO,CAAC,IAAI,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC;CACH"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
-
import { LiteralValue } from "./LiteralValue";
|
|
3
|
-
import { VoidValue } from "./VoidValue";
|
|
4
|
-
export declare class ObjectValue extends VoidValue {
|
|
5
|
-
constant: boolean;
|
|
6
|
-
macro: boolean;
|
|
7
|
-
data: {
|
|
8
|
-
[k: string]: IValue;
|
|
9
|
-
};
|
|
10
|
-
constructor(scope: IScope, data?: {
|
|
11
|
-
[k: string]: IValue;
|
|
12
|
-
});
|
|
13
|
-
typeof(scope: IScope): TValueInstructions;
|
|
14
|
-
get(scope: IScope, key: LiteralValue): TValueInstructions;
|
|
15
|
-
eval(scope: IScope): TValueInstructions;
|
|
16
|
-
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
17
|
-
}
|
|
1
|
+
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
+
import { LiteralValue } from "./LiteralValue";
|
|
3
|
+
import { VoidValue } from "./VoidValue";
|
|
4
|
+
export declare class ObjectValue extends VoidValue {
|
|
5
|
+
constant: boolean;
|
|
6
|
+
macro: boolean;
|
|
7
|
+
data: {
|
|
8
|
+
[k: string]: IValue;
|
|
9
|
+
};
|
|
10
|
+
constructor(scope: IScope, data?: {
|
|
11
|
+
[k: string]: IValue;
|
|
12
|
+
});
|
|
13
|
+
typeof(scope: IScope): TValueInstructions;
|
|
14
|
+
get(scope: IScope, key: LiteralValue): TValueInstructions;
|
|
15
|
+
eval(scope: IScope): TValueInstructions;
|
|
16
|
+
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
17
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectValue = void 0;
|
|
4
|
-
const operators_1 = require("../operators");
|
|
5
|
-
const LiteralValue_1 = require("./LiteralValue");
|
|
6
|
-
const VoidValue_1 = require("./VoidValue");
|
|
7
|
-
class ObjectValue extends VoidValue_1.VoidValue {
|
|
8
|
-
constructor(scope, data = {}) {
|
|
9
|
-
super(scope);
|
|
10
|
-
this.constant = true;
|
|
11
|
-
this.macro = true;
|
|
12
|
-
this.data = data;
|
|
13
|
-
}
|
|
14
|
-
typeof(scope) {
|
|
15
|
-
return [new LiteralValue_1.LiteralValue(scope, "object"), []];
|
|
16
|
-
}
|
|
17
|
-
get(scope, key) {
|
|
18
|
-
const member = this.data[key.data];
|
|
19
|
-
if (member)
|
|
20
|
-
return [member, []];
|
|
21
|
-
const { $get } = this.data;
|
|
22
|
-
if (!$get)
|
|
23
|
-
throw new Error("Cannot get undefined member.");
|
|
24
|
-
return $get.call(scope, [key]);
|
|
25
|
-
}
|
|
26
|
-
eval(scope) {
|
|
27
|
-
const { $eval } = this.data;
|
|
28
|
-
if (!$eval)
|
|
29
|
-
return [this, []];
|
|
30
|
-
return $eval.call(scope, []);
|
|
31
|
-
}
|
|
32
|
-
call(scope, args) {
|
|
33
|
-
const { $call } = this.data;
|
|
34
|
-
if (!$call)
|
|
35
|
-
return super.call(scope, args);
|
|
36
|
-
return $call.call(scope, args);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.ObjectValue = ObjectValue;
|
|
40
|
-
for (const op of operators_1.operators) {
|
|
41
|
-
ObjectValue.prototype[op] = function (...args) {
|
|
42
|
-
const $ = this.data["$" + op];
|
|
43
|
-
if (!$)
|
|
44
|
-
return VoidValue_1.VoidValue.prototype[op].apply(this, args);
|
|
45
|
-
let [scope, ...fnArgs] = args;
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
return $.call(scope, fnArgs);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectValue = void 0;
|
|
4
|
+
const operators_1 = require("../operators");
|
|
5
|
+
const LiteralValue_1 = require("./LiteralValue");
|
|
6
|
+
const VoidValue_1 = require("./VoidValue");
|
|
7
|
+
class ObjectValue extends VoidValue_1.VoidValue {
|
|
8
|
+
constructor(scope, data = {}) {
|
|
9
|
+
super(scope);
|
|
10
|
+
this.constant = true;
|
|
11
|
+
this.macro = true;
|
|
12
|
+
this.data = data;
|
|
13
|
+
}
|
|
14
|
+
typeof(scope) {
|
|
15
|
+
return [new LiteralValue_1.LiteralValue(scope, "object"), []];
|
|
16
|
+
}
|
|
17
|
+
get(scope, key) {
|
|
18
|
+
const member = this.data[key.data];
|
|
19
|
+
if (member)
|
|
20
|
+
return [member, []];
|
|
21
|
+
const { $get } = this.data;
|
|
22
|
+
if (!$get)
|
|
23
|
+
throw new Error("Cannot get undefined member.");
|
|
24
|
+
return $get.call(scope, [key]);
|
|
25
|
+
}
|
|
26
|
+
eval(scope) {
|
|
27
|
+
const { $eval } = this.data;
|
|
28
|
+
if (!$eval)
|
|
29
|
+
return [this, []];
|
|
30
|
+
return $eval.call(scope, []);
|
|
31
|
+
}
|
|
32
|
+
call(scope, args) {
|
|
33
|
+
const { $call } = this.data;
|
|
34
|
+
if (!$call)
|
|
35
|
+
return super.call(scope, args);
|
|
36
|
+
return $call.call(scope, args);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ObjectValue = ObjectValue;
|
|
40
|
+
for (const op of operators_1.operators) {
|
|
41
|
+
ObjectValue.prototype[op] = function (...args) {
|
|
42
|
+
const $ = this.data["$" + op];
|
|
43
|
+
if (!$)
|
|
44
|
+
return VoidValue_1.VoidValue.prototype[op].apply(this, args);
|
|
45
|
+
let [scope, ...fnArgs] = args;
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
return $.call(scope, fnArgs);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
50
|
//# sourceMappingURL=ObjectValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectValue.js","sourceRoot":"","sources":["../../src/values/ObjectValue.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAEzC,iDAA8C;AAC9C,2CAAwC;AAExC,MAAa,WAAY,SAAQ,qBAAS;
|
|
1
|
+
{"version":3,"file":"ObjectValue.js","sourceRoot":"","sources":["../../src/values/ObjectValue.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAEzC,iDAA8C;AAC9C,2CAAwC;AAExC,MAAa,WAAY,SAAQ,qBAAS;IAKxC,YAAY,KAAa,EAAE,OAAgC,EAAE;QAC3D,KAAK,CAAC,KAAK,CAAC,CAAC;QALf,aAAQ,GAAG,IAAI,CAAC;QAChB,UAAK,GAAG,IAAI,CAAC;QAKX,IAAI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AAI,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,CAAC;YAAE,OAAO,qBAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACzD,IAAI,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;QAC9B,aAAa;QACb,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC,CAAC;CACH"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { BaseValue } from ".";
|
|
2
|
-
import { IScope, IValue, TValueInstructions } from "../types";
|
|
3
|
-
export declare class StoreValue extends BaseValue implements IValue {
|
|
4
|
-
name: string;
|
|
5
|
-
constant: boolean;
|
|
6
|
-
constructor(scope: IScope, name: string);
|
|
7
|
-
typeof(scope: IScope): TValueInstructions;
|
|
8
|
-
"="(scope: IScope, value: IValue): TValueInstructions;
|
|
9
|
-
eval(scope: IScope): TValueInstructions;
|
|
10
|
-
toString(): string;
|
|
11
|
-
}
|
|
1
|
+
import { BaseValue } from ".";
|
|
2
|
+
import { IScope, IValue, TValueInstructions } from "../types";
|
|
3
|
+
export declare class StoreValue extends BaseValue implements IValue {
|
|
4
|
+
name: string;
|
|
5
|
+
constant: boolean;
|
|
6
|
+
constructor(scope: IScope, name: string);
|
|
7
|
+
typeof(scope: IScope): TValueInstructions;
|
|
8
|
+
"="(scope: IScope, value: IValue): TValueInstructions;
|
|
9
|
+
eval(scope: IScope): TValueInstructions;
|
|
10
|
+
toString(): string;
|
|
11
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StoreValue = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
const instructions_1 = require("../instructions");
|
|
6
|
-
class StoreValue extends _1.BaseValue {
|
|
7
|
-
constructor(scope, name) {
|
|
8
|
-
super(scope);
|
|
9
|
-
this.constant = false;
|
|
10
|
-
this.name = name;
|
|
11
|
-
}
|
|
12
|
-
typeof(scope) {
|
|
13
|
-
return [new _1.LiteralValue(scope, "store"), []];
|
|
14
|
-
}
|
|
15
|
-
"="(scope, value) {
|
|
16
|
-
if (this.constant)
|
|
17
|
-
throw new Error(`Cannot assign to unmutable store '${this.name}'.`);
|
|
18
|
-
if (value instanceof _1.TempValue && value.canProxy)
|
|
19
|
-
return value.proxy(this);
|
|
20
|
-
const [evalValue, evalInst] = value.eval(scope);
|
|
21
|
-
return [this, [...evalInst, new instructions_1.SetInstruction(this, evalValue)]];
|
|
22
|
-
}
|
|
23
|
-
eval(scope) {
|
|
24
|
-
return [this, []];
|
|
25
|
-
}
|
|
26
|
-
toString() {
|
|
27
|
-
return this.name;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.StoreValue = StoreValue;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StoreValue = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const instructions_1 = require("../instructions");
|
|
6
|
+
class StoreValue extends _1.BaseValue {
|
|
7
|
+
constructor(scope, name) {
|
|
8
|
+
super(scope);
|
|
9
|
+
this.constant = false;
|
|
10
|
+
this.name = name;
|
|
11
|
+
}
|
|
12
|
+
typeof(scope) {
|
|
13
|
+
return [new _1.LiteralValue(scope, "store"), []];
|
|
14
|
+
}
|
|
15
|
+
"="(scope, value) {
|
|
16
|
+
if (this.constant)
|
|
17
|
+
throw new Error(`Cannot assign to unmutable store '${this.name}'.`);
|
|
18
|
+
if (value instanceof _1.TempValue && value.canProxy)
|
|
19
|
+
return value.proxy(this);
|
|
20
|
+
const [evalValue, evalInst] = value.eval(scope);
|
|
21
|
+
return [this, [...evalInst, new instructions_1.SetInstruction(this, evalValue)]];
|
|
22
|
+
}
|
|
23
|
+
eval(scope) {
|
|
24
|
+
return [this, []];
|
|
25
|
+
}
|
|
26
|
+
toString() {
|
|
27
|
+
return this.name;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.StoreValue = StoreValue;
|
|
31
31
|
//# sourceMappingURL=StoreValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreValue.js","sourceRoot":"","sources":["../../src/values/StoreValue.ts"],"names":[],"mappings":";;;AAAA,wBAAuD;AACvD,kDAAiD;AAIjD,MAAa,UAAW,SAAQ,YAAS;
|
|
1
|
+
{"version":3,"file":"StoreValue.js","sourceRoot":"","sources":["../../src/values/StoreValue.ts"],"names":[],"mappings":";;;AAAA,wBAAuD;AACvD,kDAAiD;AAIjD,MAAa,UAAW,SAAQ,YAAS;IAGvC,YAAY,KAAa,EAAE,IAAY;QACrC,KAAK,CAAC,KAAK,CAAC,CAAC;QAFf,aAAQ,GAAG,KAAK,CAAC;QAGf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,CAAC,IAAI,eAAY,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,IAAI,IAAI,CAAC,QAAQ;YACf,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QACtE,IAAI,KAAK,YAAY,YAAS,IAAI,KAAK,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3E,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,EAAE,IAAI,6BAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,CAAC,KAAa;QAChB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpB,CAAC;IACD,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAzBD,gCAyBC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IInstruction, IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
-
import { StoreValue } from "./";
|
|
3
|
-
export declare class TempValue extends StoreValue {
|
|
4
|
-
proxied: IValue;
|
|
5
|
-
canProxy: boolean;
|
|
6
|
-
setInst: IInstruction;
|
|
7
|
-
constructor(scope: IScope, name?: string);
|
|
8
|
-
eval(scope: IScope): TValueInstructions;
|
|
9
|
-
"="(scope: IScope, value: IValue): TValueInstructions;
|
|
10
|
-
proxy(value: IValue): TValueInstructions;
|
|
11
|
-
noProxy(): void;
|
|
12
|
-
}
|
|
1
|
+
import { IInstruction, IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
+
import { StoreValue } from "./";
|
|
3
|
+
export declare class TempValue extends StoreValue {
|
|
4
|
+
proxied: IValue;
|
|
5
|
+
canProxy: boolean;
|
|
6
|
+
setInst: IInstruction;
|
|
7
|
+
constructor(scope: IScope, name?: string);
|
|
8
|
+
eval(scope: IScope): TValueInstructions;
|
|
9
|
+
"="(scope: IScope, value: IValue): TValueInstructions;
|
|
10
|
+
proxy(value: IValue): TValueInstructions;
|
|
11
|
+
noProxy(): void;
|
|
12
|
+
}
|
|
@@ -1,53 +1,67 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TempValue = void 0;
|
|
4
|
-
const instructions_1 = require("../instructions");
|
|
5
|
-
const operators_1 = require("../operators");
|
|
6
|
-
const _1 = require("./");
|
|
7
|
-
const LiteralValue_1 = require("./LiteralValue");
|
|
8
|
-
class TempValue extends _1.StoreValue {
|
|
9
|
-
constructor(scope, name) {
|
|
10
|
-
super(scope, name
|
|
11
|
-
this.canProxy = true;
|
|
12
|
-
if (!name)
|
|
13
|
-
scope.ntemp++;
|
|
14
|
-
}
|
|
15
|
-
eval(scope) {
|
|
16
|
-
return super.eval(scope);
|
|
17
|
-
}
|
|
18
|
-
"="(scope, value) {
|
|
19
|
-
if (this.proxied) {
|
|
20
|
-
this.noProxy();
|
|
21
|
-
return [this, [new instructions_1.SetInstruction(this, value)]];
|
|
22
|
-
}
|
|
23
|
-
if (value instanceof LiteralValue_1.LiteralValue && this.canProxy) {
|
|
24
|
-
return this.proxy(value);
|
|
25
|
-
}
|
|
26
|
-
return super["="](scope, value);
|
|
27
|
-
}
|
|
28
|
-
proxy(value) {
|
|
29
|
-
if (!this.canProxy) {
|
|
30
|
-
console.log(this.proxied);
|
|
31
|
-
throw new Error("Cannot proxy (canProxy = false).");
|
|
32
|
-
}
|
|
33
|
-
if (this.proxied)
|
|
34
|
-
throw new Error("Cannot proxy multiple times.");
|
|
35
|
-
this.proxied = value;
|
|
36
|
-
this.canProxy = false;
|
|
37
|
-
for (const key of [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TempValue = void 0;
|
|
4
|
+
const instructions_1 = require("../instructions");
|
|
5
|
+
const operators_1 = require("../operators");
|
|
6
|
+
const _1 = require("./");
|
|
7
|
+
const LiteralValue_1 = require("./LiteralValue");
|
|
8
|
+
class TempValue extends _1.StoreValue {
|
|
9
|
+
constructor(scope, name) {
|
|
10
|
+
super(scope, name ?? "t" + scope.ntemp + (scope.name ? ":" + scope.name : ""));
|
|
11
|
+
this.canProxy = true;
|
|
12
|
+
if (!name)
|
|
13
|
+
scope.ntemp++;
|
|
14
|
+
}
|
|
15
|
+
eval(scope) {
|
|
16
|
+
return super.eval(scope);
|
|
17
|
+
}
|
|
18
|
+
"="(scope, value) {
|
|
19
|
+
if (this.proxied) {
|
|
20
|
+
this.noProxy();
|
|
21
|
+
return [this, [new instructions_1.SetInstruction(this, value)]];
|
|
22
|
+
}
|
|
23
|
+
if (value instanceof LiteralValue_1.LiteralValue && this.canProxy) {
|
|
24
|
+
return this.proxy(value);
|
|
25
|
+
}
|
|
26
|
+
return super["="](scope, value);
|
|
27
|
+
}
|
|
28
|
+
proxy(value) {
|
|
29
|
+
if (!this.canProxy) {
|
|
30
|
+
console.log(this.proxied);
|
|
31
|
+
throw new Error("Cannot proxy (canProxy = false).");
|
|
32
|
+
}
|
|
33
|
+
if (this.proxied)
|
|
34
|
+
throw new Error("Cannot proxy multiple times.");
|
|
35
|
+
this.proxied = value;
|
|
36
|
+
this.canProxy = false;
|
|
37
|
+
for (const key of [
|
|
38
|
+
...operators_1.operators,
|
|
39
|
+
"eval",
|
|
40
|
+
"get",
|
|
41
|
+
"call",
|
|
42
|
+
"toString",
|
|
43
|
+
"proxy",
|
|
44
|
+
]) {
|
|
45
|
+
if (key !== "=" && key in value)
|
|
46
|
+
this[key] = (...args) => value[key].apply(value, args);
|
|
47
|
+
}
|
|
48
|
+
this.setInst = new instructions_1.SetInstruction(this, value);
|
|
49
|
+
this.setInst.hidden = true;
|
|
50
|
+
return [this, [this.setInst]];
|
|
51
|
+
}
|
|
52
|
+
noProxy() {
|
|
53
|
+
this.setInst.hidden = false;
|
|
54
|
+
for (const key of [
|
|
55
|
+
...operators_1.operators,
|
|
56
|
+
"eval",
|
|
57
|
+
"get",
|
|
58
|
+
"call",
|
|
59
|
+
"toString",
|
|
60
|
+
"proxy",
|
|
61
|
+
]) {
|
|
62
|
+
this[key] = TempValue.prototype[key];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.TempValue = TempValue;
|
|
53
67
|
//# sourceMappingURL=TempValue.js.map
|