summaryrefslogtreecommitdiff
path: root/js/src/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/builtin')
-rw-r--r--js/src/builtin/ModuleObject.cpp20
-rw-r--r--js/src/builtin/ModuleObject.h6
2 files changed, 16 insertions, 10 deletions
diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp
index ae966c89ad..2790b1c444 100644
--- a/js/src/builtin/ModuleObject.cpp
+++ b/js/src/builtin/ModuleObject.cpp
@@ -725,12 +725,6 @@ ModuleObject::namespace_()
return &value.toObject().as<ModuleNamespaceObject>();
}
-ScriptSourceObject*
-ModuleObject::scriptSourceObject() const
-{
- return &getReservedSlot(ScriptSourceObjectSlot).toObject().as<ScriptSourceObject>();
-}
-
FunctionDeclarationVector*
ModuleObject::functionDeclarations()
{
@@ -744,10 +738,8 @@ ModuleObject::functionDeclarations()
void
ModuleObject::init(HandleScript script)
{
- MOZ_ASSERT(script);
initReservedSlot(ScriptSlot, PrivateValue(script));
initReservedSlot(StatusSlot, Int32Value(MODULE_STATUS_UNINSTANTIATED));
- initReservedSlot(ScriptSourceObjectSlot, ObjectValue(script->scriptSourceUnwrap()));
}
void
@@ -876,6 +868,18 @@ ModuleObject::evaluationError() const
return getReservedSlot(EvaluationErrorSlot);
}
+Value
+ModuleObject::hostDefinedField() const
+{
+ return getReservedSlot(HostDefinedSlot);
+}
+
+void
+ModuleObject::setHostDefinedField(const JS::Value& value)
+{
+ setReservedSlot(HostDefinedSlot, value);
+}
+
Scope*
ModuleObject::enclosingScope() const
{
diff --git a/js/src/builtin/ModuleObject.h b/js/src/builtin/ModuleObject.h
index c2514e876d..dc078e6b28 100644
--- a/js/src/builtin/ModuleObject.h
+++ b/js/src/builtin/ModuleObject.h
@@ -219,7 +219,7 @@ class ModuleObject : public NativeObject
NamespaceSlot,
StatusSlot,
EvaluationErrorSlot,
- ScriptSourceObjectSlot,
+ HostDefinedSlot,
RequestedModulesSlot,
ImportEntriesSlot,
LocalExportEntriesSlot,
@@ -271,7 +271,7 @@ class ModuleObject : public NativeObject
ModuleStatus status() const;
bool hadEvaluationError() const;
Value evaluationError() const;
- ScriptSourceObject* scriptSourceObject() const;
+ Value hostDefinedField() const;
ArrayObject& requestedModules() const;
ArrayObject& importEntries() const;
ArrayObject& localExportEntries() const;
@@ -284,6 +284,8 @@ class ModuleObject : public NativeObject
static bool Instantiate(JSContext* cx, HandleModuleObject self);
static bool Evaluate(JSContext* cx, HandleModuleObject self);
+ void setHostDefinedField(const JS::Value& value);
+
// For BytecodeEmitter.
bool noteFunctionDeclaration(ExclusiveContext* cx, HandleAtom name, HandleFunction fun);