Skip to content

Commit 36a602c

Browse files
committed
[GR-45043] Import YARP breaking changes - upgrading the version to 0.6.0
PullRequest: truffleruby/3937
2 parents 2007f9a + 9acddea commit 36a602c

File tree

7 files changed

+182
-154
lines changed

7 files changed

+182
-154
lines changed

mx.truffleruby/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
"sourceDirs": ["java"],
145145
"jniHeaders": True,
146146
"jacoco": "include",
147-
"javaCompliance": "17+",
147+
"javaCompliance": "8+",
148148
"workingSets": "TruffleRuby",
149149
"license": ["MIT"],
150150
},

src/main/c/yarp/include/yarp/ast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ typedef struct yp_constant_path_operator_write_node {
654654
// ConstantPathWriteNode
655655
typedef struct yp_constant_path_write_node {
656656
yp_node_t base;
657-
struct yp_node *target;
657+
struct yp_constant_path_node *target;
658658
yp_location_t operator_loc;
659659
struct yp_node *value;
660660
} yp_constant_path_write_node_t;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define YP_VERSION_MAJOR 0
2-
#define YP_VERSION_MINOR 4
2+
#define YP_VERSION_MINOR 6
33
#define YP_VERSION_PATCH 0
44

5-
#define YP_VERSION "0.4.0"
5+
#define YP_VERSION "0.6.0"

src/main/c/yarp/src/yarp.c

Lines changed: 164 additions & 133 deletions
Large diffs are not rendered by default.

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -582,23 +582,20 @@ public RubyNode visitConstantPathOperatorWriteNode(Nodes.ConstantPathOperatorWri
582582
}
583583

584584
public RubyNode visitConstantPathWriteNode(Nodes.ConstantPathWriteNode node) {
585-
assert node.target instanceof Nodes.ConstantPathNode;
586-
587-
final RubyNode rubyNode;
588-
final RubyNode value = translateNodeOrDeadNode(node.value, "YARPTranslator#visitConstantPathWriteNode");
589-
final var pathNode = (Nodes.ConstantPathNode) node.target;
590-
final String name = toString(pathNode.child);
585+
final Nodes.ConstantPathNode constantPathNode = node.target;
591586
final RubyNode moduleNode;
592587

593-
if (pathNode.parent != null) {
588+
if (constantPathNode.parent != null) {
594589
// FOO::BAR = 1
595-
moduleNode = pathNode.parent.accept(this);
590+
moduleNode = constantPathNode.parent.accept(this);
596591
} else {
597592
// ::FOO = 1
598593
moduleNode = new ObjectClassLiteralNode();
599594
}
600595

601-
rubyNode = new WriteConstantNode(name, moduleNode, value);
596+
final String name = toString(constantPathNode.child);
597+
final RubyNode value = translateNodeOrDeadNode(node.value, "YARPTranslator#visitConstantPathWriteNode");
598+
final RubyNode rubyNode = new WriteConstantNode(name, moduleNode, value);
602599

603600
assignNodePositionInSource(node, rubyNode);
604601
return rubyNode;

src/yarp/java/org/yarp/Loader.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private ParseResult load() {
6464
expect((byte) 'P');
6565

6666
expect((byte) 0);
67-
expect((byte) 4);
67+
expect((byte) 6);
6868
expect((byte) 0);
6969

7070
// This loads the name of the encoding. We don't actually do anything
@@ -103,15 +103,15 @@ private byte[] loadString() {
103103

104104
private ParseResult.Error[] loadSyntaxErrors() {
105105
int count = loadVarInt();
106-
var errors = new ParseResult.Error[count];
106+
ParseResult.Error[] errors = new ParseResult.Error[count];
107107

108108
// error messages only contain ASCII characters
109109
for (int i = 0; i < count; i++) {
110110
byte[] bytes = loadString();
111111
String message = new String(bytes, StandardCharsets.US_ASCII);
112112
Nodes.Location location = loadLocation();
113113

114-
var error = new ParseResult.Error(message, location);
114+
ParseResult.Error error = new ParseResult.Error(message, location);
115115
errors[i] = error;
116116
}
117117

@@ -120,15 +120,15 @@ private ParseResult.Error[] loadSyntaxErrors() {
120120

121121
private ParseResult.Warning[] loadWarnings() {
122122
int count = loadVarInt();
123-
var warnings = new ParseResult.Warning[count];
123+
ParseResult.Warning[] warnings = new ParseResult.Warning[count];
124124

125125
// warning messages only contain ASCII characters
126126
for (int i = 0; i < count; i++) {
127127
byte[] bytes = loadString();
128128
String message = new String(bytes, StandardCharsets.US_ASCII);
129129
Nodes.Location location = loadLocation();
130130

131-
var warning = new ParseResult.Warning(message, location);
131+
ParseResult.Warning warning = new ParseResult.Warning(message, location);
132132
warnings[i] = warning;
133133
}
134134

@@ -289,7 +289,7 @@ private Nodes.Node loadNode() {
289289
case 34:
290290
return new Nodes.ConstantPathOperatorWriteNode((Nodes.ConstantPathNode) loadNode(), loadLocation(), loadNode(), loadConstant(), startOffset, length);
291291
case 35:
292-
return new Nodes.ConstantPathWriteNode(loadNode(), loadOptionalLocation(), loadOptionalNode(), startOffset, length);
292+
return new Nodes.ConstantPathWriteNode((Nodes.ConstantPathNode) loadNode(), loadOptionalLocation(), loadOptionalNode(), startOffset, length);
293293
case 36:
294294
return new Nodes.ConstantReadNode(startOffset, length);
295295
case 37:

src/yarp/java/org/yarp/Nodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,11 +1553,11 @@ public <T> T accept(AbstractNodeVisitor<T> visitor) {
15531553
// ::Foo::Bar = 1
15541554
// ^^^^^^^^^^^^^^
15551555
public static final class ConstantPathWriteNode extends Node {
1556-
public final Node target;
1556+
public final ConstantPathNode target;
15571557
public final Location operator_loc; // optional
15581558
public final Node value; // optional
15591559

1560-
public ConstantPathWriteNode(Node target, Location operator_loc, Node value, int startOffset, int length) {
1560+
public ConstantPathWriteNode(ConstantPathNode target, Location operator_loc, Node value, int startOffset, int length) {
15611561
super(startOffset, length);
15621562
this.target = target;
15631563
this.operator_loc = operator_loc;

0 commit comments

Comments
 (0)