Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bring nqp::eoffh on parrot in line with moar
That is, eoffh will be true when the user code is at EOF, whether a read
past EOF was attempted or not.
  • Loading branch information
FROGGS committed Sep 17, 2014
1 parent db41176 commit 2b8753c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/vm/parrot/QAST/Operations.nqp
Expand Up @@ -1843,7 +1843,22 @@ QAST::Operations.add_core_op('eoffh', -> $qastcomp, $op {
if +$op.list != 1 {
nqp::die("The 'eoffh' op expects one operand");
}
$qastcomp.as_post(QAST::Op.new( :op('isfalse'), $op[0] ))
$qastcomp.as_post(
QAST::Op.new( :op('if'),
QAST::Op.new( :op('istrue'),
QAST::Op.new( :op('callmethod'), :name('read'),
$op[0], QAST::IVal.new( :value(1) )
)
),
QAST::Stmts.new(
QAST::Op.new( :op('callmethod'), :name('seek'),
$op[0], QAST::IVal.new( :value(1) ), QAST::IVal.new( :value(-1) )
),
QAST::IVal.new( :value(0) )
),
QAST::IVal.new( :value(1) )
)
)
});
QAST::Operations.add_core_op('closefh', -> $qastcomp, $op {
if +$op.list != 1 {
Expand Down

0 comments on commit 2b8753c

Please sign in to comment.