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.
Files changed (250) hide show
  1. package/dist/{types/Compiler.d.ts → Compiler.d.ts} +17 -4
  2. package/dist/CompilerError.d.ts +33 -0
  3. package/dist/{types/Scope.d.ts → Scope.d.ts} +0 -0
  4. package/dist/assertions.d.ts +28 -0
  5. package/dist/bin.cjs +7 -14
  6. package/dist/{types/bin.d.ts → bin.d.ts} +0 -0
  7. package/dist/{types/handlers → handlers}/BlockStatement.d.ts +0 -0
  8. package/dist/{types/handlers → handlers}/CallExpression.d.ts +1 -0
  9. package/dist/{types/handlers → handlers}/File.d.ts +0 -0
  10. package/dist/{types/handlers → handlers}/ForStatement.d.ts +0 -0
  11. package/dist/{types/handlers → handlers}/Function.d.ts +0 -0
  12. package/dist/{types/handlers → handlers}/Identifier.d.ts +0 -0
  13. package/dist/{types/handlers → handlers}/IfStatement.d.ts +0 -0
  14. package/dist/{types/handlers → handlers}/Literal.d.ts +0 -0
  15. package/dist/{types/handlers → handlers}/Object.d.ts +0 -0
  16. package/dist/{types/handlers → handlers}/OperationExpressions.d.ts +0 -0
  17. package/dist/{types/handlers → handlers}/Program.d.ts +0 -0
  18. package/dist/{types/handlers → handlers}/Statements.d.ts +0 -0
  19. package/dist/handlers/SwitchStatement.d.ts +2 -0
  20. package/dist/{types/handlers → handlers}/TemplateExpression.d.ts +0 -0
  21. package/dist/{types/handlers → handlers}/Typescript.d.ts +0 -0
  22. package/dist/{types/handlers → handlers}/VariableDeclaration.d.ts +0 -0
  23. package/dist/{types/handlers → handlers}/WhileStatement.d.ts +0 -0
  24. package/dist/{types/handlers → handlers}/index.d.ts +1 -0
  25. package/dist/index.cjs +1282 -514
  26. package/dist/{types/index.d.ts → index.d.ts} +1 -0
  27. package/dist/index.mjs +1282 -514
  28. package/dist/{types/initScope.d.ts → initScope.d.ts} +0 -0
  29. package/dist/{types/instructions → instructions}/AddressResolver.d.ts +0 -0
  30. package/dist/{types/instructions → instructions}/ControlInstructions.d.ts +3 -1
  31. package/dist/{types/instructions → instructions}/EndInstruction.d.ts +0 -0
  32. package/dist/{types/instructions → instructions}/InstructionBase.d.ts +5 -1
  33. package/dist/{types/instructions → instructions}/JumpInstruction.d.ts +1 -0
  34. package/dist/{types/instructions → instructions}/OperationInstruction.d.ts +0 -0
  35. package/dist/{types/instructions → instructions}/SetCounterInstruction.d.ts +0 -0
  36. package/dist/{types/instructions → instructions}/SetInstruction.d.ts +0 -0
  37. package/dist/{types/instructions → instructions}/ZeroSpaceInstruction.d.ts +0 -0
  38. package/dist/{types/instructions → instructions}/index.d.ts +0 -0
  39. package/dist/macros/Asm.d.ts +4 -0
  40. package/dist/{types/macros → macros}/Function.d.ts +2 -2
  41. package/dist/macros/GetGlobal.d.ts +5 -0
  42. package/dist/{types/macros → macros}/Math.d.ts +1 -2
  43. package/dist/{types/macros → macros}/Memory.d.ts +1 -2
  44. package/dist/{types/macros → macros}/Namespace.d.ts +1 -4
  45. package/dist/{types/macros → macros}/Other.d.ts +1 -2
  46. package/dist/macros/commands/ApplyStatus.d.ts +4 -0
  47. package/dist/macros/commands/Control.d.ts +4 -0
  48. package/dist/macros/commands/Cutscene.d.ts +4 -0
  49. package/dist/macros/commands/Draw.d.ts +4 -0
  50. package/dist/{types/macros → macros}/commands/DrawFlush.d.ts +1 -2
  51. package/dist/{types/macros → macros}/commands/End.d.ts +1 -2
  52. package/dist/macros/commands/Explosion.d.ts +4 -0
  53. package/dist/macros/commands/Fetch.d.ts +4 -0
  54. package/dist/macros/commands/FlushMessage.d.ts +4 -0
  55. package/dist/macros/commands/GetBlock.d.ts +4 -0
  56. package/dist/macros/commands/GetFlag.d.ts +4 -0
  57. package/dist/{types/macros → macros}/commands/GetLink.d.ts +1 -2
  58. package/dist/macros/commands/Lookup.d.ts +4 -0
  59. package/dist/macros/commands/PackColor.d.ts +4 -0
  60. package/dist/{types/macros → macros}/commands/Print.d.ts +1 -2
  61. package/dist/{types/macros → macros}/commands/PrintFlush.d.ts +1 -2
  62. package/dist/macros/commands/Radar.d.ts +6 -0
  63. package/dist/{types/macros → macros}/commands/Sensor.d.ts +1 -2
  64. package/dist/macros/commands/SetBlock.d.ts +4 -0
  65. package/dist/macros/commands/SetFlag.d.ts +4 -0
  66. package/dist/macros/commands/SetRate.d.ts +4 -0
  67. package/dist/macros/commands/SetRule.d.ts +4 -0
  68. package/dist/macros/commands/SpawnUnit.d.ts +4 -0
  69. package/dist/macros/commands/SpawnWave.d.ts +4 -0
  70. package/dist/macros/commands/Stop.d.ts +4 -0
  71. package/dist/{types/macros → macros}/commands/UnitBind.d.ts +1 -2
  72. package/dist/macros/commands/UnitControl.d.ts +4 -0
  73. package/dist/macros/commands/UnitLocate.d.ts +4 -0
  74. package/dist/{types/macros → macros}/commands/UnitRadar.d.ts +1 -2
  75. package/dist/{types/macros → macros}/commands/Wait.d.ts +1 -2
  76. package/dist/macros/commands/index.d.ts +30 -0
  77. package/dist/{types/macros → macros}/index.d.ts +0 -0
  78. package/dist/macros/util.d.ts +17 -0
  79. package/dist/{types/operators.d.ts → operators.d.ts} +0 -0
  80. package/dist/{types/types.d.ts → types.d.ts} +14 -1
  81. package/dist/utils.d.ts +47 -0
  82. package/dist/{types/values → values}/BaseValue.d.ts +3 -2
  83. package/dist/{types/values → values}/DestructuringValue.d.ts +1 -1
  84. package/dist/{types/values → values}/FunctionValue.d.ts +4 -5
  85. package/dist/{types/values → values}/LiteralValue.d.ts +3 -2
  86. package/dist/{types/values → values}/ObjectValue.d.ts +3 -3
  87. package/dist/{types/values → values}/SenseableValue.d.ts +0 -0
  88. package/dist/{types/values → values}/StoreValue.d.ts +4 -2
  89. package/dist/{types/values → values}/ValueOwner.d.ts +0 -0
  90. package/dist/{types/values → values}/VoidValue.d.ts +0 -2
  91. package/dist/{types/values → values}/index.d.ts +0 -0
  92. package/lib/commands.d.ts +847 -420
  93. package/lib/eslib/lib.es2015.core.d.ts +3 -0
  94. package/lib/globals.d.ts +331 -19
  95. package/lib/helpers.d.ts +14 -0
  96. package/lib/kinds.d.ts +3 -2
  97. package/lib/memory.d.ts +1 -1
  98. package/lib/traits.d.ts +6 -0
  99. package/lib/util.d.ts +16 -0
  100. package/package.json +16 -17
  101. package/build/Compiler.js +0 -105
  102. package/build/Compiler.js.map +0 -1
  103. package/build/CompilerError.js +0 -11
  104. package/build/CompilerError.js.map +0 -1
  105. package/build/Scope.js +0 -71
  106. package/build/Scope.js.map +0 -1
  107. package/build/bin.js +0 -75
  108. package/build/bin.js.map +0 -1
  109. package/build/handlers/BlockStatement.js +0 -14
  110. package/build/handlers/BlockStatement.js.map +0 -1
  111. package/build/handlers/CallExpression.js +0 -20
  112. package/build/handlers/CallExpression.js.map +0 -1
  113. package/build/handlers/File.js +0 -9
  114. package/build/handlers/File.js.map +0 -1
  115. package/build/handlers/ForStatement.js +0 -32
  116. package/build/handlers/ForStatement.js.map +0 -1
  117. package/build/handlers/Function.js +0 -47
  118. package/build/handlers/Function.js.map +0 -1
  119. package/build/handlers/Identifier.js +0 -8
  120. package/build/handlers/Identifier.js.map +0 -1
  121. package/build/handlers/IfStatement.js +0 -25
  122. package/build/handlers/IfStatement.js.map +0 -1
  123. package/build/handlers/Literal.js +0 -15
  124. package/build/handlers/Literal.js.map +0 -1
  125. package/build/handlers/Object.js +0 -55
  126. package/build/handlers/Object.js.map +0 -1
  127. package/build/handlers/OperationExpressions.js +0 -38
  128. package/build/handlers/OperationExpressions.js.map +0 -1
  129. package/build/handlers/Program.js +0 -9
  130. package/build/handlers/Program.js.map +0 -1
  131. package/build/handlers/Statements.js +0 -30
  132. package/build/handlers/Statements.js.map +0 -1
  133. package/build/handlers/TemplateExpression.js +0 -18
  134. package/build/handlers/TemplateExpression.js.map +0 -1
  135. package/build/handlers/VariableDeclaration.js +0 -72
  136. package/build/handlers/VariableDeclaration.js.map +0 -1
  137. package/build/handlers/WhileStatement.js +0 -23
  138. package/build/handlers/WhileStatement.js.map +0 -1
  139. package/build/handlers/index.js +0 -32
  140. package/build/handlers/index.js.map +0 -1
  141. package/build/index.js +0 -8
  142. package/build/index.js.map +0 -1
  143. package/build/initScope.js +0 -40
  144. package/build/initScope.js.map +0 -1
  145. package/build/instructions/AddressResolver.js +0 -31
  146. package/build/instructions/AddressResolver.js.map +0 -1
  147. package/build/instructions/ControlInstructions.js +0 -23
  148. package/build/instructions/ControlInstructions.js.map +0 -1
  149. package/build/instructions/EndInstruction.js +0 -11
  150. package/build/instructions/EndInstruction.js.map +0 -1
  151. package/build/instructions/InstructionBase.js +0 -21
  152. package/build/instructions/InstructionBase.js.map +0 -1
  153. package/build/instructions/JumpInstruction.js +0 -22
  154. package/build/instructions/JumpInstruction.js.map +0 -1
  155. package/build/instructions/OperationInstruction.js +0 -11
  156. package/build/instructions/OperationInstruction.js.map +0 -1
  157. package/build/instructions/SetCounterInstruction.js +0 -11
  158. package/build/instructions/SetCounterInstruction.js.map +0 -1
  159. package/build/instructions/SetInstruction.js +0 -11
  160. package/build/instructions/SetInstruction.js.map +0 -1
  161. package/build/instructions/ZeroSpaceInstruction.js +0 -11
  162. package/build/instructions/ZeroSpaceInstruction.js.map +0 -1
  163. package/build/instructions/index.js +0 -26
  164. package/build/instructions/index.js.map +0 -1
  165. package/build/macros/Building.js +0 -89
  166. package/build/macros/Building.js.map +0 -1
  167. package/build/macros/Function.js +0 -20
  168. package/build/macros/Function.js.map +0 -1
  169. package/build/macros/Math.js +0 -62
  170. package/build/macros/Math.js.map +0 -1
  171. package/build/macros/Memory.js +0 -63
  172. package/build/macros/Memory.js.map +0 -1
  173. package/build/macros/Namespace.js +0 -111
  174. package/build/macros/Namespace.js.map +0 -1
  175. package/build/macros/Other.js +0 -21
  176. package/build/macros/Other.js.map +0 -1
  177. package/build/macros/RawValue.js +0 -17
  178. package/build/macros/RawValue.js.map +0 -1
  179. package/build/macros/commands/Control.js +0 -26
  180. package/build/macros/commands/Control.js.map +0 -1
  181. package/build/macros/commands/Draw.js +0 -40
  182. package/build/macros/commands/Draw.js.map +0 -1
  183. package/build/macros/commands/DrawFlush.js +0 -18
  184. package/build/macros/commands/DrawFlush.js.map +0 -1
  185. package/build/macros/commands/GetLink.js +0 -25
  186. package/build/macros/commands/GetLink.js.map +0 -1
  187. package/build/macros/commands/Lookup.js +0 -25
  188. package/build/macros/commands/Lookup.js.map +0 -1
  189. package/build/macros/commands/Print.js +0 -18
  190. package/build/macros/commands/Print.js.map +0 -1
  191. package/build/macros/commands/PrintFlush.js +0 -18
  192. package/build/macros/commands/PrintFlush.js.map +0 -1
  193. package/build/macros/commands/Radar.js +0 -65
  194. package/build/macros/commands/Radar.js.map +0 -1
  195. package/build/macros/commands/Sensor.js +0 -21
  196. package/build/macros/commands/Sensor.js.map +0 -1
  197. package/build/macros/commands/UnitBind.js +0 -18
  198. package/build/macros/commands/UnitBind.js.map +0 -1
  199. package/build/macros/commands/UnitControl.js +0 -73
  200. package/build/macros/commands/UnitControl.js.map +0 -1
  201. package/build/macros/commands/UnitLocate.js +0 -76
  202. package/build/macros/commands/UnitLocate.js.map +0 -1
  203. package/build/macros/commands/UnitRadar.js +0 -48
  204. package/build/macros/commands/UnitRadar.js.map +0 -1
  205. package/build/macros/commands/Wait.js +0 -19
  206. package/build/macros/commands/Wait.js.map +0 -1
  207. package/build/macros/commands/index.js +0 -33
  208. package/build/macros/commands/index.js.map +0 -1
  209. package/build/macros/index.js +0 -40
  210. package/build/macros/index.js.map +0 -1
  211. package/build/operators.js +0 -102
  212. package/build/operators.js.map +0 -1
  213. package/build/types.js +0 -28
  214. package/build/types.js.map +0 -1
  215. package/build/utils.js +0 -18
  216. package/build/utils.js.map +0 -1
  217. package/build/values/BaseValue.js +0 -112
  218. package/build/values/BaseValue.js.map +0 -1
  219. package/build/values/FunctionValue.js +0 -116
  220. package/build/values/FunctionValue.js.map +0 -1
  221. package/build/values/LiteralValue.js +0 -89
  222. package/build/values/LiteralValue.js.map +0 -1
  223. package/build/values/ObjectValue.js +0 -55
  224. package/build/values/ObjectValue.js.map +0 -1
  225. package/build/values/StoreValue.js +0 -32
  226. package/build/values/StoreValue.js.map +0 -1
  227. package/build/values/TempValue.js +0 -78
  228. package/build/values/TempValue.js.map +0 -1
  229. package/build/values/VoidValue.js +0 -32
  230. package/build/values/VoidValue.js.map +0 -1
  231. package/build/values/index.js +0 -23
  232. package/build/values/index.js.map +0 -1
  233. package/dist/bin.cjs.map +0 -1
  234. package/dist/index.cjs.map +0 -1
  235. package/dist/index.mjs.map +0 -1
  236. package/dist/types/CompilerError.d.ts +0 -9
  237. package/dist/types/macros/Building.d.ts +0 -10
  238. package/dist/types/macros/Entities.d.ts +0 -11
  239. package/dist/types/macros/GetGlobal.d.ts +0 -5
  240. package/dist/types/macros/RawValue.d.ts +0 -5
  241. package/dist/types/macros/commands/Control.d.ts +0 -5
  242. package/dist/types/macros/commands/Draw.d.ts +0 -5
  243. package/dist/types/macros/commands/Lookup.d.ts +0 -5
  244. package/dist/types/macros/commands/Radar.d.ts +0 -7
  245. package/dist/types/macros/commands/UnitControl.d.ts +0 -5
  246. package/dist/types/macros/commands/UnitLocate.d.ts +0 -5
  247. package/dist/types/macros/commands/index.d.ts +0 -15
  248. package/dist/types/utils.d.ts +0 -30
  249. package/dist/types/values/StackValue.d.ts +0 -16
  250. package/dist/types/values/TempValue.d.ts +0 -19
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
  }
