-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when accessing this before super #4814
Conversation
// (()=>this); // No Error | ||
// super(); | ||
// } | ||
if ((<ConstructorDeclaration>container).hasSeenSuperBeforeThis === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to make this a value on NodeCheckFlags
, rather than a property on ConstructorDeclaration
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to this. in general storing anything on nodes in the checker is not a good practice
Conflicts: src/compiler/checker.ts src/compiler/diagnosticInformationMap.generated.ts src/compiler/types.ts
@@ -6577,6 +6577,21 @@ namespace ts { | |||
let container = getThisContainer(node, /* includeArrowFunctions */ true); | |||
let needToCaptureLexicalThis = false; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we special case this
before super
, or should we consider a more general purpose approach to TDZ that encompasses both this
before super
and use before declaration for let
and const
? I imagine there may be more cases like this in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you though I think that will need to be a separate change. Here is a issue #5232
Close this PR in flavor of #5833. |
Address #4211