Skip to content
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

Closed
wants to merge 10 commits into from
Closed

Conversation

yuit
Copy link
Contributor

@yuit yuit commented Sep 16, 2015

Address #4211

// (()=>this); // No Error
// super();
// }
if ((<ConstructorDeclaration>container).hasSeenSuperBeforeThis === undefined) {
Copy link
Member

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?

Copy link
Contributor

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

Yui T added 5 commits October 6, 2015 19:46
@yuit
Copy link
Contributor Author

yuit commented Oct 9, 2015

@rbuckton @vladima Let me know if there are any more comments

@@ -6577,6 +6577,21 @@ namespace ts {
let container = getThisContainer(node, /* includeArrowFunctions */ true);
let needToCaptureLexicalThis = false;


Copy link
Member

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.

Copy link
Contributor Author

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

@yuit
Copy link
Contributor Author

yuit commented Nov 30, 2015

Close this PR in flavor of #5833.

@yuit yuit closed this Nov 30, 2015
@yuit yuit deleted the errorsuperbeforethis branch December 2, 2015 04:49
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
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.

4 participants