mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Add filename tracking to Script and Module
This will allow us to resolve modules dynamically loaded from a script.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 20:28:56 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/12c2f30c548 Pull-request: https://github.com/SerenityOS/serenity/pull/11957 Reviewed-by: https://github.com/emanuele6 Reviewed-by: https://github.com/linusg
@@ -23,13 +23,14 @@ Result<NonnullRefPtr<Script>, Vector<Parser::Error>> Script::parse(StringView so
|
||||
return parser.errors();
|
||||
|
||||
// 3. Return Script Record { [[Realm]]: realm, [[ECMAScriptCode]]: body, [[HostDefined]]: hostDefined }.
|
||||
return adopt_ref(*new Script(realm, move(body)));
|
||||
return adopt_ref(*new Script(realm, filename, move(body)));
|
||||
}
|
||||
|
||||
Script::Script(Realm& realm, NonnullRefPtr<Program> parse_node)
|
||||
Script::Script(Realm& realm, StringView filename, NonnullRefPtr<Program> parse_node)
|
||||
: m_vm(realm.vm())
|
||||
, m_realm(make_handle(&realm))
|
||||
, m_parse_node(move(parse_node))
|
||||
, m_filename(filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user