Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 21 lines (15 sloc) 0.661 kb
f5fd473 Stefan O'Rear Finish removing "easy" cases of direct cross-module class referencing
authored
1 our ($CgOp, $OpCallSub, $OpLexical, $OpCgOp, $OptBeta);
03420a8 Stefan O'Rear [v6] Translate beta-optimization
authored
2
f5fd473 Stefan O'Rear Finish removing "easy" cases of direct cross-module class referencing
authored
3 class OptBeta;
03420a8 Stefan O'Rear [v6] Translate beta-optimization
authored
4
5 # A simple Perl6 compiler generates a lot of expressions of the form
6 # (-> $x { block })($y), due to control structures and regexes. Try to clean
7 # that up here.
8
2762955 Stefan O'Rear If a constant foldable expression throws an exception, treat it as a com...
authored
9 method make_call($/, $var, *@params) {
10 my $nonopt = $OpCallSub.new(pos=>$/,
612a7b7 Stefan O'Rear Eliminate Beta as a separate pass, inline subs during the parse
authored
11 positionals => [ @params ],
f5fd473 Stefan O'Rear Finish removing "easy" cases of direct cross-module class referencing
authored
12 invocant => $OpLexical.new(name => $var));
f1f89cc Stefan O'Rear Reimplement blocks and inlining
authored
13 my @lex = $*CURLEX<!sub>.lookup_lex($var) or return $nonopt;
14 return $nonopt unless @lex[0] eq 'sub' && @lex[4].is_inlinable;
15 @lex[4].set_inlined;
03420a8 Stefan O'Rear [v6] Translate beta-optimization
authored
16
f5fd473 Stefan O'Rear Finish removing "easy" cases of direct cross-module class referencing
authored
17 return $OpCgOp.new(optree => [ "_inline", @lex[4], @params ]);
03420a8 Stefan O'Rear [v6] Translate beta-optimization
authored
18 }
f5fd473 Stefan O'Rear Finish removing "easy" cases of direct cross-module class referencing
authored
19
20 INIT { $OptBeta = OptBeta }
Something went wrong with that request. Please try again.