Christoph Otto schrieb:
Christoph Otto via RT wrote:

The attached patch implements this behavior and fixes two core PMCs that had been doing the inheritance manually. All tests in make test pass. I didn't bother testing any HLLs as this is more of a "here's what I'm thinking" patch, but it's not likely there will need to be any changes other than nuking a few more now-redundant ATTRs. Obviously, the HLLs will get a test before this gets committed, barring any other objections.

+    #prepend parent ATTRs to this PMC's ATTR list
+    if (@{$pmc->{parents}} > 0 && $pmc->{parents}[0] ne 'default') {
+        my $got_attrs_from = '';
+        foreach my $parent (@{$pmc->{parents}}) {
+            my $parent_dump = $pmc2cMain->read_dump(lc($parent).'.dump');
+            if ($got_attrs_from ne '' && $parent_dump->{has_attribute}) {
+                die "$filename is trying to extend $got_attrs_from and $parent, 
".
+                    "but both these PMCs have ATTRs.";
+            }
+            if ($parent_dump->{has_attribute}) {
+                $got_attrs_from = $parent;
+                foreach my $parent_attrs (@{$parent_dump->{attributes}}) {
+                    $pmc->add_attribute($parent_attrs);
+                }
+            }
+        }
+    }
+

I am wondering about the check with check with $got_attrs_from.
How is the case handled, where an PMC 'child' inherits from the PMC 'parent'
and 'child' wants to add an attribute to the attributes inherited from 'parent' ?

Regards,
  Bernhard

Reply via email to