1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 06:55:07 +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:
Marcin Gasperowicz 2020-10-25 14:46:51 +01:00 committed by Andreas Kling
parent e6505a95f1
commit e5ddcadd3c
4 changed files with 18 additions and 0 deletions

View file

@ -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();