Skip to content

Commit 7beb202

Browse files
committed
Fix TrSBangNode to use right value in guards
1 parent 55930c7 commit 7beb202

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/truffleruby/core/string/StringNodes.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,20 +2768,20 @@ protected Object trSBangEmpty(RubyString self, Object fromStr, Object toStr) {
27682768

27692769
@Specialization(
27702770
guards = {
2771-
"libFromStr.isRubyString(fromStr)",
2772-
"libToStr.isRubyString(toStr)",
2771+
"libFromStr.isRubyString(fromStrAsString)",
2772+
"libToStr.isRubyString(toStrAsString)",
27732773
"!self.tstring.isEmpty()" },
27742774
limit = "1")
27752775
protected static Object trSBang(RubyString self, Object fromStr, Object toStr,
27762776
@Cached ToStrNode fromStrNode,
27772777
@Cached ToStrNode toStrNode,
2778+
@Bind("this") Node node,
2779+
@Bind("fromStrNode.execute(node, fromStr)") Object fromStrAsString,
2780+
@Bind("toStrNode.execute(node, toStr)") Object toStrAsString,
27782781
@Cached CheckEncodingNode checkEncodingNode,
27792782
@Cached DeleteBangNode deleteBangNode,
27802783
@Cached RubyStringLibrary libFromStr,
2781-
@Cached RubyStringLibrary libToStr,
2782-
@Bind("this") Node node) {
2783-
final var fromStrAsString = fromStrNode.execute(node, fromStr);
2784-
final var toStrAsString = toStrNode.execute(node, toStr);
2784+
@Cached RubyStringLibrary libToStr) {
27852785
if (libToStr.getTString(toStrAsString).isEmpty()) {
27862786
return deleteBangNode.execute(node, self, new Object[]{ fromStrAsString });
27872787
}

0 commit comments

Comments
 (0)