Skip to content

Commit 5ba6925

Browse files
committed
Various cleanups and simplifications to QAST::Compiler and HLL::Compiler now that it no longer has to cope with PAST and POST.
1 parent 2158891 commit 5ba6925

File tree

2 files changed

+10
-49
lines changed

2 files changed

+10
-49
lines changed

src/HLL/Compiler.pm

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ class HLL::Compiler {
434434

435435
method post($source, *%adverbs) {
436436
my $*PASTCOMPILER := pir::compreg__Ps('PAST');
437-
my $*PIRT := 1;
438437
QAST::Compiler.as_post($source)
439438
}
440439

@@ -451,14 +450,7 @@ class HLL::Compiler {
451450
}
452451

453452
method pir($source, *%adverbs) {
454-
if nqp::can($source, 'pir') {
455-
my $*PIRT := 1;
456-
self.pirbegin() ~ $source.pir()
457-
}
458-
else {
459-
my $*PIRT := 0;
460-
self.pirbegin() ~ pir::compreg__Ps('POST').to_pir($source, |%adverbs)
461-
}
453+
self.pirbegin() ~ $source.pir()
462454
}
463455

464456
method evalpmc($source, *%adverbs) {

src/QAST/Compiler.nqp

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,23 +1095,14 @@ class QAST::Compiler is HLL::Compiler {
10951095
}
10961096

10971097
method post_children($node) {
1098-
if $*PIRT {
1099-
my $posts := PIRT::Ops.new();
1100-
my @results;
1101-
for @($node) {
1102-
my $sval := self.as_post(QAST::SVal.new( :value(~$_) ));
1103-
$posts.push($sval);
1104-
nqp::push(@results, $sval.result);
1105-
}
1106-
[$posts, @results]
1107-
}
1108-
else {
1109-
Q:PIR {
1110-
$P0 = find_dynamic_lex '$*PASTCOMPILER'
1111-
$P1 = find_lex '$node'
1112-
(%r :slurpy) = $P0.'post_children'($P1)
1113-
}
1098+
my $posts := PIRT::Ops.new();
1099+
my @results;
1100+
for @($node) {
1101+
my $sval := self.as_post(QAST::SVal.new( :value(~$_) ));
1102+
$posts.push($sval);
1103+
nqp::push(@results, $sval.result);
11141104
}
1105+
[$posts, @results]
11151106
}
11161107

11171108
method children($node) {
@@ -1126,25 +1117,12 @@ class QAST::Compiler is HLL::Compiler {
11261117
}
11271118

11281119
method regex_post($node) {
1129-
return $*PASTCOMPILER.as_post($node) if $node ~~ PAST::Node;
11301120
my $rxtype := $node.rxtype() || 'concat';
11311121
self."$rxtype"($node);
11321122
}
11331123

11341124
method post_new($type, *@args, *%options) {
1135-
if $*PIRT {
1136-
(PIRT.WHO){$type}.new(|@args, |%options)
1137-
}
1138-
else {
1139-
Q:PIR {
1140-
$P0 = find_lex '$type'
1141-
$S0 = $P0
1142-
$P0 = get_root_global ['parrot';'POST'], $S0
1143-
$P1 = find_lex '@args'
1144-
$P2 = find_lex '%options'
1145-
%r = $P0.'new'($P1 :flat, $P2 :flat :named)
1146-
}
1147-
}
1125+
(PIRT.WHO){$type}.new(|@args, |%options)
11481126
}
11491127

11501128
method alt($node) {
@@ -1567,16 +1545,7 @@ class QAST::Compiler is HLL::Compiler {
15671545
}
15681546

15691547
multi method as_post($unknown) {
1570-
# XXX pir::typeof for now to catch accidental PAST nodes while we
1571-
# transition stuff to 6model fully.
1572-
if $unknown ~~ PAST::Op {
1573-
nqp::die("Unknown QAST node type " ~ pir::typeof__SP($unknown) ~
1574-
" (name = '" ~ $unknown.name() ~
1575-
"', pirop = '" ~ $unknown.pirop ~ "')");
1576-
}
1577-
else {
1578-
nqp::die("Unknown QAST node type " ~ pir::typeof__SP($unknown));
1579-
}
1548+
nqp::die("Unknown QAST node type " ~ $unknown.HOW.name($unknown));
15801549
}
15811550

15821551
method operations() { QAST::Operations }

0 commit comments

Comments
 (0)