mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 11:37:44 +00: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:
parent
57c5a59cab
commit
12c2f30c54
6 changed files with 22 additions and 10 deletions
|
@ -19,11 +19,13 @@ public:
|
|||
Realm& realm() { return *m_realm.cell(); }
|
||||
Realm const& realm() const { return *m_realm.cell(); }
|
||||
|
||||
StringView filename() const { return m_filename; }
|
||||
|
||||
Environment* environment() { return m_environment.cell(); }
|
||||
Object* namespace_() { return m_namespace.cell(); }
|
||||
|
||||
protected:
|
||||
explicit Module(Realm&);
|
||||
explicit Module(Realm&, StringView filename);
|
||||
|
||||
private:
|
||||
// Handles are not safe unless we keep the VM alive.
|
||||
|
@ -32,6 +34,9 @@ private:
|
|||
Handle<Realm> m_realm; // [[Realm]]
|
||||
Handle<Environment> m_environment; // [[Environment]]
|
||||
Handle<Object> m_namespace; // [[Namespace]]
|
||||
|
||||
// Needed for potential lookups of modules.
|
||||
String m_filename;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue