1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

LibJS: Add a NewObject bytecode instruction for ObjectExpression :^)

This commit is contained in:
Andreas Kling 2021-06-04 20:30:23 +02:00
parent f2863b5a89
commit bea6e31ddc
4 changed files with 38 additions and 0 deletions

View file

@ -41,6 +41,11 @@ void NewString::execute(Bytecode::Interpreter& interpreter) const
interpreter.reg(m_dst) = js_string(interpreter.vm(), m_string);
}
void NewObject::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = Object::create_empty(interpreter.global_object());
}
void GetVariable::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = interpreter.vm().get_variable(m_identifier, interpreter.global_object());
@ -102,6 +107,11 @@ String NewString::to_string() const
return String::formatted("NewString dst:{}, string:\"{}\"", m_dst, m_string);
}
String NewObject::to_string() const
{
return String::formatted("NewObject dst:{}", m_dst);
}
String GetVariable::to_string() const
{
return String::formatted("GetVariable dst:{}, identifier:{}", m_dst, m_identifier);