view paper/codes/nqp_ops.nqp @ 29:96e9cf9c2ea2

add source files
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 12 Feb 2019 17:02:56 +0900
parents
children
line wrap: on
line source

$ops.add_hll_op('nqp', 'preinc', -> $qastcomp, $op {
    my $var := $op[0];
    unless nqp::istype($var, QAST::Var) {
        nqp::die("Pre-increment can only work on a variable");
    }
    $qastcomp.as_mast(QAST::Op.new(
        :op('bind'),
        $var,
        QAST::Op.new(
            :op('add_i'),
            $var,
            QAST::IVal.new( :value(1) )
        )));
});