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

Missing super identifier #50

Closed
nzakas opened this issue Mar 8, 2015 · 11 comments
Closed

Missing super identifier #50

nzakas opened this issue Mar 8, 2015 · 11 comments
Labels

Comments

@nzakas
Copy link
Contributor

nzakas commented Mar 8, 2015

In class methods, there should be a super identifier prepopulated in the scope (similar to this and arguments).

@michaelficarra
Copy link
Member

That isn't how super works. It must be the target of a call or a member access. It is not a regular identifier, doesn't resolve how other identifiers do in the scope chain, and shouldn't show up in escope's output.

@nzakas
Copy link
Contributor Author

nzakas commented Mar 8, 2015

It needs to show up as a reference somehow to have a complete picture of what's happening. How would you recommend that be done?

@michaelficarra
Copy link
Member

Since super resolves through home objects, you should be able to statically resolve these references. I'm not sure what you're asking.

edit: Ah, I think I understand. You can use the __proto__ setter to change the [[Prototype]] value of the class's prototype object, so the reference is unknown until runtime. Is that what you were asking about?

@nzakas
Copy link
Contributor Author

nzakas commented Mar 9, 2015

Not exactly. I suppose what I'm really asking for is for super to act like this in escope. this doesn't exist as a scope variable and this references don't count as references in escope. The problem right now is that super does count as a referenced, and that's throwing things off.

@michaelficarra
Copy link
Member

Agreed. 👍

@Constellation
Copy link
Member

@nzakas:

LGTM. escope should handle super reference specially.

@Constellation
Copy link
Member

@nzakas, @michaelficarra

How super is handled in estree project?
We need to align it.

@nzakas
Copy link
Contributor Author

nzakas commented Mar 9, 2015

super is just represented as an Identifier, same as this.

@Constellation
Copy link
Member

I remember that this is represented as ThisExpression, right?
Anyway, I'll implement it with assumption that super is represented as Identifier.

@nzakas
Copy link
Contributor Author

nzakas commented Mar 9, 2015

Oh yeah, there's ThisExpression. So far, there's no SuperExpression. I just filed an issue to get clarification: estree/estree#54

@Constellation
Copy link
Member

@nzakas
Cool :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants