mlogjs 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/build/Compiler.js +104 -99
- package/build/Compiler.js.map +1 -1
- package/build/CompilerError.js +11 -0
- package/build/CompilerError.js.map +1 -0
- package/build/Scope.js +70 -60
- package/build/Scope.js.map +1 -1
- package/build/bin.js +74 -60
- package/build/bin.js.map +1 -1
- package/build/handlers/BlockStatement.js +13 -13
- package/build/handlers/BlockStatement.js.map +1 -1
- package/build/handlers/CallExpression.js +19 -19
- package/build/handlers/CallExpression.js.map +1 -1
- package/build/handlers/File.js +9 -0
- package/build/handlers/File.js.map +1 -0
- package/build/handlers/ForStatement.js +31 -31
- package/build/handlers/ForStatement.js.map +1 -1
- package/build/handlers/Function.js +46 -35
- package/build/handlers/Function.js.map +1 -1
- package/build/handlers/Identifier.js +7 -7
- package/build/handlers/IfStatement.js +24 -24
- package/build/handlers/IfStatement.js.map +1 -1
- package/build/handlers/Literal.js +14 -17
- package/build/handlers/Literal.js.map +1 -1
- package/build/handlers/Object.js +54 -43
- package/build/handlers/Object.js.map +1 -1
- package/build/handlers/OperationExpressions.js +37 -32
- package/build/handlers/OperationExpressions.js.map +1 -1
- package/build/handlers/Program.js +8 -8
- package/build/handlers/Program.js.map +1 -1
- package/build/handlers/Statements.js +29 -29
- package/build/handlers/Statements.js.map +1 -1
- package/build/handlers/TemplateExpression.js +17 -17
- package/build/handlers/TemplateExpression.js.map +1 -1
- package/build/handlers/VariableDeclaration.js +71 -55
- package/build/handlers/VariableDeclaration.js.map +1 -1
- package/build/handlers/WhileStatement.js +22 -22
- package/build/handlers/WhileStatement.js.map +1 -1
- package/build/handlers/index.js +31 -30
- package/build/handlers/index.js.map +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/initScope.js +39 -39
- package/build/instructions/AddressResolver.js +30 -30
- package/build/instructions/ControlInstructions.js +22 -22
- package/build/instructions/EndInstruction.js +10 -10
- package/build/instructions/InstructionBase.js +20 -20
- package/build/instructions/InstructionBase.js.map +1 -1
- package/build/instructions/JumpInstruction.js +21 -21
- package/build/instructions/JumpInstruction.js.map +1 -1
- package/build/instructions/OperationInstruction.js +10 -10
- package/build/instructions/OperationInstruction.js.map +1 -1
- package/build/instructions/SetCounterInstruction.js +10 -10
- package/build/instructions/SetInstruction.js +10 -10
- package/build/instructions/ZeroSpaceInstruction.js +10 -10
- package/build/instructions/index.js +25 -25
- package/build/macros/Building.js +88 -80
- package/build/macros/Building.js.map +1 -1
- package/build/macros/Function.js +19 -19
- package/build/macros/Function.js.map +1 -1
- package/build/macros/Math.js +61 -56
- package/build/macros/Math.js.map +1 -1
- package/build/macros/Memory.js +62 -60
- package/build/macros/Memory.js.map +1 -1
- package/build/macros/Namespace.js +110 -97
- package/build/macros/Namespace.js.map +1 -1
- package/build/macros/Other.js +20 -19
- package/build/macros/Other.js.map +1 -1
- package/build/macros/RawValue.js +16 -15
- package/build/macros/RawValue.js.map +1 -1
- package/build/macros/commands/Control.js +25 -24
- package/build/macros/commands/Control.js.map +1 -1
- package/build/macros/commands/Draw.js +39 -38
- package/build/macros/commands/Draw.js.map +1 -1
- package/build/macros/commands/DrawFlush.js +17 -16
- package/build/macros/commands/DrawFlush.js.map +1 -1
- package/build/macros/commands/GetLink.js +24 -20
- package/build/macros/commands/GetLink.js.map +1 -1
- package/build/macros/commands/Lookup.js +24 -23
- package/build/macros/commands/Lookup.js.map +1 -1
- package/build/macros/commands/Print.js +17 -13
- package/build/macros/commands/Print.js.map +1 -1
- package/build/macros/commands/PrintFlush.js +17 -16
- package/build/macros/commands/PrintFlush.js.map +1 -1
- package/build/macros/commands/Radar.js +64 -60
- package/build/macros/commands/Radar.js.map +1 -1
- package/build/macros/commands/Sensor.js +20 -19
- package/build/macros/commands/Sensor.js.map +1 -1
- package/build/macros/commands/UnitBind.js +17 -16
- package/build/macros/commands/UnitBind.js.map +1 -1
- package/build/macros/commands/UnitControl.js +72 -67
- package/build/macros/commands/UnitControl.js.map +1 -1
- package/build/macros/commands/UnitLocate.js +75 -54
- package/build/macros/commands/UnitLocate.js.map +1 -1
- package/build/macros/commands/UnitRadar.js +47 -40
- package/build/macros/commands/UnitRadar.js.map +1 -1
- package/build/macros/commands/Wait.js +18 -17
- package/build/macros/commands/Wait.js.map +1 -1
- package/build/macros/commands/index.js +32 -32
- package/build/macros/index.js +39 -39
- package/build/operators.js +101 -101
- package/build/operators.js.map +1 -1
- package/build/types.js +27 -27
- package/build/types.js.map +1 -1
- package/build/utils.js +17 -12
- package/build/utils.js.map +1 -1
- package/build/values/BaseValue.js +111 -111
- package/build/values/BaseValue.js.map +1 -1
- package/build/values/FunctionValue.js +115 -103
- package/build/values/FunctionValue.js.map +1 -1
- package/build/values/LiteralValue.js +88 -87
- package/build/values/LiteralValue.js.map +1 -1
- package/build/values/ObjectValue.js +54 -49
- package/build/values/ObjectValue.js.map +1 -1
- package/build/values/StoreValue.js +31 -30
- package/build/values/StoreValue.js.map +1 -1
- package/build/values/TempValue.js +77 -66
- package/build/values/TempValue.js.map +1 -1
- package/build/values/VoidValue.js +31 -30
- package/build/values/VoidValue.js.map +1 -1
- package/build/values/index.js +22 -22
- package/dist/bin.cjs +82 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/index.cjs +2220 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +2195 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/Compiler.d.ts +26 -0
- package/dist/types/CompilerError.d.ts +9 -0
- package/dist/types/Scope.d.ts +24 -0
- package/dist/types/bin.d.ts +1 -0
- package/dist/types/handlers/BlockStatement.d.ts +2 -0
- package/dist/types/handlers/CallExpression.d.ts +3 -0
- package/dist/types/handlers/File.d.ts +2 -0
- package/dist/types/handlers/ForStatement.d.ts +2 -0
- package/{build → dist/types}/handlers/Function.d.ts +5 -4
- package/{build → dist/types}/handlers/Identifier.d.ts +2 -2
- package/dist/types/handlers/IfStatement.d.ts +2 -0
- package/dist/types/handlers/Literal.d.ts +5 -0
- package/{build → dist/types}/handlers/Object.d.ts +6 -4
- package/{build → dist/types}/handlers/OperationExpressions.d.ts +8 -7
- package/dist/types/handlers/Program.d.ts +2 -0
- package/dist/types/handlers/Statements.d.ts +5 -0
- package/dist/types/handlers/TemplateExpression.d.ts +2 -0
- package/dist/types/handlers/Typescript.d.ts +7 -0
- package/dist/types/handlers/VariableDeclaration.d.ts +3 -0
- package/dist/types/handlers/WhileStatement.d.ts +3 -0
- package/{build → dist/types}/handlers/index.d.ts +16 -14
- package/dist/types/index.d.ts +2 -0
- package/{build → dist/types}/initScope.d.ts +5 -2
- package/{build → dist/types}/instructions/AddressResolver.d.ts +12 -12
- package/{build → dist/types}/instructions/ControlInstructions.d.ts +8 -11
- package/{build → dist/types}/instructions/EndInstruction.d.ts +4 -4
- package/{build → dist/types}/instructions/InstructionBase.d.ts +10 -10
- package/{build → dist/types}/instructions/JumpInstruction.d.ts +15 -15
- package/{build → dist/types}/instructions/OperationInstruction.d.ts +5 -5
- package/{build → dist/types}/instructions/SetCounterInstruction.d.ts +5 -5
- package/{build → dist/types}/instructions/SetInstruction.d.ts +6 -5
- package/{build → dist/types}/instructions/ZeroSpaceInstruction.d.ts +4 -4
- package/{build → dist/types}/instructions/index.d.ts +9 -9
- package/{build → dist/types}/macros/Building.d.ts +10 -11
- package/dist/types/macros/Entities.d.ts +11 -0
- package/dist/types/macros/Function.d.ts +13 -0
- package/dist/types/macros/GetGlobal.d.ts +5 -0
- package/{build → dist/types}/macros/Math.d.ts +5 -5
- package/{build → dist/types}/macros/Memory.d.ts +5 -5
- package/{build → dist/types}/macros/Namespace.d.ts +16 -21
- package/{build → dist/types}/macros/Other.d.ts +5 -5
- package/{build → dist/types}/macros/RawValue.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Control.d.ts +5 -5
- package/dist/types/macros/commands/Draw.d.ts +5 -0
- package/{build → dist/types}/macros/commands/DrawFlush.d.ts +5 -5
- package/{build/macros/commands/Draw.d.ts → dist/types/macros/commands/End.d.ts} +5 -5
- package/{build → dist/types}/macros/commands/GetLink.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Lookup.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Print.d.ts +5 -5
- package/{build → dist/types}/macros/commands/PrintFlush.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Radar.d.ts +7 -7
- package/{build → dist/types}/macros/commands/Sensor.d.ts +5 -5
- package/{build → dist/types}/macros/commands/UnitBind.d.ts +5 -5
- package/dist/types/macros/commands/UnitControl.d.ts +5 -0
- package/{build → dist/types}/macros/commands/UnitLocate.d.ts +5 -5
- package/{build → dist/types}/macros/commands/UnitRadar.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Wait.d.ts +5 -5
- package/{build → dist/types}/macros/commands/index.d.ts +15 -14
- package/{build → dist/types}/macros/index.d.ts +6 -7
- package/{build → dist/types}/operators.d.ts +25 -25
- package/dist/types/types.d.ts +224 -0
- package/dist/types/utils.d.ts +30 -0
- package/dist/types/values/BaseValue.d.ts +7 -0
- package/dist/types/values/DestructuringValue.d.ts +17 -0
- package/dist/types/values/FunctionValue.d.ts +47 -0
- package/{build → dist/types}/values/LiteralValue.d.ts +13 -12
- package/dist/types/values/ObjectValue.d.ts +23 -0
- package/dist/types/values/SenseableValue.d.ts +23 -0
- package/dist/types/values/StackValue.d.ts +16 -0
- package/dist/types/values/StoreValue.d.ts +15 -0
- package/{build → dist/types}/values/TempValue.d.ts +19 -12
- package/dist/types/values/ValueOwner.d.ts +27 -0
- package/dist/types/values/VoidValue.d.ts +16 -0
- package/{build → dist/types}/values/index.d.ts +7 -6
- package/lib/commands.d.ts +242 -36
- package/lib/eslib/lib.es5.d.ts +1 -1
- package/lib/globals.d.ts +172 -159
- package/lib/helpers.d.ts +2 -2
- package/lib/memory.d.ts +1 -1
- package/lib/traits.d.ts +130 -110
- package/package.json +33 -38
- package/build/Compiler.d.ts +0 -18
- package/build/Scope.d.ts +0 -26
- package/build/bin.d.ts +0 -2
- package/build/handlers/BlockStatement.d.ts +0 -2
- package/build/handlers/CallExpression.d.ts +0 -3
- package/build/handlers/ForStatement.d.ts +0 -2
- package/build/handlers/IfStatement.d.ts +0 -2
- package/build/handlers/Literal.d.ts +0 -2
- package/build/handlers/Program.d.ts +0 -2
- package/build/handlers/Statements.d.ts +0 -5
- package/build/handlers/TemplateExpression.d.ts +0 -2
- package/build/handlers/VariableDeclaration.d.ts +0 -3
- package/build/handlers/WhileStatement.d.ts +0 -2
- package/build/index.d.ts +0 -1
- package/build/macros/Function.d.ts +0 -12
- package/build/macros/commands/UnitControl.d.ts +0 -5
- package/build/types.d.ts +0 -49
- package/build/utils.d.ts +0 -3
- package/build/values/BaseValue.d.ts +0 -5
- package/build/values/FunctionValue.d.ts +0 -34
- package/build/values/ObjectValue.d.ts +0 -17
- package/build/values/StoreValue.d.ts +0 -11
- package/build/values/VoidValue.d.ts +0 -11
- package/dist/mlogjs.es.js +0 -6366
- package/dist/mlogjs.umd.js +0 -8
package/package.json
CHANGED
|
@@ -1,33 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mlogjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Compiler that compiles Javascript to Mindustry Logic Code.",
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"build": "tsc && vite build",
|
|
10
|
-
"build:editor": "cd editor && vite build",
|
|
11
|
-
"dev": "ts-node src/bin",
|
|
12
|
-
"dev:editor": "cd editor && vite",
|
|
13
|
-
"test": "jest",
|
|
14
|
-
"coverage": "jest --coverage",
|
|
15
|
-
"docs:doc": "mkdir -p docs && cp -r doc/. docs",
|
|
16
|
-
"docs:lib": "typedoc --out docs/lib lib/*",
|
|
17
|
-
"docs:src": "typedoc --out docs/src src/index.ts",
|
|
18
|
-
"docs": "run-p docs:lib docs:src docs:doc",
|
|
19
|
-
"start": "npm run build && npm i -g . && mlogjs",
|
|
20
|
-
"prepublishOnly": "npm run build"
|
|
21
|
-
},
|
|
22
|
-
"exports": {
|
|
23
|
-
"require": "./build/index.js",
|
|
24
|
-
"import": "./dist/index.js"
|
|
25
|
-
},
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"bin": "./dist/bin.cjs",
|
|
8
|
+
"types": "./dist/types",
|
|
26
9
|
"repository": {
|
|
27
10
|
"type": "git",
|
|
28
11
|
"url": "git+https://github.com/weisrc/mlogjs.git"
|
|
29
12
|
},
|
|
30
|
-
"packageManager": "yarn@3.2.0",
|
|
31
13
|
"keywords": [],
|
|
32
14
|
"author": "str1z",
|
|
33
15
|
"license": "MIT",
|
|
@@ -36,32 +18,31 @@
|
|
|
36
18
|
},
|
|
37
19
|
"homepage": "https://github.com/weisrc/mlogjs#readme",
|
|
38
20
|
"dependencies": {
|
|
39
|
-
"
|
|
21
|
+
"@babel/parser": "^7.17.7",
|
|
22
|
+
"chalk": "^4.1.2",
|
|
40
23
|
"cli-highlight": "^2.1.11",
|
|
41
24
|
"yargs": "^17.0.1"
|
|
42
25
|
},
|
|
43
26
|
"devDependencies": {
|
|
44
|
-
"@
|
|
27
|
+
"@babel/types": "^7.17.0",
|
|
28
|
+
"@rollup/plugin-alias": "^3.1.9",
|
|
29
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
30
|
+
"@rollup/plugin-typescript": "^8.3.1",
|
|
45
31
|
"@types/estree": "^0.0.51",
|
|
46
32
|
"@types/jest": "^27.4.1",
|
|
47
33
|
"@types/node": "^15.3.0",
|
|
48
|
-
"@types/react": "^17.0.39",
|
|
49
|
-
"@types/react-dom": "^17.0.13",
|
|
50
|
-
"@types/react-split-pane": "^0.1.67",
|
|
51
34
|
"@types/yargs": "^16.0.1",
|
|
52
|
-
"@
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
|
36
|
+
"@typescript-eslint/parser": "^5.15.0",
|
|
37
|
+
"eslint": "^8.11.0",
|
|
53
38
|
"jest": "^27.5.1",
|
|
54
|
-
"monaco-editor": "^0.32.1",
|
|
55
39
|
"npm-run-all": "^4.1.5",
|
|
56
|
-
"
|
|
57
|
-
"react": "^17.0.2",
|
|
58
|
-
"react-dom": "^17.0.2",
|
|
59
|
-
"react-split-pane": "^0.1.92",
|
|
40
|
+
"rollup": "^2.70.1",
|
|
60
41
|
"ts-jest": "^27.1.3",
|
|
61
42
|
"ts-node": "^10.6.0",
|
|
43
|
+
"tslib": "^2.3.1",
|
|
62
44
|
"typedoc": "^0.22.12",
|
|
63
|
-
"typescript": "
|
|
64
|
-
"vite": "^2.8.6"
|
|
45
|
+
"typescript": "*"
|
|
65
46
|
},
|
|
66
47
|
"files": [
|
|
67
48
|
"build",
|
|
@@ -69,5 +50,19 @@
|
|
|
69
50
|
"lib",
|
|
70
51
|
"LICENSE",
|
|
71
52
|
"README.md"
|
|
72
|
-
]
|
|
73
|
-
|
|
53
|
+
],
|
|
54
|
+
"scripts": {
|
|
55
|
+
"clean": "rm -rf ../docs dist build",
|
|
56
|
+
"build": "rollup -c",
|
|
57
|
+
"build:dev": "rollup -c --environment DEV",
|
|
58
|
+
"dev": "ts-node src/bin",
|
|
59
|
+
"test": "jest",
|
|
60
|
+
"lint": "eslint src/**/*.ts",
|
|
61
|
+
"coverage": "jest --coverage",
|
|
62
|
+
"docs:doc": "mkdir -p ../docs && cp -r doc/. ../docs",
|
|
63
|
+
"docs:lib": "typedoc --out ../docs/lib lib/*",
|
|
64
|
+
"docs:src": "typedoc --out ../docs/src src/index.ts",
|
|
65
|
+
"docs": "run-p docs:lib docs:src docs:doc",
|
|
66
|
+
"start": "npm run build && npm i -g . && mlogjs"
|
|
67
|
+
}
|
|
68
|
+
}
|
package/build/Compiler.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { es, IScope, THandler, TValueInstructions } from "./types";
|
|
2
|
-
declare type THandlerMap = {
|
|
3
|
-
[k in es.Node["type"]]?: THandler;
|
|
4
|
-
};
|
|
5
|
-
export declare class Compiler {
|
|
6
|
-
protected stackName?: string;
|
|
7
|
-
protected usingStack: boolean;
|
|
8
|
-
protected handlers: THandlerMap;
|
|
9
|
-
constructor(stackName?: string);
|
|
10
|
-
compile(script: string): [string, Error, es.Node[]];
|
|
11
|
-
protected resolve(valueInst: TValueInstructions): void;
|
|
12
|
-
protected serialize(resLines: TValueInstructions): string;
|
|
13
|
-
protected parse(script: string): es.Node;
|
|
14
|
-
handle(scope: IScope, node: es.Node): TValueInstructions;
|
|
15
|
-
handleEval(scope: IScope, node: es.Node): TValueInstructions;
|
|
16
|
-
handleMany(scope: IScope, nodes: es.Node[], handler?: typeof Compiler.prototype.handle): TValueInstructions;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
package/build/Scope.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AddressResolver } from "./instructions";
|
|
2
|
-
import { IFunctionValue, IInstruction, IScope, IValue } from "./types";
|
|
3
|
-
export declare class Scope implements IScope {
|
|
4
|
-
parent: IScope;
|
|
5
|
-
name: string;
|
|
6
|
-
data: {
|
|
7
|
-
[k: string]: IValue;
|
|
8
|
-
};
|
|
9
|
-
stacked: boolean;
|
|
10
|
-
ntemp: number;
|
|
11
|
-
inst: IInstruction[];
|
|
12
|
-
break: AddressResolver;
|
|
13
|
-
continue: AddressResolver;
|
|
14
|
-
function: IFunctionValue;
|
|
15
|
-
constructor(values: {
|
|
16
|
-
[k: string]: IValue;
|
|
17
|
-
}, parent?: IScope, stacked?: boolean, ntemp?: number, name?: string, inst?: any[]);
|
|
18
|
-
copy(): IScope;
|
|
19
|
-
createScope(): IScope;
|
|
20
|
-
createFunction(name: string, stacked?: boolean): IScope;
|
|
21
|
-
has(name: string): boolean;
|
|
22
|
-
get(name: string): IValue;
|
|
23
|
-
set(name: string, value: IValue): IValue;
|
|
24
|
-
hardSet(name: string, value: IValue): IValue;
|
|
25
|
-
make(name: string, storeName: string): IValue;
|
|
26
|
-
}
|
package/build/bin.d.ts
DELETED
package/build/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const compile: (script: string) => [string, Error, import("estree").Node[]];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
-
import { VoidValue } from "../values";
|
|
3
|
-
declare type TFunction = (...args: IValue[]) => TValueInstructions;
|
|
4
|
-
export declare class MacroFunction extends VoidValue {
|
|
5
|
-
macro: boolean;
|
|
6
|
-
constant: boolean;
|
|
7
|
-
fn: TFunction;
|
|
8
|
-
constructor(scope: IScope, fn: TFunction);
|
|
9
|
-
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
10
|
-
eval(scope: IScope): TValueInstructions;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
package/build/types.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export * as es from "estree";
|
|
2
|
-
import { Compiler } from "./Compiler";
|
|
3
|
-
import { AddressResolver } from "./instructions";
|
|
4
|
-
import { LeftRightOperator, UnaryOperator, UpdateOperator } from "./operators";
|
|
5
|
-
export interface IInstruction {
|
|
6
|
-
hidden: boolean;
|
|
7
|
-
resolve(i: number): void;
|
|
8
|
-
}
|
|
9
|
-
export declare type THandler = (compiler: Compiler, scope: IScope, node: any, arg: any) => TValueInstructions;
|
|
10
|
-
export interface IScope {
|
|
11
|
-
parent: IScope;
|
|
12
|
-
data: {};
|
|
13
|
-
name: string;
|
|
14
|
-
inst: IInstruction[];
|
|
15
|
-
break: AddressResolver;
|
|
16
|
-
continue: AddressResolver;
|
|
17
|
-
function: IFunctionValue;
|
|
18
|
-
ntemp: number;
|
|
19
|
-
createScope(): IScope;
|
|
20
|
-
createFunction(name: string, stacked?: boolean): IScope;
|
|
21
|
-
has(name: string): boolean;
|
|
22
|
-
get(name: string): IValue;
|
|
23
|
-
set(name: string, value: IValue): IValue;
|
|
24
|
-
hardSet(name: string, value: IValue): IValue;
|
|
25
|
-
make(name: string, storeName: string): IValue;
|
|
26
|
-
copy(): IScope;
|
|
27
|
-
}
|
|
28
|
-
export declare type IValue = {
|
|
29
|
-
[k in UnaryOperator]?: (scope: IScope) => TValueInstructions;
|
|
30
|
-
} & {
|
|
31
|
-
[k in UpdateOperator]?: (scope: IScope, prefix: boolean) => TValueInstructions;
|
|
32
|
-
} & {
|
|
33
|
-
[k in LeftRightOperator]?: (scope: IScope, value: IValue) => TValueInstructions;
|
|
34
|
-
} & {
|
|
35
|
-
scope: IScope;
|
|
36
|
-
constant: boolean;
|
|
37
|
-
macro: boolean;
|
|
38
|
-
eval(scope: IScope): TValueInstructions;
|
|
39
|
-
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
40
|
-
get(scope: IScope, name: IValue): TValueInstructions;
|
|
41
|
-
};
|
|
42
|
-
export declare type TLiteral = string | number;
|
|
43
|
-
export interface IBindableValue extends IValue {
|
|
44
|
-
data: TLiteral;
|
|
45
|
-
}
|
|
46
|
-
export interface IFunctionValue extends IValue {
|
|
47
|
-
return(scope: IScope, argument: IValue): TValueInstructions;
|
|
48
|
-
}
|
|
49
|
-
export declare type TValueInstructions = [IValue, IInstruction[]];
|
package/build/utils.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Compiler } from "../Compiler";
|
|
2
|
-
import { es, IFunctionValue, IScope, IValue, TValueInstructions } from "../types";
|
|
3
|
-
import { StoreValue } from "./StoreValue";
|
|
4
|
-
import { VoidValue } from "./VoidValue";
|
|
5
|
-
export declare class FunctionValue extends VoidValue implements IFunctionValue {
|
|
6
|
-
constant: boolean;
|
|
7
|
-
macro: boolean;
|
|
8
|
-
private paramStores;
|
|
9
|
-
private paramNames;
|
|
10
|
-
private inst;
|
|
11
|
-
private addr;
|
|
12
|
-
private temp;
|
|
13
|
-
private ret;
|
|
14
|
-
private inline;
|
|
15
|
-
private tryingInline;
|
|
16
|
-
private body;
|
|
17
|
-
private name;
|
|
18
|
-
private c;
|
|
19
|
-
private callSize;
|
|
20
|
-
private inlineTemp;
|
|
21
|
-
private inlineEnd;
|
|
22
|
-
private bundled;
|
|
23
|
-
private createValues;
|
|
24
|
-
typeof(scope: IScope): TValueInstructions;
|
|
25
|
-
private createInst;
|
|
26
|
-
constructor(scope: IScope, name: string, paramNames: string[], paramStores: StoreValue[], body: es.BlockStatement, c: Compiler);
|
|
27
|
-
private normalReturn;
|
|
28
|
-
private normalCall;
|
|
29
|
-
private inlineReturn;
|
|
30
|
-
private inlineCall;
|
|
31
|
-
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
32
|
-
return(scope: IScope, arg: IValue): TValueInstructions;
|
|
33
|
-
eval(scope: IScope): TValueInstructions;
|
|
34
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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
|
-
}
|