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

'name' and 'length' properties of Functions should be configurable #715

Closed
gbrail opened this issue Jun 16, 2020 · 4 comments · Fixed by #1398
Closed

'name' and 'length' properties of Functions should be configurable #715

gbrail opened this issue Jun 16, 2020 · 4 comments · Fixed by #1398
Labels
bug Issues considered a bug Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec

Comments

@gbrail
Copy link
Collaborator

gbrail commented Jun 16, 2020

This is part of ECMAScript's section on Function objects (currently 19.2). A lot of test262 tests will pass if this is fixed.

Fixing this means modifying BaseFunction to not only return the right attributes but to allow those attributes to be deleted.

@rbri
Copy link
Collaborator

rbri commented Jun 16, 2020

Sounds great - i guess you are already working on this....

@gbrail
Copy link
Collaborator Author

gbrail commented Jun 16, 2020 via email

@p-bakker
Copy link
Collaborator

@gbrail as the lambda-based stuff is in now (if I'm not mistaken), could you elaborate how the lambda stuff makes it easier?

On a sidenote: #963 also requires changing existing implementations to be spec-compliant and while {Map,Set).size is implemented correctly from a spec point of view, I feel the IdScriptableObject approach makes the implementation a lot more cumbersome that it maybe ought to be.

I tried something like this in the init method of NativeRegExp to add the unicode property, skipping the creation of a NativeObject descriptor first, but the interfered:

        proto.setGetterOrSetter("unicode", 0, (c, s, thisObj, args) -> {
        	if (!(thisObj instanceof NativeRegExp)) return null;

        	NativeRegExp re = (NativeRegExp) thisObj;

        	return ScriptRuntime.wrapBoolean((re.getFlags() & JSREG_UNICODE) != 0);
        }, false);
        proto.setAttributes("unicode", READONLY | DONTENUM);

@p-bakker p-bakker added the bug Issues considered a bug label Jul 5, 2021
@p-bakker p-bakker added the Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec label Oct 14, 2021
@p-bakker
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues considered a bug Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants