@@ -109,7 +109,7 @@ public YARPTranslatorDriver(RubyContext context) {
109
109
110
110
public RootCallTarget parse (RubySource rubySource , ParserContext parserContext , String [] argumentNames ,
111
111
MaterializedFrame parentFrame , LexicalScope staticLexicalScope , Node currentNode ) {
112
- Nodes .Source yarpSource = createYARPSource (rubySource .getBytes (), rubySource );
112
+ Nodes .Source yarpSource = createYARPSource (rubySource .getBytes ());
113
113
this .parseEnvironment = new ParseEnvironment (language , rubySource , yarpSource , parserContext , currentNode );
114
114
115
115
assert rubySource .isEval () == parserContext .isEval ();
@@ -565,19 +565,8 @@ public static RubySource createRubySource(Object code) {
565
565
return new RubySource (source , source .getName (), sourceTString );
566
566
}
567
567
568
- public static Nodes .Source createYARPSource (byte [] sourceBytes , RubySource rubySource ) {
569
- Source source = rubySource .getSource ();
570
- int [] lineOffsets = new int [source .getLineCount ()];
571
- for (int line = 1 ; line <= source .getLineCount (); line ++) {
572
- lineOffsets [line - 1 ] = source .getLineStartOffset (line );
573
- }
574
-
575
- // Nodes.Source expects at least one line, but there are no any line in empty Ruby source file
576
- if (lineOffsets .length == 0 ) {
577
- lineOffsets = new int []{ 0 };
578
- }
579
-
580
- return new Nodes .Source (sourceBytes , 1 , lineOffsets );
568
+ public static Nodes .Source createYARPSource (byte [] sourceBytes ) {
569
+ return new Nodes .Source (sourceBytes );
581
570
}
582
571
583
572
private TranslatorEnvironment environmentForFrame (RubyContext context , MaterializedFrame frame , int blockDepth ) {
0 commit comments