mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:57:34 +00:00
LibJS: Make Reference aware of DeclarativeEnvironment indices
VM::resolve_binding() can now return a Reference that knows the exact binding index if it's pointing into a DeclarativeEnvironment. Reading/writing through the Reference will now use direct environment access when possible.
This commit is contained in:
parent
540ce075b6
commit
4444bcabde
3 changed files with 14 additions and 4 deletions
|
@ -44,11 +44,12 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
Reference(Environment& base, FlyString referenced_name, bool strict = false)
|
||||
Reference(Environment& base, FlyString referenced_name, bool strict = false, Optional<size_t> index_in_declarative_environment = {})
|
||||
: m_base_type(BaseType::Environment)
|
||||
, m_base_environment(&base)
|
||||
, m_name(move(referenced_name))
|
||||
, m_strict(strict)
|
||||
, m_index_in_declarative_environment(move(index_in_declarative_environment))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -129,6 +130,7 @@ private:
|
|||
PropertyName m_name;
|
||||
Value m_this_value;
|
||||
bool m_strict { false };
|
||||
Optional<size_t> m_index_in_declarative_environment;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue