mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibJS: Teach Reference to access call frame arguments directly
This commit is contained in:
parent
91fbeeab72
commit
6e0e8a8242
3 changed files with 20 additions and 0 deletions
|
@ -19,6 +19,11 @@ void Reference::put(GlobalObject& global_object, Value value)
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_call_frame_argument_index.has_value()) {
|
||||
global_object.vm().call_frame().arguments[m_call_frame_argument_index.value()] = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_local_variable() || is_global_variable()) {
|
||||
if (is_local_variable())
|
||||
vm.set_variable(m_name.to_string(), value, global_object);
|
||||
|
@ -68,6 +73,9 @@ Value Reference::get(GlobalObject& global_object)
|
|||
return {};
|
||||
}
|
||||
|
||||
if (m_call_frame_argument_index.has_value())
|
||||
return global_object.vm().argument(m_call_frame_argument_index.value());
|
||||
|
||||
if (is_local_variable() || is_global_variable()) {
|
||||
Value value;
|
||||
if (is_local_variable())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue