Skip to content

Commit

Permalink
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1982,7 +1982,7 @@ public RubyString chr(RubyString string) {
}
}

static class StringNodesHelper {
public static class StringNodesHelper {

@TruffleBoundary
public static ByteList capitalize(RubyString string) {
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import org.jruby.truffle.runtime.core.RubyProc;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;
import org.jruby.util.ByteList;

@CoreClass(name = "Symbol")
public abstract class SymbolNodes {
@@ -230,4 +231,25 @@ public int size(RubySymbol symbol) {

}

@CoreMethod(names = { "swapcase"})
public abstract static class SwapcaseNode extends CoreMethodNode {

public SwapcaseNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public SwapcaseNode(SwapcaseNode prev) {
super(prev);
}

@Specialization
public RubySymbol swapcase(RubySymbol symbol) {
notDesignedForCompilation();

ByteList byteList = StringNodes.StringNodesHelper.swapcase(symbol.toRubyString());
return getContext().newSymbol(byteList);
}

}

}

0 comments on commit 7b12a6a

Please sign in to comment.