Skip to content

Connect prototype members across files - #480

Open
eseliger wants to merge 2 commits into
mainfrom
prototype-members
Open

eseliger wants to merge 2 commits into
mainfrom
prototype-members

Conversation

@eseliger

@eseliger eseliger commented Aug 22, 2026

Copy link
Copy Markdown
Member

Treat object literals assigned to Constructor.prototype as members of the constructor when generating SCIP symbols. This gives the prototype object, method declarations, function-valued properties, and data properties stable constructor-owned symbols that connect to references in other files without dangling intermediate locals.

Fixes #409.

@eseliger eseliger changed the title prototype members Connect prototype members across files Aug 22, 2026
@eseliger
eseliger marked this pull request as ready for review August 22, 2026 23:32
@christoph-sg
christoph-sg force-pushed the prototype-members branch 2 times, most recently from c2f4bea to cc77479 Compare September 11, 2026 09:16
Base automatically changed from shorthand-properties to main September 11, 2026 09:44
@christoph-sg

Copy link
Copy Markdown
Contributor

This appears to cover only whole-object replacement (C.prototype = { ... }). The equally common C.prototype.method = function () {} and C.prototype.value = … forms still fall back to local symbols. Could we add cross-file snapshot cases for direct dot-property assignment and Object.assign(C.prototype, …)?

I think if we're doing this, we should also cover those common variants to avoid surprises (the first 5 in this table)

Pattern Covered?
C.prototype = { method: function () {} } Yes
C.prototype.method = function () {} No
C.prototype.value = 1 No
C.prototype["method"] = fn No
C["prototype"] = { method() {} } No
Object.assign(C.prototype, { method() {} }) No
Object.defineProperty(C.prototype, "method", …) No
C.prototype = Object.create(Base.prototype, …) No

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.

Cross file definition not connected

2 participants