|
5 | 5 | import org.jruby.ParseResult; |
6 | 6 | import org.jruby.Ruby; |
7 | 7 | import org.jruby.RubyArray; |
| 8 | +import org.jruby.RubyFile; |
8 | 9 | import org.jruby.RubyIO; |
9 | 10 | import org.jruby.RubyInstanceConfig; |
10 | 11 | import org.jruby.RubySymbol; |
|
20 | 21 | import org.jruby.util.ByteList; |
21 | 22 | import org.jruby.util.CommonByteLists; |
22 | 23 | import org.jruby.util.io.ChannelHelper; |
| 24 | +import org.jruby.util.io.SeekableByteChannelImpl; |
23 | 25 | import org.ruby_lang.prism.Nodes.ArgumentsNode; |
24 | 26 | import org.ruby_lang.prism.Nodes.CallNode; |
25 | 27 | import org.ruby_lang.prism.Nodes.CallNodeFlags; |
|
35 | 37 | import java.io.DataInputStream; |
36 | 38 | import java.io.IOException; |
37 | 39 | import java.io.InputStream; |
| 40 | +import java.nio.channels.SeekableByteChannel; |
38 | 41 | import java.util.ArrayList; |
39 | 42 | import java.util.Arrays; |
40 | 43 | import java.util.EnumSet; |
@@ -95,11 +98,9 @@ private ParseResult parseInternal(String fileName, DynamicScope blockScope, byte |
95 | 98 | } |
96 | 99 |
|
97 | 100 | if (type == MAIN && res.dataLocation != null) { |
98 | | - // FIXME: Intentionally leaving as original source for offset. This can just be an IO where pos is set to right value. |
99 | | - // FIXME: Somehow spec will say this should File and not IO but I cannot figure out why legacy parser isn't IO also. |
100 | 101 | ByteArrayInputStream bais = new ByteArrayInputStream(source, 0, source.length); |
101 | 102 | bais.skip(res.dataLocation.startOffset + 8); // FIXME: 8 is for including __END__\n |
102 | | - runtime.defineDATA(RubyIO.newIO(runtime, ChannelHelper.readableChannel(bais))); |
| 103 | + runtime.defineDATA(RubyFile.DATAFile(runtime, fileName, new SeekableByteChannelImpl(bais))); |
103 | 104 | } |
104 | 105 |
|
105 | 106 | int lineCount = res.source.getLineCount(); |
|
0 commit comments