Conversation
Keep each native constructor's builder, field readers, and condition together. Check the registry literal with satisfies before Object.setPrototypeOf and adapt the three JS emitter lookups while preserving templates and diagnostics.
ramonzx6
force-pushed
the
refactor/native-constructor-descriptors
branch
from
September 21, 2026 08:06
3d2a22f to
822ee1f
Compare
ramonzx6
marked this pull request as ready for review
September 21, 2026 08:06
VictorTaelin
pushed a commit
that referenced
this pull request
Sep 21, 2026
The builder, the field readers and the match conditions of a native constructor sit in one record instead of three parallel maps. Emission is byte-identical. (PR #952)
Contributor
|
Merged into 2.0.25 under your authorship, thank you: one record per native constructor, byte-identical emission, −48 ttok. Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself. |
Phylliida
pushed a commit
to Phylliida/bend
that referenced
this pull request
Sep 27, 2026
The builder, the field readers and the match conditions of a native constructor sit in one record instead of three parallel maps. Emission is byte-identical. (PR bendlang#952)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why the change
The JavaScript emitter stores native constructor builders, field readers, and match conditions in separate maps. This repeats constructor names and makes additions or renames easy to apply inconsistently. Keeping these related operations together makes each constructor's encoding easier to review and maintain.
What changed
Replace the parallel maps in
bend2/comp.tswith one descriptor per native constructor and update the lookups for construction, field access, and matching. Each descriptor requires a builder, with optional readers and conditions;satisfieschecks the registry literal beforeObject.setPrototypeOf. Generated expressions, the outer null prototype, existing diagnostics, and field-count checks remain unchanged.Validation