Skip to content

Commit a387787

Browse files
committed
Adopt changing Nodes.ConstantPathWriteNode#target type from Node to ConstantPathNode
1 parent faa1997 commit a387787

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

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;

0 commit comments

Comments
 (0)