Skip to content

Commit e178ee3

Browse files
committed
teach parrot and jvm about zerowidth literals
1 parent db12e00 commit e178ee3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/vm/jvm/QAST/Compiler.nqp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4951,10 +4951,12 @@ class QAST::CompilerJAST {
49514951
$TYPE_STR, 'regionMatches', 'Z', 'Z', 'Integer', $TYPE_STR, 'Integer', 'Integer' ));
49524952
$il.append(JAST::Instruction.new( :op($node.negate ?? 'ifne' !! 'ifeq'), %*REG<fail> ));
49534953

4954-
$il.append(JAST::Instruction.new( :op('lload'), %*REG<pos> ));
4955-
$il.append(JAST::PushIVal.new( :value($litlen) ));
4956-
$il.append($LADD);
4957-
$il.append(JAST::Instruction.new( :op('lstore'), %*REG<pos> ));
4954+
unless $node.subtype eq 'zerowidth' {
4955+
$il.append(JAST::Instruction.new( :op('lload'), %*REG<pos> ));
4956+
$il.append(JAST::PushIVal.new( :value($litlen) ));
4957+
$il.append($LADD);
4958+
$il.append(JAST::Instruction.new( :op('lstore'), %*REG<pos> ));
4959+
}
49584960

49594961
$il;
49604962
}

src/vm/parrot/QAST/Compiler.nqp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ class QAST::Compiler is HLL::Compiler {
14731473
$ops.push_pirop('nqp_string_equal_at', '$I11', %*REG<tgt>, $litpost, %*REG<pos>);
14741474
$ops.push_pirop($cmpop, '$I11', 1, %*REG<fail>);
14751475
}
1476-
$ops.push_pirop('add', %*REG<pos>, $litlen);
1476+
$ops.push_pirop('add', %*REG<pos>, $litlen) unless $node.subtype eq 'zerowidth';
14771477
$ops;
14781478
}
14791479

0 commit comments

Comments
 (0)