mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 09:24:57 +00:00
LibJS/Bytecode: Add support for new.target
This commit is contained in:
parent
fd235d8a06
commit
eac5534ce4
5 changed files with 46 additions and 0 deletions
|
@ -2031,4 +2031,25 @@ Bytecode::CodeGenerationErrorOr<void> ForOfStatement::generate_bytecode(Bytecode
|
|||
return for_in_of_body_evaluation(generator, *this, m_lhs, body(), head_result, loop_end, loop_update);
|
||||
}
|
||||
|
||||
// 13.3.12.1 Runtime Semantics: Evaluation, https://tc39.es/ecma262/#sec-meta-properties-runtime-semantics-evaluation
|
||||
Bytecode::CodeGenerationErrorOr<void> MetaProperty::generate_bytecode(Bytecode::Generator& generator) const
|
||||
{
|
||||
// NewTarget : new . target
|
||||
if (m_type == MetaProperty::Type::NewTarget) {
|
||||
// 1. Return GetNewTarget().
|
||||
generator.emit<Bytecode::Op::GetNewTarget>();
|
||||
return {};
|
||||
}
|
||||
|
||||
// ImportMeta : import . meta
|
||||
if (m_type == MetaProperty::Type::ImportMeta) {
|
||||
return Bytecode::CodeGenerationError {
|
||||
this,
|
||||
"Unimplemented meta property: import.meta"sv,
|
||||
};
|
||||
}
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue