Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
only substr to precision when needed
  • Loading branch information
FROGGS committed Sep 25, 2013
1 parent ced8450 commit 61f2f50
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/HLL/sprintf.nqp
Expand Up @@ -296,7 +296,9 @@ my module sprintf {

method directive:sym<s>($/) {
my $string := next_argument($/);
$string := nqp::substr($string, 0, $<precision>.ast) if nqp::chars($<precision>);
if nqp::chars($<precision>) && nqp::chars($string) > $<precision>.ast {
$string := nqp::substr($string, 0, $<precision>.ast);
}
make $string
}
# XXX: Should we emulate an upper limit, like 2**64?
Expand Down

0 comments on commit 61f2f50

Please sign in to comment.