1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:57:44 +00:00

LibJS: Remove assertions that are now part of structured headers

This is an editorial change in the Temporal spec.

See:
- 7fbdd28
- f666243
- 8c7d066
- 307d108
- d9ca402

In practical terms this means we can now get rid of a couple of awkward
assertion steps that were no-ops anyway, since the types are enforced
by the compiler.
This commit is contained in:
Linus Groh 2022-03-09 23:51:53 +01:00
parent 97bd4cebab
commit 64e43c89bc
5 changed files with 86 additions and 106 deletions

View file

@ -158,13 +158,10 @@ String temporal_duration_to_string(double years, double months, double weeks, do
template<typename EarlierObjectType, typename LaterObjectType>
double days_until(GlobalObject& global_object, EarlierObjectType& earlier, LaterObjectType& later)
{
// 1. Assert: earlier and later both have [[ISOYear]], [[ISOMonth]], and [[ISODay]] internal slots.
// NOTE: We could enforce this via concepts, but the compiler would complain anyway if either of the types doesn't have the methods used below.
// 2. Let difference be ! DifferenceISODate(earlier.[[ISOYear]], earlier.[[ISOMonth]], earlier.[[ISODay]], later.[[ISOYear]], later.[[ISOMonth]], later.[[ISODay]], "day").
// 1. Let difference be ! DifferenceISODate(earlier.[[ISOYear]], earlier.[[ISOMonth]], earlier.[[ISODay]], later.[[ISOYear]], later.[[ISOMonth]], later.[[ISODay]], "day").
auto difference = difference_iso_date(global_object, earlier.iso_year(), earlier.iso_month(), earlier.iso_day(), later.iso_year(), later.iso_month(), later.iso_day(), "day"sv);
// 3. Return difference.[[Days]].
// 2. Return difference.[[Days]].
return difference.days;
}