@@ -17,7 +17,7 @@ namespace JS::Temporal {
17
17
18
18
// 5.3 Properties of the Temporal.PlainDateTime Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-plaindatetime-prototype-object
19
19
PlainDateTimePrototype::PlainDateTimePrototype (GlobalObject& global_object)
20
- : Object (*global_object.object_prototype())
20
+ : PrototypeObject (*global_object.object_prototype())
21
21
{
22
22
}
23
23
@@ -65,25 +65,12 @@ void PlainDateTimePrototype::initialize(GlobalObject& global_object)
65
65
define_native_function (vm.names .getISOFields , get_iso_fields, 0 , attr);
66
66
}
67
67
68
- static PlainDateTime* typed_this (GlobalObject& global_object)
69
- {
70
- auto & vm = global_object.vm ();
71
- auto * this_object = vm.this_value (global_object).to_object (global_object);
72
- if (!this_object)
73
- return {};
74
- if (!is<PlainDateTime>(this_object)) {
75
- vm.throw_exception <TypeError>(global_object, ErrorType::NotAnObjectOfType, " Temporal.PlainDateTime" );
76
- return {};
77
- }
78
- return static_cast <PlainDateTime*>(this_object);
79
- }
80
-
81
68
// 5.3.3 get Temporal.PlainDateTime.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.calendar
82
69
JS_DEFINE_NATIVE_FUNCTION (PlainDateTimePrototype::calendar_getter)
83
70
{
84
71
// 1. Let dateTime be the this value.
85
72
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
86
- auto * date_time = typed_this (global_object);
73
+ auto * date_time = typed_this_object (global_object);
87
74
if (vm.exception ())
88
75
return {};
89
76
@@ -96,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::year_getter)
96
83
{
97
84
// 1. Let dateTime be the this value.
98
85
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
99
- auto * date_time = typed_this (global_object);
86
+ auto * date_time = typed_this_object (global_object);
100
87
if (vm.exception ())
101
88
return {};
102
89
@@ -112,7 +99,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_getter)
112
99
{
113
100
// 1. Let dateTime be the this value.
114
101
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
115
- auto * date_time = typed_this (global_object);
102
+ auto * date_time = typed_this_object (global_object);
116
103
if (vm.exception ())
117
104
return {};
118
105
@@ -128,7 +115,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_code_getter)
128
115
{
129
116
// 1. Let dateTime be the this value.
130
117
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
131
- auto * date_time = typed_this (global_object);
118
+ auto * date_time = typed_this_object (global_object);
132
119
if (vm.exception ())
133
120
return {};
134
121
@@ -144,7 +131,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_getter)
144
131
{
145
132
// 1. Let dateTime be the this value.
146
133
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
147
- auto * date_time = typed_this (global_object);
134
+ auto * date_time = typed_this_object (global_object);
148
135
if (vm.exception ())
149
136
return {};
150
137
@@ -160,7 +147,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::hour_getter)
160
147
{
161
148
// 1. Let dateTime be the this value.
162
149
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
163
- auto * date_time = typed_this (global_object);
150
+ auto * date_time = typed_this_object (global_object);
164
151
if (vm.exception ())
165
152
return {};
166
153
@@ -173,7 +160,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::minute_getter)
173
160
{
174
161
// 1. Let dateTime be the this value.
175
162
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
176
- auto * date_time = typed_this (global_object);
163
+ auto * date_time = typed_this_object (global_object);
177
164
if (vm.exception ())
178
165
return {};
179
166
@@ -186,7 +173,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::second_getter)
186
173
{
187
174
// 1. Let dateTime be the this value.
188
175
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
189
- auto * date_time = typed_this (global_object);
176
+ auto * date_time = typed_this_object (global_object);
190
177
if (vm.exception ())
191
178
return {};
192
179
@@ -199,7 +186,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::millisecond_getter)
199
186
{
200
187
// 1. Let dateTime be the this value.
201
188
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
202
- auto * date_time = typed_this (global_object);
189
+ auto * date_time = typed_this_object (global_object);
203
190
if (vm.exception ())
204
191
return {};
205
192
@@ -212,7 +199,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::microsecond_getter)
212
199
{
213
200
// 1. Let dateTime be the this value.
214
201
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
215
- auto * date_time = typed_this (global_object);
202
+ auto * date_time = typed_this_object (global_object);
216
203
if (vm.exception ())
217
204
return {};
218
205
@@ -225,7 +212,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::nanosecond_getter)
225
212
{
226
213
// 1. Let dateTime be the this value.
227
214
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
228
- auto * date_time = typed_this (global_object);
215
+ auto * date_time = typed_this_object (global_object);
229
216
if (vm.exception ())
230
217
return {};
231
218
@@ -238,7 +225,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_week_getter)
238
225
{
239
226
// 1. Let dateTime be the this value.
240
227
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
241
- auto * date_time = typed_this (global_object);
228
+ auto * date_time = typed_this_object (global_object);
242
229
if (vm.exception ())
243
230
return {};
244
231
@@ -254,7 +241,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_year_getter)
254
241
{
255
242
// 1. Let dateTime be the this value.
256
243
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
257
- auto * date_time = typed_this (global_object);
244
+ auto * date_time = typed_this_object (global_object);
258
245
if (vm.exception ())
259
246
return {};
260
247
@@ -270,7 +257,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::week_of_year_getter)
270
257
{
271
258
// 1. Let dateTime be the this value.
272
259
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
273
- auto * date_time = typed_this (global_object);
260
+ auto * date_time = typed_this_object (global_object);
274
261
if (vm.exception ())
275
262
return {};
276
263
@@ -286,7 +273,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_week_getter)
286
273
{
287
274
// 1. Let dateTime be the this value.
288
275
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
289
- auto * date_time = typed_this (global_object);
276
+ auto * date_time = typed_this_object (global_object);
290
277
if (vm.exception ())
291
278
return {};
292
279
@@ -302,7 +289,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_month_getter)
302
289
{
303
290
// 1. Let dateTime be the this value.
304
291
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
305
- auto * date_time = typed_this (global_object);
292
+ auto * date_time = typed_this_object (global_object);
306
293
if (vm.exception ())
307
294
return {};
308
295
@@ -318,7 +305,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_year_getter)
318
305
{
319
306
// 1. Let dateTime be the this value.
320
307
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
321
- auto * date_time = typed_this (global_object);
308
+ auto * date_time = typed_this_object (global_object);
322
309
if (vm.exception ())
323
310
return {};
324
311
@@ -334,7 +321,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::months_in_year_getter)
334
321
{
335
322
// 1. Let dateTime be the this value.
336
323
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
337
- auto * date_time = typed_this (global_object);
324
+ auto * date_time = typed_this_object (global_object);
338
325
if (vm.exception ())
339
326
return {};
340
327
@@ -350,7 +337,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::in_leap_year_getter)
350
337
{
351
338
// 1. Let dateTime be the this value.
352
339
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
353
- auto * date_time = typed_this (global_object);
340
+ auto * date_time = typed_this_object (global_object);
354
341
if (vm.exception ())
355
342
return {};
356
343
@@ -366,7 +353,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::era_getter)
366
353
{
367
354
// 1. Let plainDateTime be the this value.
368
355
// 2. Perform ? RequireInternalSlot(plainDateTime, [[InitializedTemporalDateTime]]).
369
- auto * plain_date_time = typed_this (global_object);
356
+ auto * plain_date_time = typed_this_object (global_object);
370
357
if (vm.exception ())
371
358
return {};
372
359
@@ -382,7 +369,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::era_year_getter)
382
369
{
383
370
// 1. Let plainDateTime be the this value.
384
371
// 2. Perform ? RequireInternalSlot(plainDateTime, [[InitializedTemporalDateTime]]).
385
- auto * plain_date_time = typed_this (global_object);
372
+ auto * plain_date_time = typed_this_object (global_object);
386
373
if (vm.exception ())
387
374
return {};
388
375
@@ -398,7 +385,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_time)
398
385
{
399
386
// 1. Let dateTime be the this value.
400
387
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
401
- auto * date_time = typed_this (global_object);
388
+ auto * date_time = typed_this_object (global_object);
402
389
if (vm.exception ())
403
390
return {};
404
391
@@ -422,7 +409,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_date)
422
409
{
423
410
// 1. Let dateTime be the this value.
424
411
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
425
- auto * date_time = typed_this (global_object);
412
+ auto * date_time = typed_this_object (global_object);
426
413
if (vm.exception ())
427
414
return {};
428
415
@@ -445,7 +432,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_calendar)
445
432
{
446
433
// 1. Let dateTime be the this value.
447
434
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
448
- auto * date_time = typed_this (global_object);
435
+ auto * date_time = typed_this_object (global_object);
449
436
if (vm.exception ())
450
437
return {};
451
438
@@ -463,7 +450,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::equals)
463
450
{
464
451
// 1. Let dateTime be the this value.
465
452
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
466
- auto * date_time = typed_this (global_object);
453
+ auto * date_time = typed_this_object (global_object);
467
454
if (vm.exception ())
468
455
return {};
469
456
@@ -496,7 +483,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_date)
496
483
{
497
484
// 1. Let dateTime be the this value.
498
485
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
499
- auto * date_time = typed_this (global_object);
486
+ auto * date_time = typed_this_object (global_object);
500
487
if (vm.exception ())
501
488
return {};
502
489
@@ -509,7 +496,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_year_month)
509
496
{
510
497
// 1. Let dateTime be the this value.
511
498
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
512
- auto * date_time = typed_this (global_object);
499
+ auto * date_time = typed_this_object (global_object);
513
500
if (vm.exception ())
514
501
return {};
515
502
@@ -535,7 +522,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_month_day)
535
522
{
536
523
// 1. Let dateTime be the this value.
537
524
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
538
- auto * date_time = typed_this (global_object);
525
+ auto * date_time = typed_this_object (global_object);
539
526
if (vm.exception ())
540
527
return {};
541
528
@@ -561,7 +548,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_time)
561
548
{
562
549
// 1. Let dateTime be the this value.
563
550
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
564
- auto * date_time = typed_this (global_object);
551
+ auto * date_time = typed_this_object (global_object);
565
552
if (vm.exception ())
566
553
return {};
567
554
@@ -574,7 +561,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::get_iso_fields)
574
561
{
575
562
// 1. Let dateTime be the this value.
576
563
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
577
- auto * date_time = typed_this (global_object);
564
+ auto * date_time = typed_this_object (global_object);
578
565
if (vm.exception ())
579
566
return {};
580
567
0 commit comments