mlogjs 0.3.0 → 0.4.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/dist/{types/Compiler.d.ts → Compiler.d.ts} +17 -4
- package/dist/CompilerError.d.ts +33 -0
- package/dist/{types/Scope.d.ts → Scope.d.ts} +0 -0
- package/dist/assertions.d.ts +28 -0
- package/dist/bin.cjs +7 -14
- package/dist/{types/bin.d.ts → bin.d.ts} +0 -0
- package/dist/{types/handlers → handlers}/BlockStatement.d.ts +0 -0
- package/dist/{types/handlers → handlers}/CallExpression.d.ts +1 -0
- package/dist/{types/handlers → handlers}/File.d.ts +0 -0
- package/dist/{types/handlers → handlers}/ForStatement.d.ts +0 -0
- package/dist/{types/handlers → handlers}/Function.d.ts +0 -0
- package/dist/{types/handlers → handlers}/Identifier.d.ts +0 -0
- package/dist/{types/handlers → handlers}/IfStatement.d.ts +0 -0
- package/dist/{types/handlers → handlers}/Literal.d.ts +0 -0
- package/dist/{types/handlers → handlers}/Object.d.ts +0 -0
- package/dist/{types/handlers → handlers}/OperationExpressions.d.ts +0 -0
- package/dist/{types/handlers → handlers}/Program.d.ts +0 -0
- package/dist/{types/handlers → handlers}/Statements.d.ts +0 -0
- package/dist/handlers/SwitchStatement.d.ts +2 -0
- package/dist/{types/handlers → handlers}/TemplateExpression.d.ts +0 -0
- package/dist/{types/handlers → handlers}/Typescript.d.ts +0 -0
- package/dist/{types/handlers → handlers}/VariableDeclaration.d.ts +0 -0
- package/dist/{types/handlers → handlers}/WhileStatement.d.ts +0 -0
- package/dist/{types/handlers → handlers}/index.d.ts +1 -0
- package/dist/index.cjs +1282 -514
- package/dist/{types/index.d.ts → index.d.ts} +1 -0
- package/dist/index.mjs +1282 -514
- package/dist/{types/initScope.d.ts → initScope.d.ts} +0 -0
- package/dist/{types/instructions → instructions}/AddressResolver.d.ts +0 -0
- package/dist/{types/instructions → instructions}/ControlInstructions.d.ts +3 -1
- package/dist/{types/instructions → instructions}/EndInstruction.d.ts +0 -0
- package/dist/{types/instructions → instructions}/InstructionBase.d.ts +5 -1
- package/dist/{types/instructions → instructions}/JumpInstruction.d.ts +1 -0
- package/dist/{types/instructions → instructions}/OperationInstruction.d.ts +0 -0
- package/dist/{types/instructions → instructions}/SetCounterInstruction.d.ts +0 -0
- package/dist/{types/instructions → instructions}/SetInstruction.d.ts +0 -0
- package/dist/{types/instructions → instructions}/ZeroSpaceInstruction.d.ts +0 -0
- package/dist/{types/instructions → instructions}/index.d.ts +0 -0
- package/dist/macros/Asm.d.ts +4 -0
- package/dist/{types/macros → macros}/Function.d.ts +2 -2
- package/dist/macros/GetGlobal.d.ts +5 -0
- package/dist/{types/macros → macros}/Math.d.ts +1 -2
- package/dist/{types/macros → macros}/Memory.d.ts +1 -2
- package/dist/{types/macros → macros}/Namespace.d.ts +1 -4
- package/dist/{types/macros → macros}/Other.d.ts +1 -2
- package/dist/macros/commands/ApplyStatus.d.ts +4 -0
- package/dist/macros/commands/Control.d.ts +4 -0
- package/dist/macros/commands/Cutscene.d.ts +4 -0
- package/dist/macros/commands/Draw.d.ts +4 -0
- package/dist/{types/macros → macros}/commands/DrawFlush.d.ts +1 -2
- package/dist/{types/macros → macros}/commands/End.d.ts +1 -2
- package/dist/macros/commands/Explosion.d.ts +4 -0
- package/dist/macros/commands/Fetch.d.ts +4 -0
- package/dist/macros/commands/FlushMessage.d.ts +4 -0
- package/dist/macros/commands/GetBlock.d.ts +4 -0
- package/dist/macros/commands/GetFlag.d.ts +4 -0
- package/dist/{types/macros → macros}/commands/GetLink.d.ts +1 -2
- package/dist/macros/commands/Lookup.d.ts +4 -0
- package/dist/macros/commands/PackColor.d.ts +4 -0
- package/dist/{types/macros → macros}/commands/Print.d.ts +1 -2
- package/dist/{types/macros → macros}/commands/PrintFlush.d.ts +1 -2
- package/dist/macros/commands/Radar.d.ts +6 -0
- package/dist/{types/macros → macros}/commands/Sensor.d.ts +1 -2
- package/dist/macros/commands/SetBlock.d.ts +4 -0
- package/dist/macros/commands/SetFlag.d.ts +4 -0
- package/dist/macros/commands/SetRate.d.ts +4 -0
- package/dist/macros/commands/SetRule.d.ts +4 -0
- package/dist/macros/commands/SpawnUnit.d.ts +4 -0
- package/dist/macros/commands/SpawnWave.d.ts +4 -0
- package/dist/macros/commands/Stop.d.ts +4 -0
- package/dist/{types/macros → macros}/commands/UnitBind.d.ts +1 -2
- package/dist/macros/commands/UnitControl.d.ts +4 -0
- package/dist/macros/commands/UnitLocate.d.ts +4 -0
- package/dist/{types/macros → macros}/commands/UnitRadar.d.ts +1 -2
- package/dist/{types/macros → macros}/commands/Wait.d.ts +1 -2
- package/dist/macros/commands/index.d.ts +30 -0
- package/dist/{types/macros → macros}/index.d.ts +0 -0
- package/dist/macros/util.d.ts +17 -0
- package/dist/{types/operators.d.ts → operators.d.ts} +0 -0
- package/dist/{types/types.d.ts → types.d.ts} +14 -1
- package/dist/utils.d.ts +47 -0
- package/dist/{types/values → values}/BaseValue.d.ts +3 -2
- package/dist/{types/values → values}/DestructuringValue.d.ts +1 -1
- package/dist/{types/values → values}/FunctionValue.d.ts +4 -5
- package/dist/{types/values → values}/LiteralValue.d.ts +3 -2
- package/dist/{types/values → values}/ObjectValue.d.ts +3 -3
- package/dist/{types/values → values}/SenseableValue.d.ts +0 -0
- package/dist/{types/values → values}/StoreValue.d.ts +4 -2
- package/dist/{types/values → values}/ValueOwner.d.ts +0 -0
- package/dist/{types/values → values}/VoidValue.d.ts +0 -2
- package/dist/{types/values → values}/index.d.ts +0 -0
- package/lib/commands.d.ts +847 -420
- package/lib/eslib/lib.es2015.core.d.ts +3 -0
- package/lib/globals.d.ts +331 -19
- package/lib/helpers.d.ts +14 -0
- package/lib/kinds.d.ts +3 -2
- package/lib/memory.d.ts +1 -1
- package/lib/traits.d.ts +6 -0
- package/lib/util.d.ts +16 -0
- package/package.json +16 -17
- package/build/Compiler.js +0 -105
- package/build/Compiler.js.map +0 -1
- package/build/CompilerError.js +0 -11
- package/build/CompilerError.js.map +0 -1
- package/build/Scope.js +0 -71
- package/build/Scope.js.map +0 -1
- package/build/bin.js +0 -75
- package/build/bin.js.map +0 -1
- package/build/handlers/BlockStatement.js +0 -14
- package/build/handlers/BlockStatement.js.map +0 -1
- package/build/handlers/CallExpression.js +0 -20
- package/build/handlers/CallExpression.js.map +0 -1
- package/build/handlers/File.js +0 -9
- package/build/handlers/File.js.map +0 -1
- package/build/handlers/ForStatement.js +0 -32
- package/build/handlers/ForStatement.js.map +0 -1
- package/build/handlers/Function.js +0 -47
- package/build/handlers/Function.js.map +0 -1
- package/build/handlers/Identifier.js +0 -8
- package/build/handlers/Identifier.js.map +0 -1
- package/build/handlers/IfStatement.js +0 -25
- package/build/handlers/IfStatement.js.map +0 -1
- package/build/handlers/Literal.js +0 -15
- package/build/handlers/Literal.js.map +0 -1
- package/build/handlers/Object.js +0 -55
- package/build/handlers/Object.js.map +0 -1
- package/build/handlers/OperationExpressions.js +0 -38
- package/build/handlers/OperationExpressions.js.map +0 -1
- package/build/handlers/Program.js +0 -9
- package/build/handlers/Program.js.map +0 -1
- package/build/handlers/Statements.js +0 -30
- package/build/handlers/Statements.js.map +0 -1
- package/build/handlers/TemplateExpression.js +0 -18
- package/build/handlers/TemplateExpression.js.map +0 -1
- package/build/handlers/VariableDeclaration.js +0 -72
- package/build/handlers/VariableDeclaration.js.map +0 -1
- package/build/handlers/WhileStatement.js +0 -23
- package/build/handlers/WhileStatement.js.map +0 -1
- package/build/handlers/index.js +0 -32
- package/build/handlers/index.js.map +0 -1
- package/build/index.js +0 -8
- package/build/index.js.map +0 -1
- package/build/initScope.js +0 -40
- package/build/initScope.js.map +0 -1
- package/build/instructions/AddressResolver.js +0 -31
- package/build/instructions/AddressResolver.js.map +0 -1
- package/build/instructions/ControlInstructions.js +0 -23
- package/build/instructions/ControlInstructions.js.map +0 -1
- package/build/instructions/EndInstruction.js +0 -11
- package/build/instructions/EndInstruction.js.map +0 -1
- package/build/instructions/InstructionBase.js +0 -21
- package/build/instructions/InstructionBase.js.map +0 -1
- package/build/instructions/JumpInstruction.js +0 -22
- package/build/instructions/JumpInstruction.js.map +0 -1
- package/build/instructions/OperationInstruction.js +0 -11
- package/build/instructions/OperationInstruction.js.map +0 -1
- package/build/instructions/SetCounterInstruction.js +0 -11
- package/build/instructions/SetCounterInstruction.js.map +0 -1
- package/build/instructions/SetInstruction.js +0 -11
- package/build/instructions/SetInstruction.js.map +0 -1
- package/build/instructions/ZeroSpaceInstruction.js +0 -11
- package/build/instructions/ZeroSpaceInstruction.js.map +0 -1
- package/build/instructions/index.js +0 -26
- package/build/instructions/index.js.map +0 -1
- package/build/macros/Building.js +0 -89
- package/build/macros/Building.js.map +0 -1
- package/build/macros/Function.js +0 -20
- package/build/macros/Function.js.map +0 -1
- package/build/macros/Math.js +0 -62
- package/build/macros/Math.js.map +0 -1
- package/build/macros/Memory.js +0 -63
- package/build/macros/Memory.js.map +0 -1
- package/build/macros/Namespace.js +0 -111
- package/build/macros/Namespace.js.map +0 -1
- package/build/macros/Other.js +0 -21
- package/build/macros/Other.js.map +0 -1
- package/build/macros/RawValue.js +0 -17
- package/build/macros/RawValue.js.map +0 -1
- package/build/macros/commands/Control.js +0 -26
- package/build/macros/commands/Control.js.map +0 -1
- package/build/macros/commands/Draw.js +0 -40
- package/build/macros/commands/Draw.js.map +0 -1
- package/build/macros/commands/DrawFlush.js +0 -18
- package/build/macros/commands/DrawFlush.js.map +0 -1
- package/build/macros/commands/GetLink.js +0 -25
- package/build/macros/commands/GetLink.js.map +0 -1
- package/build/macros/commands/Lookup.js +0 -25
- package/build/macros/commands/Lookup.js.map +0 -1
- package/build/macros/commands/Print.js +0 -18
- package/build/macros/commands/Print.js.map +0 -1
- package/build/macros/commands/PrintFlush.js +0 -18
- package/build/macros/commands/PrintFlush.js.map +0 -1
- package/build/macros/commands/Radar.js +0 -65
- package/build/macros/commands/Radar.js.map +0 -1
- package/build/macros/commands/Sensor.js +0 -21
- package/build/macros/commands/Sensor.js.map +0 -1
- package/build/macros/commands/UnitBind.js +0 -18
- package/build/macros/commands/UnitBind.js.map +0 -1
- package/build/macros/commands/UnitControl.js +0 -73
- package/build/macros/commands/UnitControl.js.map +0 -1
- package/build/macros/commands/UnitLocate.js +0 -76
- package/build/macros/commands/UnitLocate.js.map +0 -1
- package/build/macros/commands/UnitRadar.js +0 -48
- package/build/macros/commands/UnitRadar.js.map +0 -1
- package/build/macros/commands/Wait.js +0 -19
- package/build/macros/commands/Wait.js.map +0 -1
- package/build/macros/commands/index.js +0 -33
- package/build/macros/commands/index.js.map +0 -1
- package/build/macros/index.js +0 -40
- package/build/macros/index.js.map +0 -1
- package/build/operators.js +0 -102
- package/build/operators.js.map +0 -1
- package/build/types.js +0 -28
- package/build/types.js.map +0 -1
- package/build/utils.js +0 -18
- package/build/utils.js.map +0 -1
- package/build/values/BaseValue.js +0 -112
- package/build/values/BaseValue.js.map +0 -1
- package/build/values/FunctionValue.js +0 -116
- package/build/values/FunctionValue.js.map +0 -1
- package/build/values/LiteralValue.js +0 -89
- package/build/values/LiteralValue.js.map +0 -1
- package/build/values/ObjectValue.js +0 -55
- package/build/values/ObjectValue.js.map +0 -1
- package/build/values/StoreValue.js +0 -32
- package/build/values/StoreValue.js.map +0 -1
- package/build/values/TempValue.js +0 -78
- package/build/values/TempValue.js.map +0 -1
- package/build/values/VoidValue.js +0 -32
- package/build/values/VoidValue.js.map +0 -1
- package/build/values/index.js +0 -23
- package/build/values/index.js.map +0 -1
- package/dist/bin.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/types/CompilerError.d.ts +0 -9
- package/dist/types/macros/Building.d.ts +0 -10
- package/dist/types/macros/Entities.d.ts +0 -11
- package/dist/types/macros/GetGlobal.d.ts +0 -5
- package/dist/types/macros/RawValue.d.ts +0 -5
- package/dist/types/macros/commands/Control.d.ts +0 -5
- package/dist/types/macros/commands/Draw.d.ts +0 -5
- package/dist/types/macros/commands/Lookup.d.ts +0 -5
- package/dist/types/macros/commands/Radar.d.ts +0 -7
- package/dist/types/macros/commands/UnitControl.d.ts +0 -5
- package/dist/types/macros/commands/UnitLocate.d.ts +0 -5
- package/dist/types/macros/commands/index.d.ts +0 -15
- package/dist/types/utils.d.ts +0 -30
- package/dist/types/values/StackValue.d.ts +0 -16
- package/dist/types/values/TempValue.d.ts +0 -19
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { IBindableValue } from "../types";
|
|
1
|
+
import { EInstIntent, IBindableValue } from "../types";
|
|
2
2
|
import { JumpInstruction } from "./JumpInstruction";
|
|
3
3
|
export declare class BreakInstruction extends JumpInstruction {
|
|
4
|
+
intent: EInstIntent;
|
|
4
5
|
constructor(address: IBindableValue);
|
|
5
6
|
}
|
|
6
7
|
export declare class ContinueInstruction extends JumpInstruction {
|
|
8
|
+
intent: EInstIntent;
|
|
7
9
|
constructor(address: IBindableValue);
|
|
8
10
|
}
|
|
File without changes
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SourceLocation } from "@babel/types";
|
|
2
|
+
import { EInstIntent, IInstruction, IValue } from "../types";
|
|
2
3
|
export declare class InstructionBase implements IInstruction {
|
|
4
|
+
intent: EInstIntent;
|
|
5
|
+
alwaysRuns: boolean;
|
|
3
6
|
protected _hidden: boolean;
|
|
4
7
|
get hidden(): boolean;
|
|
5
8
|
set hidden(value: boolean);
|
|
6
9
|
args: (string | IValue | null)[];
|
|
10
|
+
source?: SourceLocation;
|
|
7
11
|
constructor(...args: (string | IValue | null)[]);
|
|
8
12
|
resolve(_i: number): void;
|
|
9
13
|
toString(): string;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
2
|
import { VoidValue } from "../values";
|
|
3
|
-
declare type TFunction<T extends IValue | null> = (...args: IValue[]) => TValueInstructions<T>;
|
|
3
|
+
declare type TFunction<T extends IValue | null> = (scope: IScope, ...args: IValue[]) => TValueInstructions<T>;
|
|
4
4
|
export declare class MacroFunction<RT extends IValue | null = IValue> extends VoidValue {
|
|
5
5
|
macro: boolean;
|
|
6
6
|
constant: boolean;
|
|
7
7
|
fn: TFunction<RT>;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(fn: TFunction<RT>);
|
|
9
9
|
call(scope: IScope, args: IValue[]): TValueInstructions<RT>;
|
|
10
10
|
eval(_scope: IScope): TValueInstructions;
|
|
11
11
|
consume(_scope: IScope): TValueInstructions;
|
|
@@ -5,12 +5,9 @@ interface NamespaceMacroOptions {
|
|
|
5
5
|
}
|
|
6
6
|
export declare class NamespaceMacro extends ObjectValue {
|
|
7
7
|
changeCasing: boolean;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor({ changeCasing }?: NamespaceMacroOptions);
|
|
9
9
|
}
|
|
10
10
|
export declare class VarsNamespace extends NamespaceMacro {
|
|
11
11
|
constructor(scope: IScope);
|
|
12
12
|
}
|
|
13
|
-
export declare class UCommandsNamespace extends NamespaceMacro {
|
|
14
|
-
constructor(scope: IScope);
|
|
15
|
-
}
|
|
16
13
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MacroFunction } from "..";
|
|
2
|
+
export declare const validRadarFilters: readonly ["any", "enemy", "ally", "player", "attacker", "flying", "boss", "ground"];
|
|
3
|
+
export declare const validRadarSorts: readonly ["distance", "health", "shield", "armor", "maxHealth"];
|
|
4
|
+
export declare class Radar extends MacroFunction {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export * from "./Draw";
|
|
2
|
+
export * from "./Print";
|
|
3
|
+
export * from "./PrintFlush";
|
|
4
|
+
export * from "./DrawFlush";
|
|
5
|
+
export * from "./GetBlock";
|
|
6
|
+
export * from "./GetLink";
|
|
7
|
+
export * from "./Control";
|
|
8
|
+
export { Radar } from "./Radar";
|
|
9
|
+
export * from "./Sensor";
|
|
10
|
+
export * from "./Wait";
|
|
11
|
+
export * from "./Lookup";
|
|
12
|
+
export * from "./PackColor";
|
|
13
|
+
export * from "./End";
|
|
14
|
+
export * from "./SetBlock";
|
|
15
|
+
export * from "./SpawnUnit";
|
|
16
|
+
export * from "./Stop";
|
|
17
|
+
export * from "./UnitBind";
|
|
18
|
+
export * from "./UnitControl";
|
|
19
|
+
export * from "./UnitRadar";
|
|
20
|
+
export * from "./UnitLocate";
|
|
21
|
+
export * from "./ApplyStatus";
|
|
22
|
+
export * from "./SpawnWave";
|
|
23
|
+
export * from "./SetRule";
|
|
24
|
+
export * from "./FlushMessage";
|
|
25
|
+
export * from "./Cutscene";
|
|
26
|
+
export * from "./Explosion";
|
|
27
|
+
export * from "./SetRate";
|
|
28
|
+
export * from "./Fetch";
|
|
29
|
+
export * from "./GetFlag";
|
|
30
|
+
export * from "./SetFlag";
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IParameterDescriptor } from "../assertions";
|
|
2
|
+
import { IScope, IValue, TValueInstructions } from "../types";
|
|
3
|
+
import { MacroFunction } from "./Function";
|
|
4
|
+
interface IOverloadNamespaceOptions<K extends string> {
|
|
5
|
+
overloads: Record<K, {
|
|
6
|
+
/**
|
|
7
|
+
* Pass the name of the options argument to tell if this overload uses
|
|
8
|
+
* named parameters.
|
|
9
|
+
*/
|
|
10
|
+
named?: string;
|
|
11
|
+
args: (IParameterDescriptor | string)[];
|
|
12
|
+
}>;
|
|
13
|
+
handler(scope: IScope, overload: K, ...args: (IValue | string)[]): TValueInstructions<IValue | null>;
|
|
14
|
+
}
|
|
15
|
+
/** Used to create namespaces that contain multiple methods that map into instructions */
|
|
16
|
+
export declare function createOverloadNamespace<K extends string>({ overloads, handler, }: IOverloadNamespaceOptions<K>): Record<string, MacroFunction<IValue | null>>;
|
|
17
|
+
export {};
|
|
File without changes
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
export * as es from "@babel/types";
|
|
2
|
+
import * as es from "@babel/types";
|
|
2
3
|
import { Compiler } from "./Compiler";
|
|
3
4
|
import { AddressResolver } from "./instructions";
|
|
4
5
|
import { MacroFunction } from "./macros";
|
|
5
6
|
import { LeftRightOperator, UnaryOperator, UpdateOperator } from "./operators";
|
|
7
|
+
export declare enum EInstIntent {
|
|
8
|
+
none = 0,
|
|
9
|
+
break = 1,
|
|
10
|
+
continue = 2,
|
|
11
|
+
return = 3
|
|
12
|
+
}
|
|
6
13
|
export interface IInstruction {
|
|
14
|
+
intent: EInstIntent;
|
|
7
15
|
hidden: boolean;
|
|
8
16
|
resolve(i: number): void;
|
|
17
|
+
source?: es.SourceLocation;
|
|
18
|
+
/**
|
|
19
|
+
* Helps analyzing control flow, handlers should
|
|
20
|
+
* indicate which instructions returned are guaranteed to run
|
|
21
|
+
*/
|
|
22
|
+
alwaysRuns: boolean;
|
|
9
23
|
}
|
|
10
24
|
export declare type THandler<T extends IValue | null = IValue> = (compiler: Compiler, scope: IScope, node: any, arg: any) => TValueInstructions<T>;
|
|
11
25
|
/**
|
|
@@ -184,7 +198,6 @@ export declare enum EMutability {
|
|
|
184
198
|
}
|
|
185
199
|
export interface IValue extends IValueOperators {
|
|
186
200
|
owner: IValueOwner | null;
|
|
187
|
-
scope: IScope;
|
|
188
201
|
mutability: EMutability;
|
|
189
202
|
macro: boolean;
|
|
190
203
|
/**
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { es, IValue, TValueInstructions } from "./types";
|
|
2
|
+
import { IObjectValueData, LiteralValue, ObjectValue } from "./values";
|
|
3
|
+
/**
|
|
4
|
+
* The prefix for internal variables inside the compiler output
|
|
5
|
+
*/
|
|
6
|
+
export declare const internalPrefix = "&";
|
|
7
|
+
export declare const discardedName: string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a string that has the format: [line]:[column].
|
|
10
|
+
*
|
|
11
|
+
* If `name` is provided, and it is a string, the resulting string will
|
|
12
|
+
* have the format: [name]:[line]:[column].
|
|
13
|
+
*/
|
|
14
|
+
export declare function nodeName(node: es.Node, name?: false | string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Converts a camel case string into a dash case one.
|
|
17
|
+
*
|
|
18
|
+
* As an example `camelCase` becomes `camel-case`
|
|
19
|
+
* @example
|
|
20
|
+
* ```
|
|
21
|
+
* camelToDashCase("camelCase") // returns "camel-case"
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function camelToDashCase(name: string): string;
|
|
25
|
+
export declare const itemNames: string[];
|
|
26
|
+
/**
|
|
27
|
+
* A more type safe version of `Object.assign`
|
|
28
|
+
*/
|
|
29
|
+
export declare function assign<T extends {}>(obj: T, props: {
|
|
30
|
+
[K in keyof T as T[K] extends Function ? never : K]?: T[K];
|
|
31
|
+
}): T;
|
|
32
|
+
export declare function appendSourceLocations<T extends IValue | null>(valueInst: TValueInstructions<T>, node: es.Node): TValueInstructions<T>;
|
|
33
|
+
export declare function withAlwaysRuns<T extends IValue | null>(valueInst: TValueInstructions<T>, value: boolean): TValueInstructions<T>;
|
|
34
|
+
export declare function isTemplateObjectArray(value: IValue): value is ObjectValue & {
|
|
35
|
+
data: IObjectValueData & {
|
|
36
|
+
raw: ObjectValue & {
|
|
37
|
+
data: IObjectValueData & {
|
|
38
|
+
length: LiteralValue & {
|
|
39
|
+
data: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
length: LiteralValue & {
|
|
44
|
+
data: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
2
|
import { VoidValue } from ".";
|
|
3
3
|
export declare class BaseValue extends VoidValue implements IValue {
|
|
4
4
|
"u-"(scope: IScope): TValueInstructions;
|
|
5
5
|
"u+"(scope: IScope): TValueInstructions;
|
|
6
|
-
|
|
6
|
+
"!"(scope: IScope): TValueInstructions;
|
|
7
|
+
"~"(scope: IScope): TValueInstructions;
|
|
7
8
|
}
|
|
@@ -10,7 +10,7 @@ import { VoidValue } from "./VoidValue";
|
|
|
10
10
|
export declare class DestructuringValue extends VoidValue {
|
|
11
11
|
members: Map<IValue, IValue>;
|
|
12
12
|
macro: boolean;
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(members: Map<IValue, IValue>);
|
|
14
14
|
"="(scope: IScope, right: IValue): TValueInstructions;
|
|
15
15
|
eval(_scope: IScope): TValueInstructions<IValue>;
|
|
16
16
|
consume(_scope: IScope): TValueInstructions<IValue>;
|
|
@@ -9,7 +9,7 @@ export declare type TFunctionValueInitParams = (childScope: IScope) => {
|
|
|
9
9
|
export declare class FunctionValue extends VoidValue implements IFunctionValue {
|
|
10
10
|
mutability: EMutability;
|
|
11
11
|
macro: boolean;
|
|
12
|
-
|
|
12
|
+
scope: IScope;
|
|
13
13
|
private childScope;
|
|
14
14
|
private params;
|
|
15
15
|
private paramOwners;
|
|
@@ -23,17 +23,16 @@ export declare class FunctionValue extends VoidValue implements IFunctionValue {
|
|
|
23
23
|
private c;
|
|
24
24
|
private callSize;
|
|
25
25
|
private inlineTemp;
|
|
26
|
-
private inlineEnd
|
|
26
|
+
private inlineEnd?;
|
|
27
27
|
private bundled;
|
|
28
28
|
private initialized;
|
|
29
|
-
constructor({ scope, params, body, c,
|
|
29
|
+
constructor({ scope, params, body, c, }: {
|
|
30
30
|
scope: IScope;
|
|
31
31
|
body: es.BlockStatement;
|
|
32
32
|
c: Compiler;
|
|
33
|
-
node: es.Function;
|
|
34
33
|
params: es.Identifier[];
|
|
35
34
|
});
|
|
36
|
-
typeof(
|
|
35
|
+
typeof(): TValueInstructions;
|
|
37
36
|
private initScope;
|
|
38
37
|
private ensureInit;
|
|
39
38
|
private normalReturn;
|
|
@@ -3,11 +3,12 @@ import { BaseValue } from ".";
|
|
|
3
3
|
export declare class LiteralValue extends BaseValue implements IBindableValue {
|
|
4
4
|
data: TLiteral;
|
|
5
5
|
mutability: EMutability;
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(data: TLiteral);
|
|
7
7
|
eval(_scope: IScope): TValueInstructions;
|
|
8
8
|
consume(_scope: IScope): TValueInstructions;
|
|
9
9
|
toString(): string;
|
|
10
10
|
get(scope: IScope, name: IValue): TValueInstructions;
|
|
11
11
|
get num(): number;
|
|
12
|
-
typeof(
|
|
12
|
+
typeof(): TValueInstructions;
|
|
13
|
+
ensureOwned(): void;
|
|
13
14
|
}
|
|
@@ -12,9 +12,9 @@ export declare class ObjectValue extends VoidValue {
|
|
|
12
12
|
mutability: EMutability;
|
|
13
13
|
macro: boolean;
|
|
14
14
|
data: IObjectValueData;
|
|
15
|
-
constructor(
|
|
16
|
-
static fromArray(
|
|
17
|
-
typeof(
|
|
15
|
+
constructor(data?: IObjectValueData);
|
|
16
|
+
static fromArray(items: IObjectValueData[keyof IObjectValueData][], intialData?: IObjectValueData): ObjectValue;
|
|
17
|
+
typeof(): TValueInstructions;
|
|
18
18
|
get(scope: IScope, key: LiteralValue): TValueInstructions;
|
|
19
19
|
eval(scope: IScope): TValueInstructions;
|
|
20
20
|
consume(scope: IScope): TValueInstructions;
|
|
File without changes
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { BaseValue } from ".";
|
|
2
|
-
import { EMutability, IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
+
import { EMutability, IOwnedValue, IScope, IValue, TValueInstructions } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* `StoreValue` represents values unknown at compile time,
|
|
5
5
|
* mostly used with mutable variables and temporary values
|
|
6
6
|
*/
|
|
7
7
|
export declare class StoreValue extends BaseValue implements IValue {
|
|
8
|
+
scope: IScope;
|
|
8
9
|
mutability: EMutability;
|
|
9
10
|
constructor(scope: IScope);
|
|
10
|
-
typeof(
|
|
11
|
+
typeof(): TValueInstructions;
|
|
11
12
|
"="(scope: IScope, value: IValue): TValueInstructions;
|
|
12
13
|
eval(_scope: IScope): TValueInstructions;
|
|
13
14
|
consume(_scope: IScope): TValueInstructions;
|
|
15
|
+
ensureOwned(): asserts this is IOwnedValue;
|
|
14
16
|
toString(): string;
|
|
15
17
|
}
|
|
File without changes
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { EMutability, IScope, IValue, IValueOperators, IValueOwner, TValueInstructions } from "../types";
|
|
2
2
|
export declare class VoidValue implements IValue {
|
|
3
3
|
owner: IValueOwner | null;
|
|
4
|
-
scope: IScope;
|
|
5
4
|
mutability: EMutability;
|
|
6
5
|
macro: boolean;
|
|
7
|
-
constructor(scope: IScope);
|
|
8
6
|
eval(_scope: IScope): TValueInstructions;
|
|
9
7
|
consume(_scope: IScope): TValueInstructions<IValue>;
|
|
10
8
|
call(_scope: IScope, _args: IValue[]): TValueInstructions<IValue | null>;
|
|
File without changes
|