Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Eliminate a bunch of pir::.
  • Loading branch information
jnthn committed Feb 17, 2013
1 parent c6832d5 commit 54985c7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/HLL/Actions.pm
Expand Up @@ -101,7 +101,7 @@ class HLL::Actions {
method term:sym<circumfix>($/) { make $<circumfix>.ast }

method termish($/) { make $<term>.ast; }
method nullterm($/) { make pir::new__Ps('Undef') }
method nullterm($/) { make NQPMu; }
method nullterm_alt($/) { make $<term>.ast; }

method integer($/) { make $<VALUE>.ast; }
Expand Down
18 changes: 9 additions & 9 deletions src/HLL/Compiler.pm
Expand Up @@ -45,22 +45,22 @@ class HLL::Compiler {
method language($name?) {
if $name {
$!language := $name;
pir::compreg__0sP($name, self);
nqp::bindcomp($name, self);
}
$!language;
}

method compiler($name) {
pir::compreg__Ps($name);
nqp::getcomp($name);
}

method config() { %!config };

method load_module($name) {
my $base := nqp::join('/', self.parse_name($name));
my $loaded := 0;
try { pir::load_bytecode__vS("$base.pbc"); $loaded := 1 };
unless $loaded { pir::load_bytecode__vS("$base.pir"); $loaded := 1 }
try { nqp::loadbytecode("$base.pbc"); $loaded := 1 };
unless $loaded { nqp::loadbytecode("$base.pir"); $loaded := 1 }
self.get_module($name);
}

Expand Down Expand Up @@ -399,13 +399,13 @@ class HLL::Compiler {

method past($source, *%adverbs) {
my $ast := $source.ast();
self.panic("Unable to obtain ast from " ~ pir::typeof__SP($source))
self.panic("Unable to obtain ast from " ~ $source.HOW.name($source))
unless $ast ~~ QAST::Node;
$ast;
}

method post($source, *%adverbs) {
pir::compreg__Ps('QAST').post($source)
nqp::getcomp('QAST').post($source)
}

method pirbegin() {
Expand All @@ -426,7 +426,7 @@ class HLL::Compiler {
}

method evalpmc($source, *%adverbs) {
my $compiler := pir::compreg__Ps('PIR');
my $compiler := nqp::getcomp('PIR');
$compiler($source)
}

Expand Down Expand Up @@ -506,7 +506,7 @@ class HLL::Compiler {
}

method removestage($stagename) {
my @new_stages := pir::new__Ps('ResizableStringArray');
my @new_stages := nqp::list_s();
for @!stages {
if $_ ne $stagename {
@new_stages.push($_);
Expand All @@ -530,7 +530,7 @@ class HLL::Compiler {
self.stages(@new-stages);
return 1;
}
my @new-stages := pir::new__Ps('ResizableStringArray');
my @new-stages := nqp::list_s();
for self.stages {
if $_ eq $where {
if $position eq 'before' {
Expand Down
10 changes: 5 additions & 5 deletions src/HLL/Grammar.pm
Expand Up @@ -322,7 +322,7 @@ of the match.
@args.push(' at line ');
@args.push(HLL::Compiler.lineof($target, $pos) + 1);
@args.push(', near "');
@args.push(pir::escape__SS(nqp::substr($target, $pos, 10)));
@args.push(nqp::escape(nqp::substr($target, $pos, 10)));
@args.push('"');
nqp::die(nqp::join('', @args))
}
Expand Down Expand Up @@ -352,10 +352,10 @@ position C<pos>.
if $start eq ':' {
self.panic('Colons may not be used to delimit quoting constructs');
}
if nqp::iscclass(pir::const::CCLASS_WORD, $start, 0) {
if nqp::iscclass(nqp::const::CCLASS_WORD, $start, 0) {
self.panic('Alphanumeric character is not allowed as a delimiter');
}
if nqp::iscclass(pir::const::CCLASS_WHITESPACE, $start, 0) {
if nqp::iscclass(nqp::const::CCLASS_WHITESPACE, $start, 0) {
self.panic('Whitespace character is not allowed as a delimiter');
}

Expand Down Expand Up @@ -474,8 +474,8 @@ position C<pos>.
my int $pos := 0;
my int $eos := nqp::chars($words);
my int $ws;
while ($pos := nqp::findnotcclass(pir::const::CCLASS_WHITESPACE, $words, $pos, $eos)) < $eos {
$ws := nqp::findcclass(pir::const::CCLASS_WHITESPACE, $words, $pos, $eos);
while ($pos := nqp::findnotcclass(nqp::const::CCLASS_WHITESPACE, $words, $pos, $eos)) < $eos {
$ws := nqp::findcclass(nqp::const::CCLASS_WHITESPACE, $words, $pos, $eos);
nqp::push(@result, nqp::substr($words, $pos, $ws - $pos));
$pos := $ws;
}
Expand Down
4 changes: 2 additions & 2 deletions src/NQP/Actions.pm
Expand Up @@ -759,7 +759,7 @@ class NQP::Actions is HLL::Actions {
$/.CURSOR.panic("Only typed scalars are currently supported in NQP");
}
$type := $*W.find_sym([~$<typename>[0]]);
if pir::repr_get_primitive_type_spec__IP($type) -> $prim_spec {
if nqp::objprimspec($type) -> $prim_spec {
$default := default_value_for_prim($prim_spec);
}
else {
Expand Down Expand Up @@ -1103,7 +1103,7 @@ class NQP::Actions is HLL::Actions {
if $<typename> {
my $type := $<typename>[0].ast.value;
$past.returns($type);
if pir::repr_get_primitive_type_spec__IP($type) -> $prim {
if nqp::objprimspec($type) -> $prim {
$*W.cur_lexpad().symbol($past.name, :type($type));
if $past.default && !$<default_value> {
$past.default(default_value_for_prim($prim));
Expand Down
8 changes: 4 additions & 4 deletions src/QAST/Compiler.nqp
Expand Up @@ -199,15 +199,15 @@ class QAST::Compiler is HLL::Compiler {

my @prim_to_reg := ['P', 'I', 'N', 'S'];
sub type_to_register_type($type) {
@prim_to_reg[pir::repr_get_primitive_type_spec__IP($type)]
@prim_to_reg[nqp::objprimspec($type)]
}
method type_to_register_type($type) {
type_to_register_type($type)
}

my @prim_to_lookup_name := ['obj', 'int', 'num', 'str'];
sub type_to_lookup_name($type) {
@prim_to_lookup_name[pir::repr_get_primitive_type_spec__IP($type)]
@prim_to_lookup_name[nqp::objprimspec($type)]
}

my %hll_force_return_boxing;
Expand All @@ -217,14 +217,14 @@ class QAST::Compiler is HLL::Compiler {

method unique($prefix = '') { $prefix ~ $serno++ }
method escape($str) {
my $esc := pir::escape__Ss($str);
my $esc := nqp::escape($str);
nqp::index($esc, '\x', 0) >= 0 ??
'utf8:"' ~ $esc ~ '"' !!
(nqp::index($esc, '\u', 0) >= 0 ??
'unicode:"' ~ $esc ~ '"' !!
'"' ~ $esc ~ '"')
}
method rxescape($str) { 'ucs4:"' ~ pir::escape__Ss($str) ~ '"' }
method rxescape($str) { 'ucs4:"' ~ nqp::escape($str) ~ '"' }

proto method as_post($node, :$want) {
my $*WANT := $want;
Expand Down
12 changes: 6 additions & 6 deletions src/core/Regex.pm
Expand Up @@ -34,24 +34,24 @@ perform the replacement on all matches of C<$text>.
sub subst ($text, $regex, $repl, :$global?) {
my @matches := $global ?? match($text, $regex, :global)
!! [ $text ~~ $regex ];
my $is_code := pir::isa__IPs($repl, 'Sub');
my $is_code := nqp::isinvokable($repl);
my $offset := 0;
my $result := pir::new__Ps('StringBuilder');
my @result;

for @matches -> $match {
if $match {
nqp::push_s($result, nqp::substr($text, $offset, $match.from - $offset))
nqp::push(@result, nqp::substr($text, $offset, $match.from - $offset))
if $match.from > $offset;
nqp::push_s($result, $is_code ?? $repl($match) !! $repl);
nqp::push(@result, $is_code ?? $repl($match) !! $repl);
$offset := $match.to;
}
}

my $chars := nqp::chars($text);
nqp::push_s($result, nqp::substr($text, $offset, $chars))
nqp::push(@result, nqp::substr($text, $offset, $chars))
if $chars > $offset;

~$result;
nqp::join("", @result);
}

# vim: ft=perl6

0 comments on commit 54985c7

Please sign in to comment.