Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Get module compilation/export essentially working again.
  • Loading branch information
jnthn committed Jul 14, 2012
1 parent e506623 commit 25b9f19
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/QPerl6/Actions.pm
Expand Up @@ -255,7 +255,7 @@ class QPerl6::Actions is HLL::Actions {
# (CTXSAVE is inherited from HLL::Actions.) Don't do this when
# there was an explicit {YOU_ARE_HERE}.
unless $*HAS_YOU_ARE_HERE {
#$unit.push( self.CTXSAVE() );
$unit.push( self.CTXSAVE() );
}

# Add the mainline code to the unit.
Expand Down Expand Up @@ -294,6 +294,33 @@ class QPerl6::Actions is HLL::Actions {

make $compunit;
}

# XXX Move to HLL::Actions after NQP gets QAST.
method CTXSAVE() {
QAST::Stmt.new(
QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('ctxsave'), :scope('local'), :decl('var') ),
QAST::Var.new( :name('$*CTXSAVE'), :scope('contextual') )
),
QAST::Op.new(
:op('unless'),
QAST::Op.new(
:op('isnull'),
QAST::Var.new( :name('ctxsave'), :scope('local') )
),
QAST::Op.new(
:op('if'),
QAST::VM.new(
:pirop('can IPs'),
QAST::Var.new( :name('ctxsave'), :scope('local') ),
QAST::SVal.new( :value('ctxsave') )
),
QAST::Op.new(
:op('callmethod'), :name('ctxsave'),
QAST::Var.new( :name('ctxsave'), :scope('local')
)))))
}

method install_doc_phaser($/) {
# Add a default DOC INIT phaser
Expand Down

0 comments on commit 25b9f19

Please sign in to comment.