Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2011 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1063619 to your computer and use it in GitHub Desktop.
Save anonymous/1063619 to your computer and use it in GitHub Desktop.
$lhsinc := ($excl_lhs) ?? '&postfix:<++>' !! '&prefix:<++>';
$rhsinc := ($excl_rhs) ?? '&postfix:<++>' !! '&prefix:<++>';
PAST::Op.new(
:pasttype<stmts>,
PAST::Op.new(:pasttype<unless>,
PAST::Var.new(:name($state_var), :scope<lexical>),
PAST::Op.new(:pasttype<if>,
$lhspast,
PAST::Op.new(:name($lhsinc),
PAST::Var.new(:name($state_var), :scope<lexical>))
)
),
PAST::Op.new(:pasttype<if>,
PAST::Var.new(:name($state_var), :scope<lexical>),
PAST::Op.new(:pasttype<if>,
$rhspast,
PAST::Op.new(:name('&infix:<=>'),
PAST::Var.new(:name($state_var), :scope<lexical>),
$*ST.add_constant('Int', 'int', 0)),
PAST::Op.new(:name($rhsinc),
PAST::Var.new(:name($state_var), :scope<lexical>))
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment