mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:07:45 +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
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