Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Harden null string handling in string heap code-gen.
  • Loading branch information
jnthn committed Feb 26, 2012
1 parent 7c0ad48 commit 7fd001a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/HLL/World.pm
Expand Up @@ -247,11 +247,14 @@ class HLL::World {
:pasttype('bind'),
PAST::Var.new( :scope('register'), :name('string_heap'), :isdecl(1) ),
PAST::Op.new( :pirop('new Ps'), 'ResizableStringArray' )));
for $sh -> $s {
my $sh_elems := nqp::elems($sh);
my $i := 0;
while $i < $sh_elems {
$sh_past.push(PAST::Op.new(
:pirop('push vPs'),
PAST::Var.new( :scope('register'), :name('string_heap') ),
(nqp::isnull($s) ?? PAST::Op.new( :pirop('null S') ) !! $s)));
(nqp::isnull_s($sh[$i]) ?? PAST::Op.new( :pirop('null S') ) !! $sh[$i])));
$i := $i + 1;
}
$sh_past.push(PAST::Var.new( :scope('register'), :name('string_heap') ));

Expand Down

0 comments on commit 7fd001a

Please sign in to comment.