tla-ts 0.0.3-dev.2032e26 → 0.0.3-dev.252cf06

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,15 +1,15 @@
1
- import type {
2
- Bound,
3
- Definition,
4
- Expression,
5
- Instance,
6
- Module,
7
- OperatorParam,
8
- Selector,
9
- SourceLocation,
1
+ import {
2
+ getChildren,
3
+ type Bound,
4
+ type Definition,
5
+ type Expression,
6
+ type Instance,
7
+ type Module,
8
+ type OperatorParam,
9
+ type Selector,
10
+ type SourceLocation,
10
11
  } from "./ast";
11
12
  import { TlaSyntaxError } from "./errors";
12
- import { getChildren } from "./evaluate";
13
13
  import { getSourceName, mapChildren, mapDefinition } from "./instances";
14
14
  import { getArity, getBoundNames, getPatternNames, LOCAL_RESOLUTION } from "./resolve";
15
15
 
package/src/successors.ts CHANGED
@@ -1,4 +1,10 @@
1
- import type { Bound, Definition, Expression } from "./ast";
1
+ import {
2
+ getChildren,
3
+ isLocallyResolved,
4
+ type Bound,
5
+ type Definition,
6
+ type Expression,
7
+ } from "./ast";
2
8
  import { getReadVariables } from "./dependencies";
3
9
  import { TlaEvaluationError, UNEXPECTED_EXCEPTION } from "./errors";
4
10
  import { EXIT_STATUS, setExitCode } from "./exit-codes";
@@ -14,14 +20,12 @@ import {
14
20
  expectBoolean,
15
21
  forEachBinding,
16
22
  getBoundsDomain,
17
- getChildren,
18
23
  getDefinition,
19
24
  getEnumeratedElements,
20
25
  getReevaluatedDefinitions,
21
26
  lookupScope,
22
27
  resolveApplyOperator,
23
28
  resolveGlobalOperator,
24
- isLocallyResolved,
25
29
  type Context,
26
30
  type Environment,
27
31
  type Scope,
@@ -916,18 +920,19 @@ export const isEnabled = (expression: Expression, context: Context): boolean =>
916
920
  );
917
921
  }
918
922
  const environment = context.environment;
919
- const found = { value: false };
923
+ const run: Run = { environment, isInit: false, current: state, isStopped: false };
924
+ // TLC stops computing ENABLED at the first successor, so it skips the rest of the action.
920
925
  getRunner(expression, environment, false)(
921
- { environment, isInit: false, current: state, isStopped: false },
926
+ run,
922
927
  context.scope,
923
928
  getEmptyState(environment),
924
929
  undefined,
925
930
  false,
926
931
  () => {
927
- found.value = true;
932
+ run.isStopped = true;
928
933
  },
929
934
  );
930
- return found.value;
935
+ return run.isStopped;
931
936
  };
932
937
 
933
938
  export const forEachInitialState = (
package/src/tlc-ext.ts CHANGED
@@ -10,16 +10,8 @@ import {
10
10
  } from "./builtins";
11
11
  import { TlaEvaluationError, TlaModuleError, TlaUnsupportedError } from "./errors";
12
12
  import { getTlcFingerprint } from "./tlc-random";
13
- import {
14
- evaluate,
15
- expectBoolean,
16
- getChildren,
17
- getDefinition,
18
- isLocallyResolved,
19
- type Builtin,
20
- type Environment,
21
- } from "./evaluate";
22
- import type { Definition, Expression } from "./ast";
13
+ import { evaluate, expectBoolean, getDefinition, type Builtin, type Environment } from "./evaluate";
14
+ import { getChildren, isLocallyResolved, type Definition, type Expression } from "./ast";
23
15
  import type { TraceStep } from "./check";
24
16
  import {
25
17
  getNamedRegisters,