Skip to content

Instantly share code, notes, and snippets.

@skids
Created February 20, 2016 22:38
Show Gist options
  • Save skids/7f3e8613857a9f6ca9da to your computer and use it in GitHub Desktop.
Save skids/7f3e8613857a9f6ca9da to your computer and use it in GitHub Desktop.
inverted "when" statement
use nqp;
use QAST:from<NQP>;
sub EXPORT(|) {
role Control::Never {
rule statement_control:sym<never> {
<sym><.kok> <xblock>
}
}
role Control::Never::Actions {
method statement_control:sym<never>(|c) {
$/ := c[0];
my $when = self.'statement_control:sym<when>'($/);
$when.op('unless');
}
}
nqp::bindkey(%*LANG, 'MAIN', %*LANG<MAIN>.HOW.mixin(%*LANG<MAIN>, Control::Never));
nqp::bindkey(%*LANG, 'MAIN-actions', %*LANG<MAIN-actions>.HOW.mixin(%*LANG<MAIN-actions>, Control::Never::Actions));
{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment