summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Object.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-29 12:20:14 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-29 15:55:40 +0200
commit688ca7b196d2567f46125e54fa8463327cc798d4 (patch)
tree1f94f7cca7bbd1f5f01e5f57dd3431205801f4b4 /Libraries/LibJS/Runtime/Object.cpp
parent1dd44210b7887373d606863a93ed5e9ede370feb (diff)
downloadserenity-688ca7b196d2567f46125e54fa8463327cc798d4.zip
LibJS: Make Object::invoke() non-const
As suggested in #2431's code review.
Diffstat (limited to 'Libraries/LibJS/Runtime/Object.cpp')
-rw-r--r--Libraries/LibJS/Runtime/Object.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Libraries/LibJS/Runtime/Object.cpp b/Libraries/LibJS/Runtime/Object.cpp
index eff0d31e12..915ce3b251 100644
--- a/Libraries/LibJS/Runtime/Object.cpp
+++ b/Libraries/LibJS/Runtime/Object.cpp
@@ -662,9 +662,9 @@ Value Object::to_string() const
return js_string(heap(), String::format("[object %s]", class_name()));
}
-Value Object::invoke(const FlyString& property_name, Optional<MarkedValueList> arguments) const
+Value Object::invoke(const FlyString& property_name, Optional<MarkedValueList> arguments)
{
- auto& interpreter = const_cast<Object*>(this)->interpreter();
+ auto& interpreter = this->interpreter();
auto property = get(property_name).value_or(js_undefined());
if (interpreter.exception())
return {};
@@ -672,7 +672,7 @@ Value Object::invoke(const FlyString& property_name, Optional<MarkedValueList> a
interpreter.throw_exception<TypeError>(String::format("%s is not a function", property.to_string_without_side_effects().characters()));
return {};
}
- return interpreter.call(property.as_function(), const_cast<Object*>(this), move(arguments));
+ return interpreter.call(property.as_function(), this, move(arguments));
}
}