@@ -47,6 +47,16 @@ PMC * decontainerize(PARROT_INTERP, PMC *var) {
47
47
return var;
48
48
}
49
49
50
+ /* Looks up an attribute, after checking we don't have a type object. */
51
+ static PMC *get_attr(PARROT_INTERP, PMC *self, PMC *handle, STRING *name, INTVAL hint) {
52
+ if (IS_CONCRETE(self))
53
+ return REPR(self)->get_attribute_boxed(interp, STABLE(self), OBJECT_BODY(self), handle, name, hint);
54
+ else
55
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
56
+ "Cannot look up attributes in a type object");
57
+ }
58
+
59
+
50
60
pmclass SixModelObject manual_attrs dynpmc group nqp {
51
61
/* ********************************************** *
52
62
* These methods are mapped to 6model primitives. *
@@ -84,7 +94,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
84
94
85
95
VTABLE PMC* get_attr_keyed(PMC *class_handle, STRING *name) {
86
96
PMC *handle = decontainerize(interp, class_handle);
87
- return REPR(SELF)->get_attribute (interp, SELF, handle, name, NO_HINT);
97
+ return get_attr (interp, SELF, handle, name, NO_HINT);
88
98
}
89
99
90
100
VTABLE void set_attr_keyed(PMC *class_handle, STRING *name, PMC* value) {
@@ -268,7 +278,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
268
278
return VTABLE_get_pmc_keyed_int(interp, cappy, 0);
269
279
}
270
280
else if (vth && vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED].class_handle) {
271
- PMC *val = REPR(decont)->get_attribute (interp, decont,
281
+ PMC *val = get_attr (interp, decont,
272
282
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED].class_handle,
273
283
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED].attr_name,
274
284
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED].hint);
@@ -295,7 +305,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
295
305
return VTABLE_get_pmc_keyed_int(interp, cappy, 0);
296
306
}
297
307
else if (vth && vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED_INT].class_handle) {
298
- PMC *val = REPR(decont)->get_attribute (interp, decont,
308
+ PMC *val = get_attr (interp, decont,
299
309
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED_INT].class_handle,
300
310
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED_INT].attr_name,
301
311
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED_INT].hint);
@@ -321,7 +331,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
321
331
return VTABLE_get_pmc_keyed_int(interp, cappy, 0);
322
332
}
323
333
else if (vth && vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED_STR].class_handle) {
324
- PMC *val = REPR(decont)->get_attribute (interp, decont,
334
+ PMC *val = get_attr (interp, decont,
325
335
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED_STR].class_handle,
326
336
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED_STR].attr_name,
327
337
vth[PARROT_VTABLE_SLOT_GET_PMC_KEYED_STR].hint);
@@ -353,7 +363,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
353
363
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
354
364
}
355
365
else if (vth && vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED].class_handle) {
356
- PMC *val = REPR(decont)->get_attribute (interp, decont,
366
+ PMC *val = get_attr (interp, decont,
357
367
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED].class_handle,
358
368
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED].attr_name,
359
369
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED].hint);
@@ -379,7 +389,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
379
389
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
380
390
}
381
391
else if (vth && vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED_INT].class_handle) {
382
- PMC *val = REPR(decont)->get_attribute (interp, decont,
392
+ PMC *val = get_attr (interp, decont,
383
393
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED_INT].class_handle,
384
394
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED_INT].attr_name,
385
395
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED_INT].hint);
@@ -404,7 +414,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
404
414
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
405
415
}
406
416
else if (vth && vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED_STR].class_handle) {
407
- PMC *val = REPR(decont)->get_attribute (interp, decont,
417
+ PMC *val = get_attr (interp, decont,
408
418
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED_STR].class_handle,
409
419
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED_STR].attr_name,
410
420
vth[PARROT_VTABLE_SLOT_SET_PMC_KEYED_STR].hint);
@@ -437,7 +447,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
437
447
return VTABLE_get_integer_keyed_int(interp, cappy, 0);
438
448
}
439
449
else if (vth && vth[PARROT_VTABLE_SLOT_EXISTS_KEYED].class_handle) {
440
- PMC *val = REPR(decont)->get_attribute (interp, decont,
450
+ PMC *val = get_attr (interp, decont,
441
451
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED].class_handle,
442
452
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED].attr_name,
443
453
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED].hint);
@@ -464,7 +474,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
464
474
return VTABLE_get_integer_keyed_int(interp, cappy, 0);
465
475
}
466
476
else if (vth && vth[PARROT_VTABLE_SLOT_EXISTS_KEYED_INT].class_handle) {
467
- PMC *val = REPR(decont)->get_attribute (interp, decont,
477
+ PMC *val = get_attr (interp, decont,
468
478
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED_INT].class_handle,
469
479
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED_INT].attr_name,
470
480
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED_INT].hint);
@@ -490,7 +500,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
490
500
return VTABLE_get_integer_keyed_int(interp, cappy, 0);
491
501
}
492
502
else if (vth && vth[PARROT_VTABLE_SLOT_EXISTS_KEYED_STR].class_handle) {
493
- PMC *val = REPR(decont)->get_attribute (interp, decont,
503
+ PMC *val = get_attr (interp, decont,
494
504
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED_STR].class_handle,
495
505
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED_STR].attr_name,
496
506
vth[PARROT_VTABLE_SLOT_EXISTS_KEYED_STR].hint);
@@ -522,7 +532,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
522
532
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
523
533
}
524
534
else if (vth && vth[PARROT_VTABLE_SLOT_DELETE_KEYED].class_handle) {
525
- PMC *val = REPR(decont)->get_attribute (interp, decont,
535
+ PMC *val = get_attr (interp, decont,
526
536
vth[PARROT_VTABLE_SLOT_DELETE_KEYED].class_handle,
527
537
vth[PARROT_VTABLE_SLOT_DELETE_KEYED].attr_name,
528
538
vth[PARROT_VTABLE_SLOT_DELETE_KEYED].hint);
@@ -548,7 +558,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
548
558
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
549
559
}
550
560
else if (vth && vth[PARROT_VTABLE_SLOT_DELETE_KEYED_INT].class_handle) {
551
- PMC *val = REPR(decont)->get_attribute (interp, decont,
561
+ PMC *val = get_attr (interp, decont,
552
562
vth[PARROT_VTABLE_SLOT_DELETE_KEYED_INT].class_handle,
553
563
vth[PARROT_VTABLE_SLOT_DELETE_KEYED_INT].attr_name,
554
564
vth[PARROT_VTABLE_SLOT_DELETE_KEYED_INT].hint);
@@ -573,7 +583,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
573
583
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
574
584
}
575
585
else if (vth && vth[PARROT_VTABLE_SLOT_DELETE_KEYED_STR].class_handle) {
576
- PMC *val = REPR(decont)->get_attribute (interp, decont,
586
+ PMC *val = get_attr (interp, decont,
577
587
vth[PARROT_VTABLE_SLOT_DELETE_KEYED_STR].class_handle,
578
588
vth[PARROT_VTABLE_SLOT_DELETE_KEYED_STR].attr_name,
579
589
vth[PARROT_VTABLE_SLOT_DELETE_KEYED_STR].hint);
@@ -598,7 +608,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
598
608
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
599
609
}
600
610
else if (vth && vth[PARROT_VTABLE_SLOT_UNSHIFT_PMC].class_handle) {
601
- PMC *val = REPR(decont)->get_attribute (interp, decont,
611
+ PMC *val = get_attr (interp, decont,
602
612
vth[PARROT_VTABLE_SLOT_UNSHIFT_PMC].class_handle,
603
613
vth[PARROT_VTABLE_SLOT_UNSHIFT_PMC].attr_name,
604
614
vth[PARROT_VTABLE_SLOT_UNSHIFT_PMC].hint);
@@ -623,7 +633,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
623
633
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
624
634
}
625
635
else if (vth && vth[PARROT_VTABLE_SLOT_PUSH_PMC].class_handle) {
626
- PMC *val = REPR(decont)->get_attribute (interp, decont,
636
+ PMC *val = get_attr (interp, decont,
627
637
vth[PARROT_VTABLE_SLOT_PUSH_PMC].class_handle,
628
638
vth[PARROT_VTABLE_SLOT_PUSH_PMC].attr_name,
629
639
vth[PARROT_VTABLE_SLOT_PUSH_PMC].hint);
@@ -645,7 +655,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
645
655
return (opcode_t *)next;
646
656
}
647
657
else if (vth && vth[PARROT_VTABLE_SLOT_INVOKE].class_handle) {
648
- PMC *val = REPR(decont)->get_attribute (interp, decont,
658
+ PMC *val = get_attr (interp, decont,
649
659
vth[PARROT_VTABLE_SLOT_INVOKE].class_handle,
650
660
vth[PARROT_VTABLE_SLOT_INVOKE].attr_name,
651
661
vth[PARROT_VTABLE_SLOT_INVOKE].hint);
@@ -670,7 +680,7 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
670
680
return VTABLE_get_pmc_keyed_int(interp, cappy, 0);
671
681
}
672
682
else if (vth && vth[PARROT_VTABLE_SLOT_GET_ITER].class_handle) {
673
- PMC *val = REPR(decont)->get_attribute (interp, decont,
683
+ PMC *val = get_attr (interp, decont,
674
684
vth[PARROT_VTABLE_SLOT_GET_ITER].class_handle,
675
685
vth[PARROT_VTABLE_SLOT_GET_ITER].attr_name,
676
686
vth[PARROT_VTABLE_SLOT_GET_ITER].hint);
0 commit comments