Skip to content

Commit

Permalink
Showing 1 changed file with 2 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -949,7 +949,7 @@ public RubyBasicObject downcase(RubyString string) {
}
}

@CoreMethod(names = "each_byte", needsBlock = true)
@CoreMethod(names = "each_byte", needsBlock = true, returnsEnumeratorIfNoBlock = true)
public abstract static class EachByteNode extends YieldingCoreMethodNode {

@Child private CallDispatchHeadNode toEnumNode;
@@ -962,18 +962,6 @@ public EachByteNode(EachByteNode prev) {
super(prev);
}

@Specialization
public Object eachByte(VirtualFrame frame, RubyString string, @SuppressWarnings("unused") UndefinedPlaceholder block) {
notDesignedForCompilation();

if (toEnumNode == null) {
CompilerDirectives.transferToInterpreter();
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return toEnumNode.call(frame, string, "to_enum", null, getContext().newSymbol("each_byte"));
}

@Specialization
public RubyString eachByte(VirtualFrame frame, RubyString string, RubyProc block) {
notDesignedForCompilation();
@@ -990,7 +978,7 @@ public RubyString eachByte(VirtualFrame frame, RubyString string, RubyProc block

}

@CoreMethod(names = "each_char", needsBlock = true)
@CoreMethod(names = "each_char", needsBlock = true, returnsEnumeratorIfNoBlock = true)
public abstract static class EachCharNode extends YieldingCoreMethodNode {

@Child private CallDispatchHeadNode toEnumNode;
@@ -1003,18 +991,6 @@ public EachCharNode(EachCharNode prev) {
super(prev);
}

@Specialization
public Object eachChar(VirtualFrame frame, RubyString string, @SuppressWarnings("unused") UndefinedPlaceholder block) {
notDesignedForCompilation();

if (toEnumNode == null) {
CompilerDirectives.transferToInterpreter();
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return toEnumNode.call(frame, string, "to_enum", null, getContext().newSymbol("each_char"));
}

@Specialization(guards = "isValidOr7BitEncoding")
public RubyString eachChar(VirtualFrame frame, RubyString string, RubyProc block) {
ByteList strByteList = string.getByteList();

0 comments on commit 242c527

Please sign in to comment.