Skip to content
Permalink
Browse files

Update type check cache for non-generic currings.

  • Loading branch information...
vrurg committed Feb 22, 2019
1 parent 8629088 commit 5f07a3940a29213199b6e7edff6efc75852a12d5
Showing with 27 additions and 18 deletions.
  1. +27 −18 src/Perl6/Metamodel/CurriedRoleHOW.nqp
@@ -26,24 +26,30 @@ class Perl6::Metamodel::CurriedRoleHOW
has %!named_args;
has @!role_typecheck_list;
has $!is_complete;
has $!archetypes;

my $archetypes_g := Perl6::Metamodel::Archetypes.new( :composable(1), :inheritalizable(1), :parametric(1), :generic(1) );
my $archetypes_ng := Perl6::Metamodel::Archetypes.new( :nominal(1), :composable(1), :inheritalizable(1), :parametric(1) );
method archetypes() {
if nqp::isconcrete(self) {
for @!pos_args {
if $_.HOW.archetypes.generic {
return $archetypes_g;
}
method !choose_archetype() {
for @!pos_args {
if $_.HOW.archetypes.generic {
return $archetypes_g;
}
for %!named_args {
if $_.value.HOW.archetypes.generic {
return $archetypes_g;
}
}
for %!named_args {
if $_.value.HOW.archetypes.generic {
return $archetypes_g;
}
}
$archetypes_ng
}
method archetypes() {
if nqp::isconcrete(self) {
$!archetypes := self.'!choose_archetype'() unless $!archetypes;
return $!archetypes;
}
$archetypes_ng
}

method new(*%named) {
nqp::findmethod(NQPMu, 'BUILDALL')(nqp::create(self), |%named)
@@ -66,14 +72,6 @@ class Perl6::Metamodel::CurriedRoleHOW
nqp::settypecheckmode($type, 2);
}

method complete_parameterization($obj) {
unless $!is_complete {
self.parameterize_roles($obj);
self.update_role_typecheck_list($obj);
$!is_complete := 1;
}
}

method parameterize_roles($obj) {
my @pos_args;
nqp::push(@pos_args, $obj);
@@ -112,6 +110,17 @@ class Perl6::Metamodel::CurriedRoleHOW
}
}
@!role_typecheck_list := @rtl;
unless self.archetypes.generic {
nqp::settypecache($obj, @rtl);
}
}

method complete_parameterization($obj) {
unless $!is_complete {
self.parameterize_roles($obj);
self.update_role_typecheck_list($obj);
$!is_complete := 1;
}
}

method instantiate_generic($obj, $type_env) {

0 comments on commit 5f07a39

Please sign in to comment.
You can’t perform that action at this time.