mlogjs 0.4.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.
Files changed (141) hide show
  1. package/dist/index.cjs +359 -313
  2. package/dist/index.mjs +359 -313
  3. package/dist/macros/Asm.d.ts +1 -2
  4. package/dist/macros/Function.d.ts +2 -2
  5. package/dist/macros/GetGlobal.d.ts +2 -2
  6. package/dist/macros/Math.d.ts +1 -2
  7. package/dist/macros/Memory.d.ts +1 -2
  8. package/dist/macros/Namespace.d.ts +1 -1
  9. package/dist/macros/Other.d.ts +1 -2
  10. package/dist/macros/commands/ApplyStatus.d.ts +1 -2
  11. package/dist/macros/commands/Control.d.ts +1 -2
  12. package/dist/macros/commands/Cutscene.d.ts +1 -2
  13. package/dist/macros/commands/Draw.d.ts +1 -2
  14. package/dist/macros/commands/DrawFlush.d.ts +1 -2
  15. package/dist/macros/commands/End.d.ts +1 -2
  16. package/dist/macros/commands/Explosion.d.ts +1 -2
  17. package/dist/macros/commands/Fetch.d.ts +1 -2
  18. package/dist/macros/commands/FlushMessage.d.ts +1 -2
  19. package/dist/macros/commands/GetBlock.d.ts +1 -2
  20. package/dist/macros/commands/GetFlag.d.ts +1 -2
  21. package/dist/macros/commands/GetLink.d.ts +1 -2
  22. package/dist/macros/commands/Lookup.d.ts +1 -2
  23. package/dist/macros/commands/PackColor.d.ts +1 -2
  24. package/dist/macros/commands/Print.d.ts +1 -2
  25. package/dist/macros/commands/PrintFlush.d.ts +1 -2
  26. package/dist/macros/commands/Radar.d.ts +1 -2
  27. package/dist/macros/commands/Sensor.d.ts +1 -2
  28. package/dist/macros/commands/SetBlock.d.ts +1 -2
  29. package/dist/macros/commands/SetFlag.d.ts +1 -2
  30. package/dist/macros/commands/SetRate.d.ts +1 -2
  31. package/dist/macros/commands/SetRule.d.ts +1 -2
  32. package/dist/macros/commands/SpawnUnit.d.ts +1 -2
  33. package/dist/macros/commands/SpawnWave.d.ts +1 -2
  34. package/dist/macros/commands/Stop.d.ts +1 -2
  35. package/dist/macros/commands/UnitBind.d.ts +1 -2
  36. package/dist/macros/commands/UnitControl.d.ts +1 -2
  37. package/dist/macros/commands/UnitLocate.d.ts +1 -2
  38. package/dist/macros/commands/UnitRadar.d.ts +1 -2
  39. package/dist/macros/commands/Wait.d.ts +1 -2
  40. package/dist/macros/util.d.ts +2 -3
  41. package/dist/types.d.ts +0 -1
  42. package/dist/values/BaseValue.d.ts +1 -2
  43. package/dist/values/DestructuringValue.d.ts +1 -1
  44. package/dist/values/FunctionValue.d.ts +3 -4
  45. package/dist/values/LiteralValue.d.ts +3 -2
  46. package/dist/values/ObjectValue.d.ts +3 -3
  47. package/dist/values/StoreValue.d.ts +4 -2
  48. package/dist/values/VoidValue.d.ts +0 -2
  49. package/lib/commands.d.ts +6 -10
  50. package/package.json +2 -2
  51. package/dist/bin.cjs.map +0 -1
  52. package/dist/index.cjs.map +0 -1
  53. package/dist/index.mjs.map +0 -1
  54. package/dist/types/Compiler.d.ts +0 -39
  55. package/dist/types/CompilerError.d.ts +0 -33
  56. package/dist/types/Scope.d.ts +0 -24
  57. package/dist/types/assertions.d.ts +0 -28
  58. package/dist/types/bin.d.ts +0 -1
  59. package/dist/types/handlers/BlockStatement.d.ts +0 -2
  60. package/dist/types/handlers/CallExpression.d.ts +0 -4
  61. package/dist/types/handlers/File.d.ts +0 -2
  62. package/dist/types/handlers/ForStatement.d.ts +0 -2
  63. package/dist/types/handlers/Function.d.ts +0 -5
  64. package/dist/types/handlers/Identifier.d.ts +0 -2
  65. package/dist/types/handlers/IfStatement.d.ts +0 -2
  66. package/dist/types/handlers/Literal.d.ts +0 -5
  67. package/dist/types/handlers/Object.d.ts +0 -6
  68. package/dist/types/handlers/OperationExpressions.d.ts +0 -8
  69. package/dist/types/handlers/Program.d.ts +0 -2
  70. package/dist/types/handlers/Statements.d.ts +0 -5
  71. package/dist/types/handlers/SwitchStatement.d.ts +0 -2
  72. package/dist/types/handlers/TemplateExpression.d.ts +0 -2
  73. package/dist/types/handlers/Typescript.d.ts +0 -7
  74. package/dist/types/handlers/VariableDeclaration.d.ts +0 -3
  75. package/dist/types/handlers/WhileStatement.d.ts +0 -3
  76. package/dist/types/handlers/index.d.ts +0 -17
  77. package/dist/types/index.d.ts +0 -3
  78. package/dist/types/initScope.d.ts +0 -5
  79. package/dist/types/instructions/AddressResolver.d.ts +0 -12
  80. package/dist/types/instructions/ControlInstructions.d.ts +0 -10
  81. package/dist/types/instructions/EndInstruction.d.ts +0 -4
  82. package/dist/types/instructions/InstructionBase.d.ts +0 -14
  83. package/dist/types/instructions/JumpInstruction.d.ts +0 -16
  84. package/dist/types/instructions/OperationInstruction.d.ts +0 -5
  85. package/dist/types/instructions/SetCounterInstruction.d.ts +0 -5
  86. package/dist/types/instructions/SetInstruction.d.ts +0 -6
  87. package/dist/types/instructions/ZeroSpaceInstruction.d.ts +0 -4
  88. package/dist/types/instructions/index.d.ts +0 -9
  89. package/dist/types/macros/Asm.d.ts +0 -5
  90. package/dist/types/macros/Function.d.ts +0 -13
  91. package/dist/types/macros/GetGlobal.d.ts +0 -5
  92. package/dist/types/macros/Math.d.ts +0 -5
  93. package/dist/types/macros/Memory.d.ts +0 -5
  94. package/dist/types/macros/Namespace.d.ts +0 -13
  95. package/dist/types/macros/Other.d.ts +0 -5
  96. package/dist/types/macros/commands/ApplyStatus.d.ts +0 -5
  97. package/dist/types/macros/commands/Control.d.ts +0 -5
  98. package/dist/types/macros/commands/Cutscene.d.ts +0 -5
  99. package/dist/types/macros/commands/Draw.d.ts +0 -5
  100. package/dist/types/macros/commands/DrawFlush.d.ts +0 -5
  101. package/dist/types/macros/commands/End.d.ts +0 -5
  102. package/dist/types/macros/commands/Explosion.d.ts +0 -5
  103. package/dist/types/macros/commands/Fetch.d.ts +0 -5
  104. package/dist/types/macros/commands/FlushMessage.d.ts +0 -5
  105. package/dist/types/macros/commands/GetBlock.d.ts +0 -5
  106. package/dist/types/macros/commands/GetFlag.d.ts +0 -5
  107. package/dist/types/macros/commands/GetLink.d.ts +0 -5
  108. package/dist/types/macros/commands/Lookup.d.ts +0 -5
  109. package/dist/types/macros/commands/PackColor.d.ts +0 -5
  110. package/dist/types/macros/commands/Print.d.ts +0 -5
  111. package/dist/types/macros/commands/PrintFlush.d.ts +0 -5
  112. package/dist/types/macros/commands/Radar.d.ts +0 -7
  113. package/dist/types/macros/commands/Sensor.d.ts +0 -5
  114. package/dist/types/macros/commands/SetBlock.d.ts +0 -5
  115. package/dist/types/macros/commands/SetFlag.d.ts +0 -5
  116. package/dist/types/macros/commands/SetRate.d.ts +0 -5
  117. package/dist/types/macros/commands/SetRule.d.ts +0 -5
  118. package/dist/types/macros/commands/SpawnUnit.d.ts +0 -5
  119. package/dist/types/macros/commands/SpawnWave.d.ts +0 -5
  120. package/dist/types/macros/commands/Stop.d.ts +0 -5
  121. package/dist/types/macros/commands/UnitBind.d.ts +0 -5
  122. package/dist/types/macros/commands/UnitControl.d.ts +0 -5
  123. package/dist/types/macros/commands/UnitLocate.d.ts +0 -5
  124. package/dist/types/macros/commands/UnitRadar.d.ts +0 -5
  125. package/dist/types/macros/commands/Wait.d.ts +0 -5
  126. package/dist/types/macros/commands/index.d.ts +0 -30
  127. package/dist/types/macros/index.d.ts +0 -6
  128. package/dist/types/macros/util.d.ts +0 -18
  129. package/dist/types/operators.d.ts +0 -25
  130. package/dist/types/types.d.ts +0 -238
  131. package/dist/types/utils.d.ts +0 -47
  132. package/dist/types/values/BaseValue.d.ts +0 -9
  133. package/dist/types/values/DestructuringValue.d.ts +0 -17
  134. package/dist/types/values/FunctionValue.d.ts +0 -47
  135. package/dist/types/values/LiteralValue.d.ts +0 -13
  136. package/dist/types/values/ObjectValue.d.ts +0 -23
  137. package/dist/types/values/SenseableValue.d.ts +0 -23
  138. package/dist/types/values/StoreValue.d.ts +0 -15
  139. package/dist/types/values/ValueOwner.d.ts +0 -27
  140. package/dist/types/values/VoidValue.d.ts +0 -16
  141. package/dist/types/values/index.d.ts +0 -7
@@ -1,5 +1,4 @@
1
- import { IScope } from "../types";
2
1
  import { MacroFunction } from "./Function";
3
2
  export declare class Asm extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -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(scope: IScope, fn: TFunction<RT>);
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;
@@ -1,5 +1,5 @@
1
- import { EMutability, IScope } from "../types";
1
+ import { EMutability } from "../types";
2
2
  import { MacroFunction } from "./Function";
3
3
  export declare class GetGlobal extends MacroFunction {
4
- constructor(scope: IScope, mutability: EMutability);
4
+ constructor(mutability: EMutability);
5
5
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../types";
2
1
  import { ObjectValue } from "../values";
3
2
  export declare class MlogMath extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../types";
2
1
  import { ObjectValue } from "../values";
3
2
  export declare class MemoryBuilder extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -5,7 +5,7 @@ interface NamespaceMacroOptions {
5
5
  }
6
6
  export declare class NamespaceMacro extends ObjectValue {
7
7
  changeCasing: boolean;
8
- constructor(scope: IScope, { changeCasing }?: NamespaceMacroOptions);
8
+ constructor({ changeCasing }?: NamespaceMacroOptions);
9
9
  }
10
10
  export declare class VarsNamespace extends NamespaceMacro {
11
11
  constructor(scope: IScope);
@@ -1,5 +1,4 @@
1
- import { IScope } from "../types";
2
1
  import { MacroFunction } from "./Function";
3
2
  export declare class Concat extends MacroFunction {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class ApplyStatus extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class Control extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class Cutscene extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class Draw extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare class DrawFlush extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class End extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class Explosion extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class Fetch extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class FlushMessage extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class GetBlock extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class GetFlag extends MacroFunction {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare class GetLink extends MacroFunction {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class Lookup extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class PackColor extends MacroFunction {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare class Print extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare class PrintFlush extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,7 +1,6 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare const validRadarFilters: readonly ["any", "enemy", "ally", "player", "attacker", "flying", "boss", "ground"];
4
3
  export declare const validRadarSorts: readonly ["distance", "health", "shield", "armor", "maxHealth"];
5
4
  export declare class Radar extends MacroFunction {
6
- constructor(scope: IScope);
5
+ constructor();
7
6
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare class Sensor extends MacroFunction {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class SetBlock extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class SetFlag extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class SetRate extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class SetRule extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class SpawnUnit extends MacroFunction {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class SpawnWave extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { MacroFunction } from "../Function";
3
2
  export declare class Stop extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare class UnitBind extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class UnitControl extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
- import { IScope } from "../../types";
2
1
  import { ObjectValue } from "../../values";
3
2
  export declare class UnitLocate extends ObjectValue {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare class UnitRadar extends MacroFunction {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroFunction } from "..";
2
- import { IScope } from "../../types";
3
2
  export declare class Wait extends MacroFunction<null> {
4
- constructor(scope: IScope);
3
+ constructor();
5
4
  }
@@ -2,7 +2,6 @@ import { IParameterDescriptor } from "../assertions";
2
2
  import { IScope, IValue, TValueInstructions } from "../types";
3
3
  import { MacroFunction } from "./Function";
4
4
  interface IOverloadNamespaceOptions<K extends string> {
5
- scope: IScope;
6
5
  overloads: Record<K, {
7
6
  /**
8
7
  * Pass the name of the options argument to tell if this overload uses
@@ -11,8 +10,8 @@ interface IOverloadNamespaceOptions<K extends string> {
11
10
  named?: string;
12
11
  args: (IParameterDescriptor | string)[];
13
12
  }>;
14
- handler(overload: K, ...args: (IValue | string)[]): TValueInstructions<IValue | null>;
13
+ handler(scope: IScope, overload: K, ...args: (IValue | string)[]): TValueInstructions<IValue | null>;
15
14
  }
16
15
  /** Used to create namespaces that contain multiple methods that map into instructions */
17
- export declare function createOverloadNamespace<K extends string>({ scope, overloads, handler, }: IOverloadNamespaceOptions<K>): Record<string, MacroFunction<IValue | null>>;
16
+ export declare function createOverloadNamespace<K extends string>({ overloads, handler, }: IOverloadNamespaceOptions<K>): Record<string, MacroFunction<IValue | null>>;
18
17
  export {};
package/dist/types.d.ts CHANGED
@@ -198,7 +198,6 @@ export declare enum EMutability {
198
198
  }
199
199
  export interface IValue extends IValueOperators {
200
200
  owner: IValueOwner | null;
201
- scope: IScope;
202
201
  mutability: EMutability;
203
202
  macro: boolean;
204
203
  /**
@@ -1,9 +1,8 @@
1
- import { IOwnedValue, IScope, IValue, TValueInstructions } from "../types";
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
7
  "~"(scope: IScope): TValueInstructions;
8
- ensureOwned(): asserts this is IOwnedValue;
9
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(scope: IScope, members: Map<IValue, IValue>);
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
- private node;
12
+ scope: IScope;
13
13
  private childScope;
14
14
  private params;
15
15
  private paramOwners;
@@ -26,14 +26,13 @@ export declare class FunctionValue extends VoidValue implements IFunctionValue {
26
26
  private inlineEnd?;
27
27
  private bundled;
28
28
  private initialized;
29
- constructor({ scope, params, body, c, node, }: {
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(scope: IScope): TValueInstructions;
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(scope: IScope, data: TLiteral);
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(scope: IScope): TValueInstructions;
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(scope: IScope, data?: IObjectValueData);
16
- static fromArray(scope: IScope, items: IObjectValueData[keyof IObjectValueData][], intialData?: IObjectValueData): ObjectValue;
17
- typeof(scope: IScope): TValueInstructions;
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;
@@ -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(scope: IScope): TValueInstructions;
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
  }
@@ -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>;
package/lib/commands.d.ts CHANGED
@@ -266,8 +266,7 @@ declare global {
266
266
  * Detects an unit nearby this `building`.
267
267
  * @param options.building The building used to detect potential targets
268
268
  * @param options.filters The filters for selecting a target. Use "any" for any target.
269
- * @param options.order The n th unit that fits these requirements based on the sorting method
270
- * (1 => first unit, 2 => second unit and so on)
269
+ * @param options.order `true` to get the first result, `false` to get the last result.
271
270
  * @param options.sort The method on which the results should be sorted
272
271
  *
273
272
  * Example:
@@ -287,9 +286,8 @@ declare global {
287
286
  building: BasicBuilding;
288
287
  /** The filters for selecting a target. Use "any" for any target. */
289
288
  filters: [TRadarFilter, TRadarFilter, TRadarFilter];
290
- /** The n th unit that fits these requirements based on the sorting method
291
- * (1 => first unit, 2 => second unit and so on) */
292
- order: number;
289
+ /** `true` to get the first result, `false` to get the last result. */
290
+ order: boolean;
293
291
  /** The method on which the results should be sorted */
294
292
  sort: TRadarSort;
295
293
  }): T;
@@ -533,8 +531,7 @@ declare global {
533
531
  /**
534
532
  * Finds an unit near the unit bound to this processor
535
533
  * @param options.filters The filters for selecting a target. Use "any" for any target.
536
- * @param options.order The n th unit that fits these requirements based on the sorting method
537
- * (1 => first unit, 2 => second unit and so on)
534
+ * @param options.order `true` to get the first result, `false` to get the last result.
538
535
  * @param options.sort The method on which the results should be sorted
539
536
  *
540
537
  * Example:
@@ -550,9 +547,8 @@ declare global {
550
547
  function unitRadar<T extends BasicUnit = AnyUnit>(options: {
551
548
  /** The filters for selecting a target. Use "any" for any target. */
552
549
  filters: [TRadarFilter, TRadarFilter, TRadarFilter];
553
- /** The n th unit that fits these requirements based on the sorting method
554
- * (1 => first unit, 2 => second unit and so on) */
555
- order: number;
550
+ /** `true` to get the first result, `false` to get the last result. */
551
+ order: boolean;
556
552
  /** The method on which the results should be sorted */
557
553
  sort: TRadarSort;
558
554
  }): T;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "mlogjs",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Compiler that compiles Javascript to Mindustry Logic Code.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "bin": "./dist/bin.cjs",
8
- "types": "./dist/types",
8
+ "types": "./dist/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/weisrc/mlogjs.git"
package/dist/bin.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin.cjs","sources":["../src/bin.ts"],"sourcesContent":[null],"names":["yargs","hideBin","path","existsSync","Compiler","readFileSync","chalk","resolve","highlight","writeFileSync","parse","join"],"mappings":";;;;;;;;;;;;;;;;AAQAA,yBAAK,CAACC,eAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,KAAA,OAAO,CACN,iBAAiB,EACjB,uCAAuC,EACvC,KAAK,IAAG;AACN,IAAA,OAAO,KAAK;SACT,UAAU,CAAC,MAAM,EAAE;AAClB,QAAA,QAAQ,EAAE,6BAA6B;AACvC,QAAA,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,UAAU,CAAC,KAAK,EAAE;AACjB,QAAA,QAAQ,EAAE,yBAAyB;AACnC,QAAA,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,MAAM,CAAC,eAAe,EAAE;AACvB,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,QAAQ,EACN,4EAA4E;AAC/E,KAAA,CAAC,CAAC;AACP,CAAC,EACD,IAAI,I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