mlogjs 0.2.0 → 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 -119
- 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 +60 -41
- 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/CallExpression.d.ts +3 -3
- package/build/handlers/CallExpression.js +19 -19
- package/build/handlers/ForStatement.d.ts +2 -2
- package/build/handlers/ForStatement.js +31 -31
- package/build/handlers/Function.d.ts +4 -4
- package/build/handlers/Function.js +35 -35
- package/build/handlers/Identifier.d.ts +2 -2
- package/build/handlers/Identifier.js +7 -7
- package/build/handlers/IfStatement.d.ts +2 -2
- package/build/handlers/IfStatement.js +24 -24
- package/build/handlers/Literal.d.ts +2 -2
- package/build/handlers/Literal.js +17 -17
- package/build/handlers/Object.d.ts +4 -4
- package/build/handlers/Object.js +43 -43
- package/build/handlers/OperationExpressions.d.ts +7 -7
- package/build/handlers/OperationExpressions.js +32 -32
- 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 -29
- package/build/handlers/TemplateExpression.d.ts +2 -2
- package/build/handlers/TemplateExpression.js +17 -17
- package/build/handlers/VariableDeclaration.d.ts +3 -3
- package/build/handlers/VariableDeclaration.js +55 -55
- package/build/handlers/WhileStatement.d.ts +2 -2
- package/build/handlers/WhileStatement.js +22 -22
- package/build/handlers/index.d.ts +14 -14
- package/build/handlers/index.js +30 -30
- package/build/index.d.ts +1 -1
- package/build/index.js +7 -7
- 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 -30
- package/build/instructions/ControlInstructions.d.ts +11 -11
- package/build/instructions/ControlInstructions.js +22 -22
- package/build/instructions/EndInstruction.d.ts +4 -4
- package/build/instructions/EndInstruction.js +10 -10
- package/build/instructions/InstructionBase.d.ts +10 -10
- package/build/instructions/InstructionBase.js +20 -20
- package/build/instructions/JumpInstruction.d.ts +15 -15
- package/build/instructions/JumpInstruction.js +21 -21
- package/build/instructions/OperationInstruction.d.ts +5 -5
- package/build/instructions/OperationInstruction.js +10 -10
- package/build/instructions/SetCounterInstruction.d.ts +5 -5
- package/build/instructions/SetCounterInstruction.js +10 -10
- package/build/instructions/SetInstruction.d.ts +5 -5
- package/build/instructions/SetInstruction.js +10 -10
- package/build/instructions/ZeroSpaceInstruction.d.ts +4 -4
- package/build/instructions/ZeroSpaceInstruction.js +10 -10
- package/build/instructions/index.d.ts +9 -9
- package/build/instructions/index.js +25 -25
- package/build/macros/Building.d.ts +11 -11
- package/build/macros/Building.js +80 -80
- package/build/macros/Function.d.ts +12 -12
- package/build/macros/Function.js +19 -19
- 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/Memory.d.ts +5 -5
- package/build/macros/Memory.js +60 -60
- package/build/macros/Namespace.d.ts +21 -21
- package/build/macros/Namespace.js +97 -97
- package/build/macros/Other.d.ts +5 -5
- package/build/macros/Other.js +19 -19
- package/build/macros/RawValue.d.ts +5 -5
- package/build/macros/RawValue.js +15 -15
- package/build/macros/commands/{control.d.ts → Control.d.ts} +5 -5
- package/build/macros/commands/{control.js → Control.js} +24 -24
- package/build/macros/commands/{control.js.map → Control.js.map} +0 -0
- package/build/macros/commands/Draw.d.ts +5 -5
- package/build/macros/commands/Draw.js +38 -38
- package/build/macros/commands/DrawFlush.d.ts +5 -5
- package/build/macros/commands/DrawFlush.js +16 -16
- package/build/macros/commands/GetLink.d.ts +5 -5
- package/build/macros/commands/GetLink.js +20 -20
- package/build/macros/commands/Lookup.d.ts +5 -5
- package/build/macros/commands/Lookup.js +23 -23
- package/build/macros/commands/Print.d.ts +5 -5
- package/build/macros/commands/Print.js +13 -13
- package/build/macros/commands/PrintFlush.d.ts +5 -5
- package/build/macros/commands/PrintFlush.js +16 -16
- package/build/macros/commands/Radar.d.ts +7 -7
- package/build/macros/commands/Radar.js +60 -60
- package/build/macros/commands/Sensor.d.ts +5 -5
- package/build/macros/commands/Sensor.js +19 -19
- package/build/macros/commands/UnitBind.d.ts +5 -5
- package/build/macros/commands/UnitBind.js +16 -16
- package/build/macros/commands/UnitControl.d.ts +5 -5
- package/build/macros/commands/UnitControl.js +67 -67
- package/build/macros/commands/UnitLocate.d.ts +5 -5
- package/build/macros/commands/UnitLocate.js +54 -54
- package/build/macros/commands/UnitRadar.d.ts +5 -5
- package/build/macros/commands/UnitRadar.js +40 -40
- package/build/macros/commands/Wait.d.ts +5 -5
- package/build/macros/commands/Wait.js +17 -17
- package/build/macros/commands/index.d.ts +14 -14
- package/build/macros/commands/index.js +32 -32
- package/build/macros/index.d.ts +7 -7
- package/build/macros/index.js +39 -39
- package/build/operators.d.ts +25 -25
- package/build/operators.js +101 -101
- package/build/types.d.ts +49 -49
- package/build/types.js +27 -27
- package/build/utils.d.ts +3 -3
- package/build/utils.js +12 -12
- package/build/values/BaseValue.d.ts +5 -5
- package/build/values/BaseValue.js +111 -111
- package/build/values/FunctionValue.d.ts +34 -34
- package/build/values/FunctionValue.js +103 -103
- package/build/values/LiteralValue.d.ts +12 -12
- package/build/values/LiteralValue.js +87 -87
- 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/StoreValue.d.ts +11 -11
- package/build/values/StoreValue.js +30 -30
- package/build/values/TempValue.d.ts +12 -12
- package/build/values/TempValue.js +66 -66
- 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/index.d.ts +6 -6
- package/build/values/index.js +22 -22
- package/dist/mlogjs.es.js +6366 -0
- package/dist/mlogjs.umd.js +8 -0
- package/lib/commands.d.ts +326 -326
- package/lib/eslib/index.d.ts +3 -3
- package/lib/eslib/lib.d.ts +9 -9
- package/lib/eslib/lib.es2015.collection.d.ts +89 -89
- package/lib/eslib/lib.es2015.core.d.ts +16 -16
- package/lib/eslib/lib.es2015.d.ts +30 -30
- package/lib/eslib/lib.es2015.generator.d.ts +79 -79
- package/lib/eslib/lib.es2015.iterable.d.ts +70 -70
- package/lib/eslib/lib.es5.d.ts +295 -295
- package/lib/eslib/lib.es6.d.ts +18 -18
- package/lib/globals.d.ts +328 -328
- package/lib/helpers.d.ts +23 -23
- package/lib/index.d.ts +7 -7
- package/lib/kinds.d.ts +36 -36
- package/lib/memory.d.ts +17 -17
- package/lib/traits.d.ts +121 -121
- package/lib/util.d.ts +32 -32
- package/package.json +73 -48
- package/build/macros/Blocks.d.ts +0 -5
- package/build/macros/Blocks.js +0 -143
- package/build/macros/Blocks.js.map +0 -1
- package/build/macros/Draw.d.ts +0 -5
- package/build/macros/Draw.js +0 -39
- package/build/macros/Draw.js.map +0 -1
- package/build/macros/Items.d.ts +0 -5
- package/build/macros/Items.js +0 -20
- package/build/macros/Items.js.map +0 -1
- package/build/macros/Liquids.d.ts +0 -5
- package/build/macros/Liquids.js +0 -18
- package/build/macros/Liquids.js.map +0 -1
- package/build/macros/Symbol.d.ts +0 -0
- package/build/macros/Symbol.js +0 -1
- package/build/macros/Symbol.js.map +0 -1
- package/build/macros/SymbolNamespace.d.ts +0 -0
- package/build/macros/SymbolNamespace.js +0 -1
- package/build/macros/SymbolNamespace.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/macros/Units.d.ts +0 -5
- package/build/macros/Units.js +0 -18
- package/build/macros/Units.js.map +0 -1
- package/build/macros/Vars.d.ts +0 -5
- package/build/macros/Vars.js +0 -18
- package/build/macros/Vars.js.map +0 -1
- package/build/macros/commands/Asm.d.ts +0 -5
- package/build/macros/commands/Asm.js +0 -21
- package/build/macros/commands/Asm.js.map +0 -1
- package/build/macros/commands/io.d.ts +0 -8
- package/build/macros/commands/io.js +0 -47
- package/build/macros/commands/io.js.map +0 -1
- package/build/macros/helpers/GetBuilding.d.ts +0 -5
- package/build/macros/helpers/GetBuilding.js +0 -16
- package/build/macros/helpers/GetBuilding.js.map +0 -1
- package/build/macros/helpers/GetVar.d.ts +0 -5
- package/build/macros/helpers/GetVar.js +0 -16
- package/build/macros/helpers/GetVar.js.map +0 -1
- package/build/macros/helpers/index.d.ts +0 -2
- package/build/macros/helpers/index.js +0 -15
- package/build/macros/helpers/index.js.map +0 -1
- package/dist/bundle.js +0 -1
|
@@ -1,88 +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
|
-
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
|
-
}
|
|
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
|
+
}
|
|
88
88
|
//# sourceMappingURL=LiteralValue.js.map
|
|
@@ -1 +1 @@
|
|
|
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,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AAS,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,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,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,67 +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
|
-
...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;
|
|
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;
|
|
67
67
|
//# sourceMappingURL=TempValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TempValue.js","sourceRoot":"","sources":["../../src/values/TempValue.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,4CAAyC;AAEzC,yBAAgC;AAChC,iDAA8C;AAE9C,MAAa,SAAU,SAAQ,aAAU;IAKvC,YAAY,KAAa,EAAE,IAAa;QACtC,KAAK,CACH,KAAK,EACL,IAAI,
|
|
1
|
+
{"version":3,"file":"TempValue.js","sourceRoot":"","sources":["../../src/values/TempValue.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,4CAAyC;AAEzC,yBAAgC;AAChC,iDAA8C;AAE9C,MAAa,SAAU,SAAQ,aAAU;IAKvC,YAAY,KAAa,EAAE,IAAa;QACtC,KAAK,CACH,KAAK,EACL,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CACjE,CAAC;QAPJ,aAAQ,GAAG,IAAI,CAAC;QAQd,IAAI,CAAC,IAAI;YAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,EAAE,CAAC,IAA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AAK,MAAM,GAAG,IAAI;YAChB,GAAG,qBAAS;YACZ,MAAM;YACN,KAAK;YACL,MAAM;YACN,UAAU;YACV,OAAO;SACC,EAAE;YACV,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;SACtC;IACH,CAAC;CACF;AAjED,8BAiEC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
-
export declare class VoidValue implements IValue {
|
|
3
|
-
scope: IScope;
|
|
4
|
-
constant: boolean;
|
|
5
|
-
macro: boolean;
|
|
6
|
-
constructor(scope: IScope);
|
|
7
|
-
eval(scope: IScope): TValueInstructions;
|
|
8
|
-
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
9
|
-
get(scope: IScope, name: IValue): TValueInstructions;
|
|
10
|
-
toString(): string;
|
|
11
|
-
}
|
|
1
|
+
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
+
export declare class VoidValue implements IValue {
|
|
3
|
+
scope: IScope;
|
|
4
|
+
constant: boolean;
|
|
5
|
+
macro: boolean;
|
|
6
|
+
constructor(scope: IScope);
|
|
7
|
+
eval(scope: IScope): TValueInstructions;
|
|
8
|
+
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
9
|
+
get(scope: IScope, name: IValue): TValueInstructions;
|
|
10
|
+
toString(): string;
|
|
11
|
+
}
|