mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:37:34 +00:00
LibJS: Convert 'possible instants' AOs to MarkedVector<Instant*>
Resolve TODOs suggesting the use of a strongly typed MarkedValueList (a.k.a. MarkedVector<T>) in the following AOs: - get_possible_instants_for() - disambiguate_possible_instants()
This commit is contained in:
parent
a863363b06
commit
af7003ebd2
3 changed files with 20 additions and 29 deletions
|
@ -79,17 +79,14 @@ ThrowCompletionOr<BigInt const*> interpret_iso_date_time_offset(GlobalObject& gl
|
|||
auto possible_instants = TRY(get_possible_instants_for(global_object, time_zone, *date_time));
|
||||
|
||||
// 9. For each element candidate of possibleInstants, do
|
||||
for (auto& candidate_value : possible_instants) {
|
||||
// TODO: As per the comment in disambiguate_possible_instants, having a MarkedValueList<T> would allow us to remove this cast.
|
||||
auto& candidate = static_cast<Instant&>(candidate_value.as_object());
|
||||
|
||||
for (auto* candidate : possible_instants) {
|
||||
// a. Let candidateNanoseconds be ? GetOffsetNanosecondsFor(timeZone, candidate).
|
||||
auto candidate_nanoseconds = TRY(get_offset_nanoseconds_for(global_object, time_zone, candidate));
|
||||
auto candidate_nanoseconds = TRY(get_offset_nanoseconds_for(global_object, time_zone, *candidate));
|
||||
|
||||
// b. If candidateNanoseconds = offsetNanoseconds, then
|
||||
if (candidate_nanoseconds == offset_nanoseconds) {
|
||||
// i. Return candidate.[[Nanoseconds]].
|
||||
return &candidate.nanoseconds();
|
||||
return &candidate->nanoseconds();
|
||||
}
|
||||
|
||||
// c. If matchBehaviour is match minutes, then
|
||||
|
@ -100,7 +97,7 @@ ThrowCompletionOr<BigInt const*> interpret_iso_date_time_offset(GlobalObject& gl
|
|||
// ii. If roundedCandidateNanoseconds = offsetNanoseconds, then
|
||||
if (rounded_candidate_nanoseconds == offset_nanoseconds) {
|
||||
// 1. Return candidate.[[Nanoseconds]].
|
||||
return &candidate.nanoseconds();
|
||||
return &candidate->nanoseconds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue