File tree Expand file tree Collapse file tree
templates/java/org/ruby_lang/prism Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,8 +15,8 @@ import java.util.Locale;
1515// @formatter:off
1616public class Loader {
1717
18- public static ParseResult load(byte[] serialized, byte[] sourceBytes ) {
19- return new Loader(serialized).load(sourceBytes );
18+ public static ParseResult load(byte[] serialized) {
19+ return new Loader(serialized).load();
2020 }
2121
2222 // Overridable methods
@@ -81,10 +81,8 @@ public class Loader {
8181 this.buffer = ByteBuffer.wrap(serialized).order(ByteOrder.nativeOrder());
8282 }
8383
84- // We pass sourceBytes here and not in the constructor to avoid keeping
85- // the sourceBytes in memory unnecessarily with lazy DefNode's which hold on the Loader.
86- protected ParseResult load(byte[] sourceBytes) {
87- Nodes.Source source = new Nodes.Source(sourceBytes);
84+ protected ParseResult load() {
85+ Nodes.Source source = new Nodes.Source();
8886
8987 expect((byte) 'P', "incorrect prism header");
9088 expect((byte) 'R', "incorrect prism header");
Original file line number Diff line number Diff line change @@ -47,12 +47,10 @@ public abstract class Nodes {
4747 }
4848
4949 public static final class Source {
50- public final byte[] bytes;
5150 private int startLine = 1;
5251 private int[] lineOffsets = null;
5352
54- Source(byte[] bytes) {
55- this.bytes = bytes;
53+ Source() {
5654 }
5755
5856 void setStartLine(int startLine) {
@@ -70,7 +68,6 @@ public abstract class Nodes {
7068
7169 // 0-based
7270 public int findLine(int byteOffset) {
73- if (byteOffset > = bytes.length) byteOffset = bytes.length - 1;
7471 assert byteOffset > = 0 : byteOffset;
7572 int index = Arrays.binarySearch(lineOffsets, byteOffset);
7673 int line;
You can’t perform that action at this time.
0 commit comments