Skip to content

Commit

Permalink
enable POSTBUILD to take part in object construction
Browse files Browse the repository at this point in the history
it will be called after everything else has been done. it'll
get the same arguments as the BUILD submethod, but things have
already been initialized, default values populated, ...
  • Loading branch information
timo committed Nov 5, 2016
1 parent 9f94525 commit fdc90a2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Perl6/Metamodel/BUILDPLAN.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ role Perl6::Metamodel::BUILDPLAN {
@plan[+@plan] := [13, $obj, $_.key];
}

# Does it have a POSTBUILD?
my $postbuild := $obj.HOW.find_method($obj, 'POSTBUILD', :no_fallback(1));
if !nqp::isnull($postbuild) && $postbuild {
@plan[+@plan] := [0, $postbuild];
}

# Install plan for this class.
@!BUILDPLAN := @plan;

Expand Down

0 comments on commit fdc90a2

Please sign in to comment.