Skip to content

Allow super references to constructor function methods#26482

Merged
sandersn merged 2 commits into
masterfrom
js/allow-super-references-to-ctor-func-methods
Aug 16, 2018
Merged

Allow super references to constructor function methods#26482
sandersn merged 2 commits into
masterfrom
js/allow-super-references-to-ctor-func-methods

Conversation

@sandersn
Copy link
Copy Markdown
Member

Previously, they were mistakenly treated as private because of a check that required all super property accesses (like super.x()) to be references to a MethodDeclaration or MethodSignature. This change also allows PrototypeProperty special assignment kinds.

Fixes #26475

Previously, they were mistakenly treated as private because of a check
that required all super property accesses (like `super.x()`) to be
references to a MethodDeclaration or MethodSignature. This change also
allows PrototypeProperty special assignment kinds.
@sandersn sandersn requested review from a user and RyanCavanaugh August 15, 2018 22:54
Comment thread src/compiler/checker.ts Outdated
@@ -17866,6 +17866,12 @@ namespace ts {

function symbolHasNonMethodDeclaration(symbol: Symbol) {
return forEachProperty(symbol, prop => {
Copy link
Copy Markdown

@ghost ghost Aug 16, 2018

Choose a reason for hiding this comment

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

Replacing this function body with return !!forEachProperty(symbol, prop => !(prop.flags & SymbolFlags.Method)); seems to pass all tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nice! That's a much better solution.

@sandersn
Copy link
Copy Markdown
Member Author

sandersn commented Aug 16, 2018

Oops. Uh, I merged @Andy-MS' much better solution into master by mistake. I'll cherry-pick it back into this review so I can get the tests as well.

Edit: Here is the commit 56f8256

@sandersn sandersn merged commit 75071a2 into master Aug 16, 2018
@sandersn sandersn deleted the js/allow-super-references-to-ctor-func-methods branch August 16, 2018 16:20
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant