Skip to content

refactoring - #71

Merged
larshp merged 4 commits into
mainfrom
hvam/foo0707
Jul 7, 2026
Merged

refactoring#71
larshp merged 4 commits into
mainfrom
hvam/foo0707

Conversation

@larshp

@larshp larshp commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@larshp larshp changed the title wip refactoring Jul 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the mini JavaScript engine by replacing magic-number value-type tags with named constants and extracting several built-in behaviors (globals + array methods) into dedicated classes to simplify the core interpreter logic.

Changes:

  • Introduces zif_mjs=>c_type_* constants for runtime value typing (undefined/number/string/bool/function/null/object/array/regex/getter).
  • Extracts built-ins into zcl_mjs_builtins (Boolean/RegExp/JSON.stringify/console.log/Object.keys/Object.defineProperty/Date.now/Set.has/new Set).
  • Extracts array method handling into zcl_mjs_arr_methods and centralizes ToPrimitive coercion with zcl_mjs=>to_primitive.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/zif_mjs.intf.abap Adds named constants for runtime value-type tags.
src/zcl_mjs.clas.abap Refactors interpreter to use constants; extracts built-ins/array methods; adds to_primitive; makes call_function public for callbacks.
src/zcl_mjs_val.clas.abap Updates value boxing/conversion helpers to use c_type_* constants.
src/zcl_mjs_env.clas.abap Uses c_type_undefined for missing bindings.
src/zcl_mjs_builtins.clas.xml Adds class metadata for new built-ins helper class.
src/zcl_mjs_builtins.clas.abap Implements extracted built-ins (Boolean/RegExp/JSON/console/Date/Object/Set helpers).
src/types/zcl_mjs_string.clas.abap Replaces regex/array magic numbers with c_type_* constants.
src/types/zcl_mjs_json.clas.abap Replaces magic numbers with c_type_* constants in JSON stringify.
src/types/zcl_mjs_arr_methods.clas.xml Adds class metadata for new array-methods helper class.
src/types/zcl_mjs_arr_methods.clas.abap Implements extracted array methods (push/map/find/filter/splice/sort).
package.json Updates @abaplint/* dependency versions.
package-lock.json Locks updated @abaplint/* dependency versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/zcl_mjs.clas.abap
Comment thread src/zcl_mjs_builtins.clas.abap
@larshp
larshp merged commit 3777d8a into main Jul 7, 2026
5 checks passed
@larshp
larshp deleted the hvam/foo0707 branch July 17, 2026 06:36
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.

2 participants