-
Notifications
You must be signed in to change notification settings - Fork 858
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
Support ES2019 Function.toString() revision #1300
Comments
The part about .toString() returning the source code as authored might be fixed by #1188 |
It would be possible to handle this by removing the code that adds // nativeFunctionMatcher.js
const eatWhitespace = () => {
while (pos < source.length) {
const c = source[pos]; // `c` does not change. There are three similar codes.
if (isWhitespace(c) || isNewline(c)) {
pos += 1;
continue;
} This works by replacing Besides native code, getter/setter test was failing. |
But besides the tests for this in test262 failing, code in Rhino needs to be fixed still to make it functionally work? |
As for rhino/rhino/src/main/java/org/mozilla/javascript/BaseFunction.java Lines 464 to 466 in 955af15
rhino/rhino/src/main/java/org/mozilla/javascript/IdFunctionObject.java Lines 115 to 117 in 955af15
I have not looked too closely at the getter/setter. |
This issue is not yet fixed. |
To clarify: #1520 fixed the .toString() behaviour on user-authored JavaScript functions, but not yet on native (Java) methods |
What should the Java method be? https://262.ecma-international.org/15.0/index.html#sec-function.prototype.tostring
I think this sentence expects
In GraalJS, this is what returned.
|
[native code] is correct afaik |
switching back to only [native code] will be great - have done some adjustments for the change in HtmlUnit to be browser compatible (HtmlUnit/htmlunit@0c18c77) Hopefully i can remove more code and only insert the line break that ff has in the output... |
See:
Some examples:
Currently:
Expected:
Currently:
Expected:
The spec revision also details that the .toString() of user-defined function inside JavaScript must return the source exactly as authored, which I'm not sure we're compliant with
The text was updated successfully, but these errors were encountered: