Skip to content

Commit

Permalink
Allow old postcircumfix:<( )> to work too, for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Mouq committed Aug 15, 2014
1 parent d7808f5 commit 08fec13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Perl6/Metamodel/BOOTSTRAP.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -2607,7 +2607,7 @@ BEGIN {
# Default invocation behavior delegates off to invoke.
my $invoke_forwarder :=
nqp::getstaticcode(sub ($self, *@pos, *%named) {
if !nqp::isconcrete($self) && !nqp::can($self, 'invoke') {
if !nqp::isconcrete($self) && !nqp::can($self, 'invoke') && !nqp::can($self, 'postcircumfix:<( )>') {
my $coercer_name := $self.HOW.name($self);
nqp::die("Cannot coerce to $coercer_name with named parameters")
if +%named;
Expand All @@ -2624,7 +2624,7 @@ BEGIN {
my $c := nqp::create(Capture);
nqp::bindattr($c, Capture, '$!list', @pos);
nqp::bindattr($c, Capture, '$!hash', %named);
$self.invoke($c);
nqp::can($self, 'invoke') ?? $self.invoke($c) !! $self.postcircumfix:<( )>($c);
}
});
Mu.HOW.set_invocation_handler(Mu, $invoke_forwarder);
Expand Down
9 changes: 8 additions & 1 deletion src/Perl6/Metamodel/InvocationProtocol.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,20 @@ role Perl6::Metamodel::InvocationProtocol {
# the default invocation forwarder. Otherwise, see if we or
# a parent has an invocation attr.
my $pcmeth := self.find_method($obj, 'invoke', :no_fallback(1));
if !nqp::isnull(pcmeth) && nqp::defined($pcmeth) {
if !nqp::isnull($pcmeth) && nqp::defined($pcmeth) {
nqp::die('Default invocation handler is not invokable')
unless nqp::isinvokable($default_invoke_handler);
nqp::setinvokespec($obj, nqp::null(), nqp::null_s(),
$default_invoke_handler);
}
else {
my $pcmeth := self.find_method($obj, 'postcircumfix:<( )>', :no_fallback(1));
if !nqp::isnull($pcmeth) && nqp::defined($pcmeth) {
nqp::die('Default invocation handler is not invokable')
unless nqp::isinvokable($default_invoke_handler);
nqp::setinvokespec($obj, nqp::null(), nqp::null_s(),
$default_invoke_handler);
}
for self.mro($obj) -> $class {
if nqp::can($class.HOW, 'has_invocation_attr') {
if $class.HOW.has_invocation_attr($class) {
Expand Down

0 comments on commit 08fec13

Please sign in to comment.