Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
subs should want their return value, duh
  • Loading branch information
TimToady committed Dec 16, 2015
1 parent b6373d5 commit 33ac495
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/Perl6/Actions.nqp
Expand Up @@ -80,10 +80,19 @@ sub wanted($ast,$by) {
$ast.annotate('past_block', wanted($ast.ann('past_block'), $byby));
$ast.annotate('WANTED',1);
}
elsif $ast.op eq 'call' || $ast.op eq 'callstatic' || $ast.op eq 'callmethod' || $ast.op eq 'handle' || $ast.op eq 'locallifetime' {
elsif $ast.op eq 'call' ||
$ast.op eq 'callstatic' ||
$ast.op eq 'callmethod' ||
$ast.op eq 'handle' ||
$ast.op eq 'locallifetime' ||
$ast.op eq 'p6typecheckrv' ||
$ast.op eq 'lexotic' ||
False {
$ast[0] := WANTED($ast[0], $byby) if +@($ast);
}
elsif $ast.op eq 'while' {
elsif $ast.op eq 'while' ||
$ast.op eq 'p6decontrv' ||
False {
$ast[1] := WANTED($ast[1], $byby) if +@($ast);
}
}
Expand Down Expand Up @@ -156,10 +165,19 @@ sub unwanted($ast, $by) {
$ast.annotate('past_block', unwanted($ast.ann('past_block'), $byby));
$ast.annotate('context','sink');
}
elsif $ast.op eq 'call' || $ast.op eq 'callstatic' || $ast.op eq 'callmethod' || $ast.op eq 'handle' || $ast.op eq 'locallifetime' {
elsif $ast.op eq 'call' ||
$ast.op eq 'callstatic' ||
$ast.op eq 'callmethod' ||
$ast.op eq 'handle' ||
$ast.op eq 'locallifetime' ||
$ast.op eq 'p6typecheckrv' ||
$ast.op eq 'lexotic' ||
False {
$ast[0] := UNWANTED($ast[0], $byby) if +@($ast);
}
elsif $ast.op eq 'while' {
elsif $ast.op eq 'while' ||
$ast.op eq 'p6decontrv' ||
False {
$ast[1] := UNWANTED($ast[1], $byby) if +@($ast);
}
}
Expand Down Expand Up @@ -3091,11 +3109,11 @@ Compilation unit '$file' contained the following violations:
}
else {
if $<blockoid> {
$block := $<blockoid>.ast;
$block := WANTED($<blockoid>.ast,'&defoid');
} else {
$block := $*CURPAD;
$block.blocktype('declaration_static');
$block.push($<statementlist>.ast);
$block.push(WANTED($<statementlist>.ast,'&def'));
$block.node($/);
}
if is_clearly_returnless($block) {
Expand Down Expand Up @@ -6203,7 +6221,7 @@ Compilation unit '$file' contained the following violations:
),

# And finally evaluate to the smart-match result.
QAST::Var.new( :name($result_var), :scope('local') )
WANTED(QAST::Var.new( :name($result_var), :scope('local') ),'make_sm')
),
$old_topic_var,
$result_var,
Expand Down

0 comments on commit 33ac495

Please sign in to comment.