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

Editorial: ProxyTarget is always a function object in GetFunctionRealm #3496

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kimjg1119
Copy link
Contributor

In GetFunctionRealm, step 3.c. call GetFunctionRealm recursively with proxyTarget which assumes that proxyTarget is a function object.

If my investigation is correct, proxy exotic objects are generated in ProxyCreate and it is callable only if the target is callable. Thus if a function object has a target, then it is also a function object thus it isn't a spec bug. However I think add an assertion here will be helpful.

Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

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

This is great!

@kimjg1119
Copy link
Contributor Author

Can we also remove step 3.a? It seems that ValidateNonRevokedProxy only checks ProxyTarget, but it seems that it is always Object when obj is callable.

@michaelficarra
Copy link
Member

@kimjg1119 All proxies of callable objects (including revocable proxies) are themselves callable. When a callable revocable proxy is revoked, it remains callable. So ValidateNonRevokedProxy is needed to check that the proxy has not yet been revoked (and that [[ProxyTarget]] is a function object rather than null).

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.

2 participants