Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
A few more now-easy translations.
  • Loading branch information
jnthn committed Jul 9, 2012
1 parent 8903cfe commit b8553f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
13 changes: 8 additions & 5 deletions src/QPerl6/Actions.pm
Expand Up @@ -3306,7 +3306,7 @@ class QPerl6::Actions is HLL::Actions {
$past.op('callmethod');
$past.name('parameterize');
$past.unshift($ptref);
$past.unshift(PAST::Op.new( :pirop('get_how PP'), $ptref ));
$past.unshift(QAST::Op.new( :op('how'), $ptref ));
}
}
elsif +@name == 0 {
Expand All @@ -3324,7 +3324,7 @@ class QPerl6::Actions is HLL::Actions {

# Names ending in :: really want .WHO.
if $*longname.get_who {
$past := PAST::Op.new( :pirop('get_who PP'), $past );
$past := QAST::Op.new( :op('who'), $past );
}
}

Expand All @@ -3336,10 +3336,13 @@ class QPerl6::Actions is HLL::Actions {
if $FORBID_PIR {
nqp::die("pir::op forbidden in safe mode\n");
}
my $past := $<args> ?? $<args>[0].ast !! PAST::Op.new( :node($/) );
my $pirop := nqp::join(' ', nqp::split('__', ~$<op>));
$past.pirop($pirop);
$past.pasttype('pirop');
my $past := QAST::VM.new( :pirop($pirop), :node($/) );
if $<args> {
for $<args>[0].ast {
$past.push($_);
}
}
make $past;
}

Expand Down
17 changes: 9 additions & 8 deletions src/QPerl6/World.pm
Expand Up @@ -734,9 +734,10 @@ class QPerl6::World is HLL::World {
self.add_object($clone);
nqp::die("not yet updated for QAST");
$fixups.push(QAST::Stmts.new(
PAST::Op.new( :pasttype('bind'),
QAST::Op.new(
:op('bind'),
PAST::Var.new( :name('$P0'), :scope('register') ),
PAST::Op.new( :pirop('clone PP'), QAST::BVal.new( :value($code_past) ) )
QAST::Op.new( :op('clone'), QAST::BVal.new( :value($code_past) ) )
),
self.set_attribute($clone, $code_type, '$!do',
PAST::Var.new( :name('$P0'), :scope('register') )),
Expand Down Expand Up @@ -808,22 +809,22 @@ class QPerl6::World is HLL::World {
my $block_type := self.find_symbol(['Block']);
if nqp::istype($code, $block_type) {
sub run_phasers_code($type) {
PAST::Op.new(
:pasttype('for'),
PAST::Var.new(
:scope('keyed'),
QAST::Op.new(
:op('for'),
QAST::Op.new(
:op('atkey'),
QAST::Var.new(
:scope('attribute'), :name('$!phasers'),
QAST::WVal.new( :value($code) ),
QAST::WVal.new( :value($block_type) )
),
$type
QAST::SVal.new( :value($type) )
),
QAST::Block.new(
:blocktype('immediate'),
QAST::Op.new(
:op('call'),
PAST::Var.new( :scope('parameter'), :name('$_') )
QAST::Var.new( :scope('lexical'), :name('$_'), :decl('param') )
)))
}
my %phasers := nqp::getattr($code, $block_type, '$!phasers');
Expand Down

0 comments on commit b8553f9

Please sign in to comment.