Skip to content

Commit

Permalink
Move infix:<x> to setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Aug 13, 2009
1 parent 5c404cb commit 2befdd3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/builtins/op.pir
Expand Up @@ -229,19 +229,6 @@ src/builtins/op.pir - Perl 6 builtin operators
.end


.sub 'infix:x' :multi(_,_)
.param string str
.param int count
if count > 0 goto do_work
$S0 = ""
goto done
do_work:
$S0 = repeat str, count
done:
.return ($S0)
.end


.sub 'infix:xx' :multi(_,_)
.param pmc a
.param int n
Expand Down
16 changes: 16 additions & 0 deletions src/setting/Any-str.pm
Expand Up @@ -221,4 +221,20 @@ sub unpack($template, $target) {
}
}

multi sub infix:<x>($str, $n) {
Q:PIR {
$P1 = find_lex '$n'
$I0 = $P1
if $I0 > 0 goto do_repeat
$S0 = ''
goto done
do_repeat:
$P0 = find_lex '$str'
$S0 = $P0
$S0 = repeat $S0, $I0
done:
%r = box $S0
}
}

# vim: ft=perl6

0 comments on commit 2befdd3

Please sign in to comment.