Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replace a use of subst with a loop over the chars.
  • Loading branch information
pmurias committed Jul 27, 2014
1 parent b40eecf commit 0d6b269
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/vm/js/QAST/Compiler.nqp
Expand Up @@ -372,8 +372,17 @@ class QAST::CompilerJS does SerializeOnce {
}
}

# we can't use subst
method dot_to_underscore($string) {
my $ret := '';
for nqp::split('',$string) -> $c {
$ret := $ret ~ ($c eq '.' ?? '_' !! $c);
}
$ret;
}

method cuid($node) {
my $cuid := subst($node.cuid(),/\./,"_");
my $cuid := self.dot_to_underscore($node.cuid());
%!cuids{$cuid} := 1;
$cuid;
}
Expand Down

0 comments on commit 0d6b269

Please sign in to comment.