mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
LibJS: Implement Function.prototype.toString() according to the spec
That's an old yak :^) No, past me, AST nodes do not need to learn to stringify themselves. This is now massively simplified by using the [[SourceText]] internal slot. Also updates a bunch of tests that are incorrect due to the old implementation not being spec compliant, and add plenty more.
This commit is contained in:
parent
1ee7e97e24
commit
7d521b7c7c
Notes:
sideshowbarker
2024-07-17 20:38:06 +09:00
Author: https://github.com/linusg
Commit: 7d521b7c7c
Pull-request: https://github.com/SerenityOS/serenity/pull/12002
3 changed files with 166 additions and 59 deletions
|
@ -33,7 +33,7 @@ describe("correct behavior", () => {
|
|||
expect(new Function("-->")()).toBeUndefined();
|
||||
|
||||
expect(new Function().name).toBe("anonymous");
|
||||
expect(new Function().toString()).toBe("function anonymous() {\n ???\n}");
|
||||
expect(new Function().toString()).toBe("function anonymous(\n) {\n\n}");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue