mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibJS+LibWeb: Let JS::Script::parse() return a list of errors (on error)
These are really supposed to be a list of SyntaxError objects, but for now we simply return all the Parser::Error objects we got from Parser.
This commit is contained in:
parent
5fa02b8a9e
commit
10c489713d
Notes:
sideshowbarker
2024-07-18 03:58:00 +09:00
Author: https://github.com/awesomekling
Commit: 10c489713d
3 changed files with 17 additions and 8 deletions
|
@ -38,12 +38,17 @@ NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView s
|
|||
// 10. Let result be ParseScript(source, settings's Realm, script).
|
||||
auto result = JS::Script::parse(source, realm, script->filename());
|
||||
|
||||
// FIXME: 11. If result is a list of errors, then:
|
||||
// 1. Set script's parse error and its error to rethrow to result[0].
|
||||
// 2. Return script.
|
||||
// 11. If result is a list of errors, then:
|
||||
|
||||
if (result.is_error()) {
|
||||
// FIXME: 1. Set script's parse error and its error to rethrow to result[0].
|
||||
|
||||
// 2. Return script.
|
||||
return script;
|
||||
}
|
||||
|
||||
// 12. Set script's record to result.
|
||||
script->m_script_record = move(result);
|
||||
script->m_script_record = result.release_value();
|
||||
|
||||
// 13. Return script.
|
||||
return script;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue