summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-09-09 21:51:26 +0100
committerLinus Groh <mail@linusgroh.de>2021-09-09 23:46:45 +0100
commit77a18392ff6501ec31877e7a84cdbdc5da5df0f6 (patch)
tree94ae2e737089b1473a247b72ff5a40ee4bde9097 /Userland/Libraries/LibJS
parent1d24699ca8b8fbe228938b4ba7fbdf18a484659d (diff)
downloadserenity-77a18392ff6501ec31877e7a84cdbdc5da5df0f6.zip
LibJS: Make to_temporal_duration_record() time like Object a const&
This only calls Object::get() or some Duration getters on the temporal_duration_like Object, both of which are const-qualified.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Duration.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
index 87b969d2e1..13dfeffdc5 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
@@ -67,7 +67,7 @@ Duration* to_temporal_duration(GlobalObject& global_object, Value item)
}
// 7.5.2 ToTemporalDurationRecord ( temporalDurationLike ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldurationrecord
-TemporalDuration to_temporal_duration_record(GlobalObject& global_object, Object& temporal_duration_like)
+TemporalDuration to_temporal_duration_record(GlobalObject& global_object, Object const& temporal_duration_like)
{
auto& vm = global_object.vm();
@@ -75,7 +75,7 @@ TemporalDuration to_temporal_duration_record(GlobalObject& global_object, Object
// 2. If temporalDurationLike has an [[InitializedTemporalDuration]] internal slot, then
if (is<Duration>(temporal_duration_like)) {
- auto& duration = static_cast<Duration&>(temporal_duration_like);
+ auto& duration = static_cast<Duration const&>(temporal_duration_like);
// a. Return the Record { [[Years]]: temporalDurationLike.[[Years]], [[Months]]: temporalDurationLike.[[Months]], [[Weeks]]: temporalDurationLike.[[Weeks]], [[Days]]: temporalDurationLike.[[Days]], [[Hours]]: temporalDurationLike.[[Hours]], [[Minutes]]: temporalDurationLike.[[Minutes]], [[Seconds]]: temporalDurationLike.[[Seconds]], [[Milliseconds]]: temporalDurationLike.[[Milliseconds]], [[Microseconds]]: temporalDurationLike.[[Microseconds]], [[Nanoseconds]]: temporalDurationLike.[[Nanoseconds]] }.
return TemporalDuration { .years = duration.years(), .months = duration.months(), .weeks = duration.weeks(), .days = duration.days(), .hours = duration.hours(), .minutes = duration.minutes(), .seconds = duration.seconds(), .milliseconds = duration.milliseconds(), .microseconds = duration.microseconds(), .nanoseconds = duration.nanoseconds() };
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
index e6e53324df..d7101569ec 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
@@ -108,7 +108,7 @@ auto temporal_duration_like_properties = [](VM& vm) {
};
Duration* to_temporal_duration(GlobalObject&, Value item);
-TemporalDuration to_temporal_duration_record(GlobalObject&, Object& temporal_duration_like);
+TemporalDuration to_temporal_duration_record(GlobalObject&, Object const& temporal_duration_like);
i8 duration_sign(double years, double months, double weeks, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds);
bool is_valid_duration(double years, double months, double weeks, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds);
PartialDuration to_partial_duration(GlobalObject&, Value temporal_duration_like);