mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
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.
This commit is contained in:
parent
1d24699ca8
commit
77a18392ff
2 changed files with 3 additions and 3 deletions
|
@ -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() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue