mlogjs 0.4.6 → 0.4.8

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.
@@ -1,17 +1,17 @@
1
1
  import { BaseValue } from ".";
2
- import { EMutability, IOwnedValue, IScope, IValue, TValueInstructions } from "../types";
2
+ import { EMutability, IScope, IValue, TEOutput, 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
+ name: string;
9
9
  mutability: EMutability;
10
- constructor(scope: IScope);
10
+ constructor(name: string, mutability?: EMutability);
11
+ static from(scope: IScope, out?: TEOutput, mutability?: EMutability): StoreValue;
12
+ static out(scope: IScope, out?: TEOutput, mutability?: EMutability): IValue;
11
13
  typeof(): TValueInstructions;
12
14
  "="(scope: IScope, value: IValue): TValueInstructions;
13
15
  eval(_scope: IScope): TValueInstructions;
14
- consume(_scope: IScope): TValueInstructions;
15
- ensureOwned(): asserts this is IOwnedValue;
16
16
  toString(): string;
17
17
  }
@@ -1,13 +1,12 @@
1
- import { EMutability, IScope, IValue, IValueOperators, IValueOwner, TValueInstructions } from "../types";
1
+ import { EMutability, IScope, IValue, IValueOperators, TEOutput, TValueInstructions } from "../types";
2
2
  export declare class VoidValue implements IValue {
3
- owner: IValueOwner | null;
3
+ name?: string;
4
4
  mutability: EMutability;
5
5
  macro: boolean;
6
- eval(_scope: IScope): TValueInstructions;
7
- consume(_scope: IScope): TValueInstructions<IValue>;
8
- call(_scope: IScope, _args: IValue[]): TValueInstructions<IValue | null>;
6
+ eval(_scope: IScope, _out?: TEOutput): TValueInstructions;
7
+ call(_scope: IScope, _args: IValue[], _out?: TEOutput): TValueInstructions<IValue | null>;
9
8
  get(_scope: IScope, _name: IValue): TValueInstructions;
10
- ensureOwned(): void;
9
+ paramOuts(): readonly IValue[] | undefined;
11
10
  toString(): string;
12
11
  }
13
12
  export interface VoidValue extends IValueOperators {
@@ -5,3 +5,4 @@ export * from "./StoreValue";
5
5
  export * from "./ObjectValue";
6
6
  export * from "./SenseableValue";
7
7
  export * from "./DestructuringValue";
8
+ export * from "./LazyValue";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlogjs",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Compiler that compiles Javascript to Mindustry Logic Code.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -1,27 +0,0 @@
1
- import { IScope, IValue, IValueOwner } from "../types";
2
- export interface IValueOwnerParams<T extends IValue> {
3
- scope: IScope;
4
- constant?: boolean;
5
- value: T;
6
- /** The identifier of the variable that `this` represents */
7
- identifier?: string;
8
- /** The name that the variable will have during transpilation to mlog */
9
- name?: string;
10
- }
11
- export declare class ValueOwner<T extends IValue = IValue> implements IValueOwner<T> {
12
- scope: IScope;
13
- constant: boolean;
14
- value: T;
15
- owned: Set<T>;
16
- identifier?: string;
17
- name: string;
18
- persistent: boolean;
19
- /**
20
- * Creates a new `ValueOwner`, if `value` is already owned,
21
- * `this` will be aliased to `value`, else `this` will own `value`
22
- */
23
- constructor({ scope, constant, value, identifier, name, }: IValueOwnerParams<T>);
24
- own(target: T): void;
25
- replace(target: T): void;
26
- moveInto(owner: IValueOwner<T>): void;
27
- }