Commit 4c4edd1
committed
refactor: extract this-type-check boilerplate into require_internal_slot! macro
Replace the repeated as_object/downcast_ref/ok_or_else boilerplate with
a single require_internal_slot! macro defined in builtins/mod.rs.
The macro produces two let-bindings in the caller's scope: one for the
owned JsObject (to keep it alive) and one for the downcast Ref<T>.
Uses the js_error! macro internally for error construction.
Temporal modules (163 replacements):
- zoneddatetime, plain_date_time, plain_time, plain_year_month,
plain_date, duration, instant, plain_month_day
Other builtins (32 replacements):
- date (9), dataview (5), typed_array (4), array_buffer (4),
shared_array_buffer (3), weak_map (2), intl/segmenter (2),
intl/collator (1), weak_set (1), weak_ref (1)1 parent 66a1cd2 commit 4c4edd1
File tree
21 files changed
+272
-1479
lines changed- core/engine/src/builtins
- array_buffer
- dataview
- date
- intl
- collator
- segmenter
- temporal
- duration
- instant
- plain_date_time
- plain_date
- plain_month_day
- plain_time
- plain_year_month
- zoneddatetime
- typed_array
- weak_map
- weak_set
- weak
21 files changed
+272
-1479
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
| 499 | + | |
507 | 500 | | |
508 | 501 | | |
509 | 502 | | |
| |||
522 | 515 | | |
523 | 516 | | |
524 | 517 | | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
| 518 | + | |
534 | 519 | | |
535 | 520 | | |
536 | 521 | | |
| |||
556 | 541 | | |
557 | 542 | | |
558 | 543 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
| 544 | + | |
567 | 545 | | |
568 | 546 | | |
569 | 547 | | |
| |||
581 | 559 | | |
582 | 560 | | |
583 | 561 | | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
| 562 | + | |
592 | 563 | | |
593 | 564 | | |
594 | 565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 228 | + | |
236 | 229 | | |
237 | 230 | | |
238 | 231 | | |
| |||
252 | 245 | | |
253 | 246 | | |
254 | 247 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 248 | + | |
263 | 249 | | |
264 | 250 | | |
265 | 251 | | |
| |||
276 | 262 | | |
277 | 263 | | |
278 | 264 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
| 265 | + | |
287 | 266 | | |
288 | 267 | | |
289 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 334 | + | |
339 | 335 | | |
340 | 336 | | |
341 | 337 | | |
| |||
361 | 357 | | |
362 | 358 | | |
363 | 359 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
| 360 | + | |
369 | 361 | | |
370 | 362 | | |
371 | 363 | | |
| |||
404 | 396 | | |
405 | 397 | | |
406 | 398 | | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
| 399 | + | |
412 | 400 | | |
413 | 401 | | |
414 | 402 | | |
| |||
448 | 436 | | |
449 | 437 | | |
450 | 438 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| 439 | + | |
456 | 440 | | |
457 | 441 | | |
458 | 442 | | |
| |||
790 | 774 | | |
791 | 775 | | |
792 | 776 | | |
793 | | - | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
| 777 | + | |
798 | 778 | | |
799 | 779 | | |
800 | 780 | | |
| |||
0 commit comments