summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-21 23:26:50 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-21 23:49:50 +0200
commit46f2c2303051507d3b2574e1e19c3a30a4517a4e (patch)
treecfc9203e62960f5f489581dc05695aead589a8b2 /Userland/Libraries/LibJS
parent6c6dbcfc36e4603e40f403964207142664b96e46 (diff)
downloadserenity-46f2c2303051507d3b2574e1e19c3a30a4517a4e.zip
LibJS: Convert EnvironmentRecord & friends to east-const style
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.h8
-rw-r--r--Userland/Libraries/LibJS/Runtime/EnvironmentRecord.h6
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalObject.h4
-rw-r--r--Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.h4
6 files changed, 14 insertions, 16 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.cpp b/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.cpp
index a0d52a23b8..064bddf189 100644
--- a/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.cpp
+++ b/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.cpp
@@ -52,12 +52,12 @@ void DeclarativeEnvironmentRecord::visit_edges(Visitor& visitor)
visitor.visit(it.value.value);
}
-Optional<Variable> DeclarativeEnvironmentRecord::get_from_scope(const FlyString& name) const
+Optional<Variable> DeclarativeEnvironmentRecord::get_from_scope(FlyString const& name) const
{
return m_variables.get(name);
}
-void DeclarativeEnvironmentRecord::put_to_scope(const FlyString& name, Variable variable)
+void DeclarativeEnvironmentRecord::put_to_scope(FlyString const& name, Variable variable)
{
m_variables.set(name, variable);
}
diff --git a/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.h b/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.h
index 928ce91a41..43f255c8bf 100644
--- a/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.h
+++ b/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironmentRecord.h
@@ -37,15 +37,13 @@ public:
virtual ~DeclarativeEnvironmentRecord() override;
// ^EnvironmentRecord
- virtual Optional<Variable> get_from_scope(const FlyString&) const override;
- virtual void put_to_scope(const FlyString&, Variable) override;
+ virtual Optional<Variable> get_from_scope(FlyString const&) const override;
+ virtual void put_to_scope(FlyString const&, Variable) override;
virtual bool delete_from_scope(FlyString const&) override;
virtual bool has_this_binding() const override;
virtual Value get_this_binding(GlobalObject&) const override;
- void clear();
-
- const HashMap<FlyString, Variable>& variables() const { return m_variables; }
+ HashMap<FlyString, Variable> const& variables() const { return m_variables; }
void set_home_object(Value object) { m_home_object = object; }
bool has_super_binding() const;
diff --git a/Userland/Libraries/LibJS/Runtime/EnvironmentRecord.h b/Userland/Libraries/LibJS/Runtime/EnvironmentRecord.h
index 5462421236..ccf488c56b 100644
--- a/Userland/Libraries/LibJS/Runtime/EnvironmentRecord.h
+++ b/Userland/Libraries/LibJS/Runtime/EnvironmentRecord.h
@@ -19,14 +19,14 @@ class EnvironmentRecord : public Object {
JS_OBJECT(EnvironmentRecord, Object);
public:
- virtual Optional<Variable> get_from_scope(const FlyString&) const = 0;
- virtual void put_to_scope(const FlyString&, Variable) = 0;
+ virtual Optional<Variable> get_from_scope(FlyString const&) const = 0;
+ virtual void put_to_scope(FlyString const&, Variable) = 0;
virtual bool delete_from_scope(FlyString const&) = 0;
virtual bool has_this_binding() const = 0;
virtual Value get_this_binding(GlobalObject&) const = 0;
EnvironmentRecord* parent() { return m_parent; }
- const EnvironmentRecord* parent() const { return m_parent; }
+ EnvironmentRecord const* parent() const { return m_parent; }
protected:
explicit EnvironmentRecord(EnvironmentRecord* parent);
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.h b/Userland/Libraries/LibJS/Runtime/GlobalObject.h
index 77abad92cc..78a5065d9d 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalObject.h
+++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.h
@@ -21,8 +21,8 @@ public:
virtual ~GlobalObject() override;
- virtual Optional<Variable> get_from_scope(const FlyString&) const override;
- virtual void put_to_scope(const FlyString&, Variable) override;
+ virtual Optional<Variable> get_from_scope(FlyString const&) const override;
+ virtual void put_to_scope(FlyString const&, Variable) override;
virtual bool delete_from_scope(FlyString const&) override;
virtual bool has_this_binding() const override;
virtual Value get_this_binding(GlobalObject&) const override;
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.cpp b/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.cpp
index 28e3a8507a..591554c6da 100644
--- a/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.cpp
@@ -21,7 +21,7 @@ void ObjectEnvironmentRecord::visit_edges(Cell::Visitor& visitor)
visitor.visit(&m_object);
}
-Optional<Variable> ObjectEnvironmentRecord::get_from_scope(const FlyString& name) const
+Optional<Variable> ObjectEnvironmentRecord::get_from_scope(FlyString const& name) const
{
auto value = m_object.get(name);
if (value.is_empty())
@@ -29,7 +29,7 @@ Optional<Variable> ObjectEnvironmentRecord::get_from_scope(const FlyString& name
return Variable { value, DeclarationKind::Var };
}
-void ObjectEnvironmentRecord::put_to_scope(const FlyString& name, Variable variable)
+void ObjectEnvironmentRecord::put_to_scope(FlyString const& name, Variable variable)
{
m_object.put(name, variable.value);
}
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.h b/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.h
index 97166ea5df..6949dc7bb8 100644
--- a/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.h
+++ b/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.h
@@ -16,8 +16,8 @@ class ObjectEnvironmentRecord : public EnvironmentRecord {
public:
ObjectEnvironmentRecord(Object&, EnvironmentRecord* parent_scope);
- virtual Optional<Variable> get_from_scope(const FlyString&) const override;
- virtual void put_to_scope(const FlyString&, Variable) override;
+ virtual Optional<Variable> get_from_scope(FlyString const&) const override;
+ virtual void put_to_scope(FlyString const&, Variable) override;
virtual bool delete_from_scope(FlyString const&) override;
virtual bool has_this_binding() const override;
virtual Value get_this_binding(GlobalObject&) const override;