1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

LibJS: Identify global variables during parsing

Identifying global variables during parsing will make it possible to
generate special optimized instruction to access them in upcoming
changes.
This commit is contained in:
Aliaksandr Kalenik 2023-07-12 04:02:27 +02:00 committed by Andreas Kling
parent 73f1c7a030
commit b0a533dbc0
5 changed files with 75 additions and 20 deletions

View file

@ -103,7 +103,7 @@ ThrowCompletionOr<Value> perform_shadow_realm_eval(VM& vm, StringView source_tex
// 2. Perform the following substeps in an implementation-defined order, possibly interleaving parsing and error detection:
// a. Let script be ParseText(StringToCodePoints(sourceText), Script).
auto parser = Parser(Lexer(source_text));
auto parser = Parser(Lexer(source_text), Program::Type::Script, Parser::EvalInitialState {});
auto program = parser.parse_program();
// b. If script is a List of errors, throw a SyntaxError exception.