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:
davidot 2022-01-18 19:21:42 +01:00 committed by Linus Groh
commit 12c2f30c54
Notes: sideshowbarker 2024-07-17 20:28:56 +09:00
6 changed files with 22 additions and 10 deletions

View file

@ -24,14 +24,19 @@ public:
Realm& realm() { return *m_realm.cell(); }
Program const& parse_node() const { return *m_parse_node; }
StringView filename() const { return m_filename; }
private:
Script(Realm&, NonnullRefPtr<Program>);
Script(Realm&, StringView filename, NonnullRefPtr<Program>);
// Handles are not safe unless we keep the VM alive.
NonnullRefPtr<VM> m_vm;
Handle<Realm> m_realm; // [[Realm]]
NonnullRefPtr<Program> m_parse_node; // [[ECMAScriptCode]]
// Needed for potential lookups of modules.
String m_filename;
};
}