Skip to content

Commit

Permalink
Merge branch 'master' into qregex
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Jul 13, 2011
2 parents 9839f38 + 0e40138 commit 69aa482
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/how/NQPClassHOW.pm
Expand Up @@ -137,18 +137,18 @@ knowhow NQPClassHOW {
}

method compose($obj) {
# Incorporate roles. First, instantiate them with the type object
# Incorporate roles. First, specialize them with the type object
# for this type (so their $?CLASS is correct). Then delegate to
# the composer.
if @!roles {
my @instantiated_roles;
my @specialized_roles;
for @!roles {
my $ins := $_.HOW.instantiate($_, $obj);
@instantiated_roles.push($ins);
my $ins := $_.HOW.specialize($_, $obj);
@specialized_roles.push($ins);
@!done[+@!done] := $_;
@!done[+@!done] := $ins;
}
RoleToClassApplier.apply($obj, @instantiated_roles);
RoleToClassApplier.apply($obj, @specialized_roles);
}

# If we have no parents and we're not called NQPMu then add the
Expand Down
4 changes: 4 additions & 0 deletions src/how/NQPConcreteRoleHOW.pm
Expand Up @@ -138,6 +138,10 @@ knowhow NQPConcreteRoleHOW {
method roles($obj) {
@!roles
}

method does_list($obj) {
@!done
}

method instance_of($obj) {
$!instance_of
Expand Down
8 changes: 4 additions & 4 deletions src/how/NQPParametricRoleHOW.pm
Expand Up @@ -102,9 +102,9 @@ knowhow NQPParametricRoleHOW {
1
}

# This instantiates the role for the given class and builds a concrete
# This specializes the role for the given class and builds a concrete
# role.
method instantiate($obj, $class_arg) {
method specialize($obj, $class_arg) {
# Run the body block to capture the arguments into the correct
# type argument context.
$!body_block($class_arg);
Expand All @@ -128,8 +128,8 @@ knowhow NQPParametricRoleHOW {

# Copy roles, instantiating them as we go.
for @!roles {
my $instantiated := $irole.HOW.instantiate($irole, $class_arg);
$irole.HOW.add_role($irole, $instantiated);
my $specialized := $irole.HOW.specialize($irole, $class_arg);
$irole.HOW.add_role($irole, $specialized);
}

# Compose and return produced role.
Expand Down

0 comments on commit 69aa482

Please sign in to comment.