Skip bound method assignments in JS declaration emit#4331
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix behavior difference with method reassignments in constructor
Skip bound method assignments in JS declaration emit
Jun 16, 2026
weswigham
reviewed
Jun 16, 2026
| expandoHosts map[ast.NodeId]*ast.Node // store the result of transforming expando hosts so they can be inserted later if the host is actually referenced | ||
| expandoMembers map[ast.NodeId][]*ast.Node // store any found expando _members_ after transforming them so *if* the host is referenced, they can be emitted alongside it | ||
| seenProperties collections.Set[*ast.Node] | ||
| seenPropertyNames collections.Set[string] |
Member
There was a problem hiding this comment.
@copilot rethink this - since collectThisPropertyAssignments already has a seen table it prepopulates with non-this. class members, rather than having a second (incorrectly scoped) table, just change the map key from *ast.Node directly to a composite key that contains either the string property name (for named members) or the node (for dynamically named members).
Member
There was a problem hiding this comment.
And include a bit for instance vs static in said composite key - no need to use string concatenation.
Contributor
Author
There was a problem hiding this comment.
Addressed in 9cf60b3 by using a composite seen key with property name/node plus instance/static state.
Co-authored-by: weswigham <2932786+weswigham@users.noreply.github.com>
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.
JS declaration emit was synthesizing an extra property signature for constructor-bound methods, producing both a property and method declaration for the same class member.
Declaration emit
this.x = ...before deciding whether to synthesize a JS property declaration.Regression coverage