Skip to content

Commit

Permalink
Allow defining multi-subs with inlining annotations
Browse files Browse the repository at this point in the history
The inline primitive form will be used for calls to the base function.
If it is augmented, multi-dispatch will be used.
  • Loading branch information
sorear committed Jan 1, 2012
1 parent 6406010 commit b5d9d05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/CodeGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3846,7 +3846,7 @@ object Call(object[] args) {
r = new object[] { "simple",null,null,null, lsimp.flags, Handle.Wrap(lsimp.type) };
var ldisp = li as LIDispatch;
if (ldisp != null)
r = new object[] { "dispatch",null,null,null };
r = new object[] { "dispatch",null,null,null, Handle.Wrap(csr) };
var llab = li as LILabel;
if (llab != null)
r = new object[] { "label",null,null,null };
Expand Down
6 changes: 5 additions & 1 deletion src/NieczaPassSimplifier.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ sub run_optree($body, $op, $nv) {
return $op unless $inv.^isa(::Op::Lexical);
my $invname = $inv.name;
my @inv_lex = $body.lookup_lex($invname);
return $op unless @inv_lex && @inv_lex[0] eq 'sub';
return $op unless @inv_lex;
@inv_lex = $body.lookup_lex($invname ~ ':(!proto)')
if @inv_lex[0] eq 'dispatch' &&
@inv_lex[4].has_lexical($invname ~ ':(!proto)');
return $op unless @inv_lex[0] eq 'sub';

if @inv_lex[4].get_extend('builtin') -> $B {
return $op unless defined my $args = no_named_params($op);
Expand Down

0 comments on commit b5d9d05

Please sign in to comment.