mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Implement import.meta spec(MetaProperty)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
3f1001454e
commit
6503fc0416
10 changed files with 144 additions and 38 deletions
|
|
@ -943,4 +943,31 @@ ModuleNamespaceObject* Script::getModuleNamespace(ExecutionState& state)
|
|||
|
||||
return moduleData()->m_namespace.value();
|
||||
}
|
||||
|
||||
Object* Script::importMetaProperty(ExecutionState& state)
|
||||
{
|
||||
ASSERT(isModule());
|
||||
// Let importMeta be module.[[ImportMeta]].
|
||||
// If importMeta is empty, then
|
||||
if (!moduleData()->m_importMeta) {
|
||||
// Set importMeta to ! OrdinaryObjectCreate(null).
|
||||
Object* importMeta = new Object(state, Object::PrototypeIsNull);
|
||||
// Let importMetaValues be ! HostGetImportMetaProperties(module).
|
||||
// For each Record { [[Key]], [[Value]] } p that is an element of importMetaValues, do
|
||||
// Perform ! CreateDataPropertyOrThrow(importMeta, p.[[Key]], p.[[Value]]).
|
||||
// Perform ! HostFinalizeImportMeta(importMeta, module).
|
||||
importMeta->defineOwnProperty(state, state.context()->staticStrings().lazyURL(),
|
||||
ObjectPropertyDescriptor(Value(src()), ObjectPropertyDescriptor::AllPresent));
|
||||
|
||||
// Set module.[[ImportMeta]] to importMeta.
|
||||
moduleData()->m_importMeta = importMeta;
|
||||
// Return importMeta.
|
||||
return importMeta;
|
||||
} else {
|
||||
// Else,
|
||||
// Assert: Type(importMeta) is Object.
|
||||
// Return importMeta.
|
||||
return moduleData()->m_importMeta.value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue