mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:57:35 +00:00
LibJS: Add direct (indexed) binding accessors to DeclarativeEnvironment
This patch adds two DeclarativeEnvironment APIs: - get_binding_value_direct() - set_mutable_binding_direct() These work identically to their non-direct-suffixed counterparts, but take an index instead of a bound name. This will allow someone who has a binding index to get/set that binding directly without any additional hash lookups.
This commit is contained in:
parent
cb696eff08
commit
540ce075b6
2 changed files with 29 additions and 5 deletions
|
@ -34,10 +34,15 @@ public:
|
|||
// This is not a method defined in the spec! Do not use this in any LibJS (or other spec related) code.
|
||||
[[nodiscard]] Vector<String> bindings() const;
|
||||
|
||||
Value get_binding_value_direct(GlobalObject&, size_t index, bool strict);
|
||||
void set_mutable_binding_direct(GlobalObject&, size_t index, Value, bool strict);
|
||||
|
||||
protected:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
FlyString const& name_from_index(size_t) const;
|
||||
|
||||
virtual bool is_declarative_environment() const override { return true; }
|
||||
|
||||
struct Binding {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue