Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,12 @@ static TruffleString readAll(VirtualFrame frame, PTextIO self, @SuppressWarnings
/* Read everything */
Object bytes = callMethod.execute(frame, inliningTarget, self.getBuffer(), T_READ);
TruffleString decoded = decodeNode.execute(frame, self.getDecoder(), bytes, true);
TruffleString result = self.consumeAllDecodedChars(substringNode, !decoded.isEmpty());
result = concatNode.execute(result, decoded, TS_ENCODING, false);
TruffleString result;
if (decoded.isEmpty()) {
result = self.consumeAllDecodedChars(substringNode, false);
} else {
result = concatNode.execute(self.consumeAllDecodedChars(substringNode, true), decoded, TS_ENCODING, false);
}
self.clearDecodedChars();
self.clearSnapshot();
return result;
Expand Down Expand Up @@ -528,7 +532,11 @@ static TruffleString read(VirtualFrame frame, PTextIO self, int n,
appendStringNode.execute(chunks, result);
}

result = self.consumeDecodedChars(remaining, substringNode, chunks != null);
if (chunks != null) {
result = self.consumeDecodedChars(remaining, substringNode, true);
} else {
result = self.consumeDecodedChars(remaining, substringNode, false);
}
remaining -= codePointLengthNode.execute(result, TS_ENCODING);
}
if (chunks != null) {
Expand Down
Loading