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

LibWeb+LibJS: Remember source filenames when using HTML::Script

It's a lot easier to debug JavaScript problems if you can see which file
the errors are in. :^)
This commit is contained in:
Andreas Kling 2021-09-11 00:30:06 +02:00
parent 6595db9ecf
commit 1484980f8f
7 changed files with 17 additions and 14 deletions

View file

@ -12,10 +12,10 @@
namespace JS {
// 16.1.5 ParseScript ( sourceText, realm, hostDefined ), https://tc39.es/ecma262/#sec-parse-script
NonnullRefPtr<Script> Script::parse(StringView source_text, GlobalObject& global_object)
NonnullRefPtr<Script> Script::parse(StringView source_text, GlobalObject& global_object, StringView filename)
{
// 1. Let body be ParseText(sourceText, Script).
auto body = Parser(Lexer(source_text)).parse_program();
auto body = Parser(Lexer(source_text, filename)).parse_program();
// FIXME: 2. If body is a List of errors, return body.