@@ -1,9 +1,13 @@
1
- import { IInstruction, IValue } from "../types";
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;
@@ -11,5 +11,6 @@ export declare enum EJumpKind {
11
11
  Always = "always"
12
12
  }
13
13
  export declare class JumpInstruction extends InstructionBase {
14
+ address: IBindableValue;
14
15
  constructor(address: IBindableValue, kind: EJumpKind, left?: IValue | null, right?: IValue | null);
15
16
  }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "./Function";
2
+ export declare class Asm extends MacroFunction<null> {
3
+ constructor();
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;
@@ -0,0 +1,5 @@
1
+ import { EMutability } from "../types";
2
+ import { MacroFunction } from "./Function";
3
+ export declare class GetGlobal extends MacroFunction {
4
+ constructor(mutability: EMutability);
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,12 +5,9 @@ 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);
12
12
  }
13
- export declare class UCommandsNamespace extends NamespaceMacro {
14
- constructor(scope: IScope);
15
- }
16
13
  export {};
@@ -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
  }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class ApplyStatus extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class Control extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class Cutscene extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class Draw extends ObjectValue {
3
+ constructor();
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
  }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "../Function";
2
+ export declare class Explosion extends MacroFunction<null> {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class Fetch extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class FlushMessage extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class GetBlock extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "../Function";
2
+ export declare class GetFlag extends MacroFunction {
3
+ constructor();
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
  }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class Lookup extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "../Function";
2
+ export declare class PackColor extends MacroFunction {
3
+ constructor();
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
  }
@@ -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
+ }
@@ -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
  }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class SetBlock extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "../Function";
2
+ export declare class SetFlag extends MacroFunction<null> {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "../Function";
2
+ export declare class SetRate extends MacroFunction<null> {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class SetRule extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "../Function";
2
+ export declare class SpawnUnit extends MacroFunction {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "../Function";
2
+ export declare class SpawnWave extends MacroFunction<null> {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { MacroFunction } from "../Function";
2
+ export declare class Stop extends MacroFunction<null> {
3
+ constructor();
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
  }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class UnitControl extends ObjectValue {
3
+ constructor();
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ObjectValue } from "../../values";
2
+ export declare class UnitLocate extends ObjectValue {
3
+ constructor();
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
  }
@@ -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
  /**
@@ -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 { 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
- ensureOwned(): asserts this is IOwnedValue;
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(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;
@@ -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, 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][]): 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
  }
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