Skip to content

Commit 18ee9a2

Browse files
committed
Adopt changes in Prism
1 parent d94e5df commit 18ee9a2

File tree

13 files changed

+36
-38
lines changed

13 files changed

+36
-38
lines changed

spec/truffle/parsing/fixtures/ensure/in_do_end_block.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ ast: |
6969
EnsureNodeGen
7070
attributes:
7171
flags = 0
72-
sourceCharIndex = 10
73-
sourceLength = 22
72+
sourceCharIndex = 5
73+
sourceLength = 27
7474
children:
7575
ensurePart =
7676
RubyCallNode

spec/truffle/parsing/fixtures/ensure/in_method.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ ast: |
7878
EnsureNodeGen
7979
attributes:
8080
flags = 0
81-
sourceCharIndex = 10
82-
sourceLength = 22
81+
sourceCharIndex = 0
82+
sourceLength = 32
8383
children:
8484
ensurePart =
8585
RubyCallNode

spec/truffle/parsing/fixtures/ensure/in_module.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ ast: |
8787
EnsureNodeGen
8888
attributes:
8989
flags = 0
90-
sourceCharIndex = 13
91-
sourceLength = 22
90+
sourceCharIndex = 0
91+
sourceLength = 35
9292
children:
9393
ensurePart =
9494
RubyCallNode

spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ ast: |
7272
TryNodeGen
7373
attributes:
7474
flags = 0
75-
sourceCharIndex = 20
76-
sourceLength = 22
75+
sourceCharIndex = 15
76+
sourceLength = 27
7777
children:
7878
rescueParts = [
7979
RescueStandardErrorNode

spec/truffle/parsing/fixtures/rescue/in_do_end_block.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ ast: |
6969
TryNodeGen
7070
attributes:
7171
flags = 0
72-
sourceCharIndex = 10
73-
sourceLength = 21
72+
sourceCharIndex = 5
73+
sourceLength = 26
7474
children:
7575
rescueParts = [
7676
RescueStandardErrorNode

spec/truffle/parsing/fixtures/rescue/in_method.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ ast: |
7878
TryNodeGen
7979
attributes:
8080
flags = 0
81-
sourceCharIndex = 10
82-
sourceLength = 21
81+
sourceCharIndex = 0
82+
sourceLength = 31
8383
children:
8484
rescueParts = [
8585
RescueStandardErrorNode

spec/truffle/parsing/fixtures/rescue/in_module.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ ast: |
8787
TryNodeGen
8888
attributes:
8989
flags = 0
90-
sourceCharIndex = 13
91-
sourceLength = 21
90+
sourceCharIndex = 0
91+
sourceLength = 34
9292
children:
9393
rescueParts = [
9494
RescueStandardErrorNode

src/main/java/org/truffleruby/debug/TruffleDebugNodes.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,9 @@ private static RubySource createRubySource(TStringWithEncoding code) {
272272
}
273273

274274
private static ParseResult getParseResult(RubyLanguage language, RubySource rubySource) {
275-
var yarpSource = YARPTranslatorDriver.createYARPSource(rubySource.getBytes());
276275
String sourcePath = rubySource.getSourcePath(language).intern();
277276

278-
return YARPTranslatorDriver.parseToYARPAST(rubySource, sourcePath, yarpSource,
277+
return YARPTranslatorDriver.parseToYARPAST(rubySource, sourcePath, rubySource.getBytes(),
279278
Collections.emptyList(), language.options.FROZEN_STRING_LITERALS);
280279
}
281280
}

src/main/java/org/truffleruby/parser/ParseEnvironment.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public final class ParseEnvironment {
2626
public final RubySource rubySource;
2727
public final Source source;
2828
/** Used to compute line numbers */
29-
public final Nodes.Source yarpSource;
29+
public Nodes.Source yarpSource;
3030
public final ParserContext parserContext;
3131
public final Node currentNode;
3232

@@ -40,13 +40,11 @@ public final class ParseEnvironment {
4040
public ParseEnvironment(
4141
RubyLanguage language,
4242
RubySource rubySource,
43-
Nodes.Source yarpSource,
4443
ParserContext parserContext,
4544
Node currentNode) {
4645
this.language = language;
4746
this.rubySource = rubySource;
4847
this.source = rubySource.getSource();
49-
this.yarpSource = yarpSource;
5048
this.parserContext = parserContext;
5149
this.currentNode = currentNode;
5250

src/main/java/org/truffleruby/parser/YARPLoader.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
package org.truffleruby.parser;
3838

3939
import org.prism.Loader;
40-
import org.prism.Nodes;
4140
import org.prism.ParseResult;
4241
import org.truffleruby.core.encoding.Encodings;
4342
import org.truffleruby.core.encoding.RubyEncoding;
@@ -47,14 +46,14 @@
4746

4847
public final class YARPLoader extends Loader {
4948

50-
public static ParseResult load(byte[] serialized, Nodes.Source source, RubySource rubySource) {
51-
return new YARPLoader(serialized, source, rubySource).load();
49+
public static ParseResult load(byte[] serialized, byte[] sourceBytes, RubySource rubySource) {
50+
return new YARPLoader(serialized, sourceBytes, rubySource).load();
5251
}
5352

5453
private final RubyEncoding encoding;
5554

56-
public YARPLoader(byte[] serialized, Nodes.Source source, RubySource rubySource) {
57-
super(serialized, source);
55+
public YARPLoader(byte[] serialized, byte[] sourceBytes, RubySource rubySource) {
56+
super(serialized, sourceBytes);
5857
this.encoding = rubySource.getEncoding();
5958
}
6059

0 commit comments

Comments
 (0)