summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Temporal
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-12-14 12:17:58 +0100
committerAndreas Kling <kling@serenityos.org>2022-12-14 15:11:57 +0100
commit4abdb68655340b66ee0d2b63cd384d46edd00d56 (patch)
tree0c657357a3a57e0eee379144926bea5e6e2cc7b6 /Userland/Libraries/LibJS/Runtime/Temporal
parent42b5c896e86b0d77d62ecae0ec78802aaff285a1 (diff)
downloadserenity-4abdb68655340b66ee0d2b63cd384d46edd00d56.zip
LibJS: Remove Object(Object& prototype) footgun
This constructor was easily confused with a copy constructor, and it was possible to accidentally copy-construct Objects in at least one way that we dicovered (via generic ThrowCompletionOr construction). This patch adds a mandatory ConstructWithPrototypeTag parameter to the constructor to disambiguate it.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp2
12 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
index e44f435aa6..c4ed4b55da 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
@@ -28,7 +28,7 @@ namespace JS::Temporal {
// 12 Temporal.Calendar Objects, https://tc39.es/proposal-temporal/#sec-temporal-calendar-objects
Calendar::Calendar(DeprecatedString identifier, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_identifier(move(identifier))
{
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
index 5573fe3c60..fb211a2d6c 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
@@ -24,7 +24,7 @@ namespace JS::Temporal {
// 7 Temporal.Duration Objects, https://tc39.es/proposal-temporal/#sec-temporal-duration-objects
Duration::Duration(double years, double months, double weeks, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_years(years)
, m_months(months)
, m_weeks(weeks)
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
index 534a8c84d1..dff5500db8 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
@@ -24,7 +24,7 @@ namespace JS::Temporal {
// 8 Temporal.Instant Objects, https://tc39.es/proposal-temporal/#sec-temporal-instant-objects
Instant::Instant(BigInt const& nanoseconds, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_nanoseconds(nanoseconds)
{
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp
index 2602079f20..3e0b5af636 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp
@@ -22,7 +22,7 @@ namespace JS::Temporal {
// 2 The Temporal.Now Object, https://tc39.es/proposal-temporal/#sec-temporal-now-object
Now::Now(Realm& realm)
- : Object(*realm.intrinsics().object_prototype())
+ : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp
index d13b934fd1..7d20d7d91d 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp
@@ -24,7 +24,7 @@ namespace JS::Temporal {
// 3 Temporal.PlainDate Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaindate-objects
PlainDate::PlainDate(i32 year, u8 month, u8 day, Object& calendar, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_year(year)
, m_iso_month(month)
, m_iso_day(day)
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp
index fc5771ddf8..dc1249b49c 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp
@@ -25,7 +25,7 @@ namespace JS::Temporal {
// 5 Temporal.PlainDateTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaindatetime-objects
PlainDateTime::PlainDateTime(i32 iso_year, u8 iso_month, u8 iso_day, u8 iso_hour, u8 iso_minute, u8 iso_second, u16 iso_millisecond, u16 iso_microsecond, u16 iso_nanosecond, Object& calendar, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_year(iso_year)
, m_iso_month(iso_month)
, m_iso_day(iso_day)
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp
index 68f7e2adfb..fce9dc46e5 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp
@@ -20,7 +20,7 @@ namespace JS::Temporal {
// 10 Temporal.PlainMonthDay Objects, https://tc39.es/proposal-temporal/#sec-temporal-plainmonthday-objects
PlainMonthDay::PlainMonthDay(u8 iso_month, u8 iso_day, i32 iso_year, Object& calendar, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_year(iso_year)
, m_iso_month(iso_month)
, m_iso_day(iso_day)
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
index fa3ca3ab30..9bd34f226d 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
@@ -24,7 +24,7 @@ namespace JS::Temporal {
// 4 Temporal.PlainTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaintime-objects
PlainTime::PlainTime(u8 iso_hour, u8 iso_minute, u8 iso_second, u16 iso_millisecond, u16 iso_microsecond, u16 iso_nanosecond, Calendar& calendar, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_hour(iso_hour)
, m_iso_minute(iso_minute)
, m_iso_second(iso_second)
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp
index 5c10f92938..c0f89530c9 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp
@@ -19,7 +19,7 @@ namespace JS::Temporal {
// 9 Temporal.PlainYearMonth Objects, https://tc39.es/proposal-temporal/#sec-temporal-plainyearmonth-objects
PlainYearMonth::PlainYearMonth(i32 iso_year, u8 iso_month, u8 iso_day, Object& calendar, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_year(iso_year)
, m_iso_month(iso_month)
, m_iso_day(iso_day)
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp
index 5d22c434f2..75c468d8b2 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp
@@ -22,7 +22,7 @@ namespace JS::Temporal {
// 1 The Temporal Object, https://tc39.es/proposal-temporal/#sec-temporal-objects
Temporal::Temporal(Realm& realm)
- : Object(*realm.intrinsics().object_prototype())
+ : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
index cfc480264b..7d2878a93f 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
@@ -25,7 +25,7 @@ namespace JS::Temporal {
// 11 Temporal.TimeZone Objects, https://tc39.es/proposal-temporal/#sec-temporal-timezone-objects
TimeZone::TimeZone(Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
{
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp
index 9f752e5f84..c67470cf57 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp
@@ -22,7 +22,7 @@ namespace JS::Temporal {
// 6 Temporal.ZonedDateTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-zoneddatetime-objects
ZonedDateTime::ZonedDateTime(BigInt const& nanoseconds, Object& time_zone, Object& calendar, Object& prototype)
- : Object(prototype)
+ : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_nanoseconds(nanoseconds)
, m_time_zone(time_zone)
, m_calendar(calendar)