mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibJS: Parse dynamic import calls 'import()' and 'import.meta'
For now both just throw when executing but this can be implemented when modules are implemented :^).
This commit is contained in:
parent
73eb29dabe
commit
045a42cf35
Notes:
sideshowbarker
2024-07-17 23:18:09 +09:00
Author: https://github.com/davidot
Commit: 045a42cf35
Pull-request: https://github.com/SerenityOS/serenity/pull/11088
Issue: https://github.com/SerenityOS/serenity/issues/11078
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/linusg ✅
4 changed files with 125 additions and 6 deletions
|
@ -2880,17 +2880,39 @@ void MetaProperty::dump(int indent) const
|
|||
outln("{} {}", class_name(), name);
|
||||
}
|
||||
|
||||
Value MetaProperty::execute(Interpreter& interpreter, GlobalObject&) const
|
||||
Value MetaProperty::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
||||
{
|
||||
InterpreterNodeScope node_scope { interpreter, *this };
|
||||
|
||||
if (m_type == MetaProperty::Type::NewTarget)
|
||||
return interpreter.vm().get_new_target().value_or(js_undefined());
|
||||
if (m_type == MetaProperty::Type::ImportMeta)
|
||||
TODO();
|
||||
if (m_type == MetaProperty::Type::ImportMeta) {
|
||||
interpreter.vm().throw_exception<InternalError>(global_object, ErrorType::NotImplemented, "'import.meta' in modules");
|
||||
return {};
|
||||
}
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void ImportCall::dump(int indent) const
|
||||
{
|
||||
ASTNode::dump(indent);
|
||||
print_indent(indent);
|
||||
outln("(Specifier)");
|
||||
m_specifier->dump(indent + 1);
|
||||
if (m_options) {
|
||||
outln("(Options)");
|
||||
m_options->dump(indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Value ImportCall::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
||||
{
|
||||
InterpreterNodeScope node_scope { interpreter, *this };
|
||||
interpreter.vm().throw_exception<InternalError>(global_object, ErrorType::NotImplemented, "'import(...)' in modules");
|
||||
return {};
|
||||
}
|
||||
|
||||
Value StringLiteral::execute(Interpreter& interpreter, GlobalObject&) const
|
||||
{
|
||||
InterpreterNodeScope node_scope { interpreter, *this };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue