mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
LibJS: Evaluate this
in terms of ResolveThisBinding
This commit is contained in:
parent
92ce4ac23f
commit
6e1932e8b2
3 changed files with 10 additions and 1 deletions
|
@ -1347,7 +1347,7 @@ Value SpreadExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
||||||
Value ThisExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
Value ThisExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
||||||
{
|
{
|
||||||
InterpreterNodeScope node_scope { interpreter, *this };
|
InterpreterNodeScope node_scope { interpreter, *this };
|
||||||
return get_this_environment(interpreter.vm()).get_this_binding(global_object);
|
return interpreter.vm().resolve_this_binding(global_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThisExpression::dump(int indent) const
|
void ThisExpression::dump(int indent) const
|
||||||
|
|
|
@ -490,6 +490,13 @@ void VM::throw_exception(Exception& exception)
|
||||||
unwind(ScopeType::Try);
|
unwind(ScopeType::Try);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 9.4.4 ResolveThisBinding ( ), https://tc39.es/ecma262/#sec-resolvethisbinding
|
||||||
|
Value VM::resolve_this_binding(GlobalObject& global_object)
|
||||||
|
{
|
||||||
|
auto& environment = get_this_environment(*this);
|
||||||
|
return environment.get_this_binding(global_object);
|
||||||
|
}
|
||||||
|
|
||||||
String VM::join_arguments(size_t start_index) const
|
String VM::join_arguments(size_t start_index) const
|
||||||
{
|
{
|
||||||
StringBuilder joined_arguments;
|
StringBuilder joined_arguments;
|
||||||
|
|
|
@ -162,6 +162,8 @@ public:
|
||||||
return running_execution_context().this_value;
|
return running_execution_context().this_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value resolve_this_binding(GlobalObject&);
|
||||||
|
|
||||||
Value last_value() const { return m_last_value; }
|
Value last_value() const { return m_last_value; }
|
||||||
void set_last_value(Badge<Bytecode::Interpreter>, Value value) { m_last_value = value; }
|
void set_last_value(Badge<Bytecode::Interpreter>, Value value) { m_last_value = value; }
|
||||||
void set_last_value(Badge<Interpreter>, Value value) { m_last_value = value; }
|
void set_last_value(Badge<Interpreter>, Value value) { m_last_value = value; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue