1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibJS: Add a mode to parse JS as a module

In a module strict mode should be enabled at the start of parsing and we
allow import and export statements.
This commit is contained in:
davidot 2021-08-14 17:30:37 +02:00 committed by Linus Groh
parent d6d7d11590
commit 7613c22b06
8 changed files with 38 additions and 15 deletions

View file

@ -85,7 +85,9 @@ TESTJS_RUN_FILE_FUNCTION(const String& test_file, JS::Interpreter&)
else
return Test::JS::RunFileHookResult::SkipFile;
auto parse_result = Test::JS::parse_file(test_file);
auto program_type = path.basename().ends_with(".module.js") ? JS::Program::Type::Module : JS::Program::Type::Script;
auto parse_result = Test::JS::parse_file(test_file, program_type);
bool test_passed = true;
String message;
String expectation_string;