mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 16:02:53 +00:00
LibJS: Parse line continuations in string literals properly
Newlines after line continuation were inserted into the string literals. This patch makes the parser ignore the newlines after \ and also makes it so that "use strict" containing a line continuation is not a valid "use strict".
This commit is contained in:
parent
e6505a95f1
commit
e5ddcadd3c
Notes:
sideshowbarker
2024-07-19 01:44:24 +09:00
Author: https://github.com/nooga
Commit: e5ddcadd3c
Pull-request: https://github.com/SerenityOS/serenity/pull/3845
Issue: https://github.com/SerenityOS/serenity/issues/3816
Reviewed-by: https://github.com/linusg ✅
4 changed files with 18 additions and 0 deletions
|
@ -30,6 +30,12 @@ test("use strict with double quotes after statement does not yield strict mode c
|
|||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("use strict interrupted by a line continuation does not yield strict mode code", () => {
|
||||
"use \
|
||||
strict";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("strict mode propagates down the scope chain", () => {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue