Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix bug in attribute generic instantiation discovered by moritz++.
  • Loading branch information
jnthn committed Feb 13, 2012
1 parent 3728201 commit f2f193b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Perl6/Metamodel/BOOTSTRAP.pm
Expand Up @@ -173,9 +173,11 @@ Attribute.HOW.add_method(Attribute, 'is_generic', sub ($self) {
my $dcself := pir::perl6_decontainerize__PP($self);
my $type := pir::getattribute__PPPs(pir::perl6_decontainerize__PP($dcself),
Attribute, '$!type');
my $package := pir::getattribute__PPPs(pir::perl6_decontainerize__PP($dcself),
Attribute, '$!package');
my $build := pir::getattribute__PPPs(pir::perl6_decontainerize__PP($dcself),
Attribute, '$!build_closure');
pir::perl6_booleanize__PI($type.HOW.archetypes.generic || pir::defined__IP($build));
pir::perl6_booleanize__PI($type.HOW.archetypes.generic || $package.HOW.archetypes.generic || pir::defined__IP($build));
});
Attribute.HOW.add_method(Attribute, 'instantiate_generic', sub ($self, $type_environment) {
my $dcself := pir::perl6_decontainerize__PP($self);
Expand All @@ -188,8 +190,6 @@ Attribute.HOW.add_method(Attribute, 'instantiate_generic', sub ($self, $type_env
if $type.HOW.archetypes.generic {
pir::setattribute__vPPsP($ins, Attribute, '$!type',
$type.HOW.instantiate_generic($type, $type_environment));
pir::setattribute__vPPsP($ins, Attribute, '$!package',
$pkg.HOW.instantiate_generic($pkg, $type_environment));
my $cd_ins := $cd.instantiate_generic($type_environment);
pir::setattribute__vPPsP($ins, Attribute, '$!container_descriptor', $cd_ins);
my $avc_var := pir::perl6_var__PP($avc);
Expand All @@ -200,6 +200,10 @@ Attribute.HOW.add_method(Attribute, 'instantiate_generic', sub ($self, $type_env
pir::setattribute__vPPsP($ins, Attribute, '$!auto_viv_container',
pir::setattribute__0PPsP($avc_copy, @avc_mro[$i], '$!descriptor', $cd_ins));
}
if $pkg.HOW.archetypes.generic {
pir::setattribute__vPPsP($ins, Attribute, '$!package',
$pkg.HOW.instantiate_generic($pkg, $type_environment));
}
if pir::defined__IP($bc) {
pir::setattribute__vPPsP($ins, Attribute, '$!build_closure', $bc.clone());
}
Expand Down

0 comments on commit f2f193b

Please sign in to comment.