Skip to content

feat: scoped variables - #16

Merged
dermitzos merged 21 commits into
mainfrom
feat/object-variables
Mar 26, 2026
Merged

dermitzos merged 21 commits into
mainfrom
feat/object-variables

Conversation

@dermitzos

Copy link
Copy Markdown
Contributor

This pull request introduces a significant refactor to the Arcscript interpreter's variable management system, moving from plain JavaScript objects to an ArcscriptVariable class for handling variable state, scoping, and changes. This change affects core interpreter logic, variable access, mutability, and how tests are structured. Additionally, it updates dependencies to include TypeScript 5.9.3.

Arcscript variable management refactor:

  • Introduced a new ArcscriptVariable class to encapsulate variable state, including value, default value, type, scope, and change tracking (TypeScript/src/ArcscriptVariable.ts).
  • Refactored ArcscriptState to use ArcscriptVariable instances for both global and scoped variables, replacing previous plain object structures and related logic (TypeScript/src/ArcscriptState.ts). [1] [2] [3]
  • Updated variable reset and value management in ArcscriptFunctions to operate on ArcscriptVariable instances, simplifying logic and improving type safety (TypeScript/src/ArcscriptFunctions.ts). [1] [2] [3]

Testing and type improvements:

  • Refactored all interpreter tests to use the new variable state structure and updated test cases to expect the new change-tracking format, removing old utility functions and adapting to the new API (TypeScript/src/__tests__/antlr4.interpreter.test.ts). [1] [2] [3] [4] [5] [6] [7]

Dependency updates:

  • Added TypeScript 5.9.3 as a dependency and updated the lockfile accordingly (TypeScript/package.json, TypeScript/pnpm-lock.yaml). [1] [2]

@pkg-pr-new

pkg-pr-new Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@arcweave/arcscript@16

commit: 514576a

@dermitzos
dermitzos force-pushed the feat/object-variables branch from 6aa6b42 to ecfc319 Compare March 19, 2026 12:13
@dermitzos
dermitzos force-pushed the feat/object-variables branch from ecfc319 to 514576a Compare March 26, 2026 12:21
@dermitzos
dermitzos merged commit 1eea348 into main Mar 26, 2026
6 checks passed
@dermitzos
dermitzos deleted the feat/object-variables branch March 26, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant