Skip to content

Commit f887a30

Browse files
committed
Copy the newline flag from YARP
1 parent 09285e0 commit f887a30

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ public RubyNode visitInterpolatedStringNode(Nodes.InterpolatedStringNode node) {
520520
final RubyNode rubyNode = new StringLiteralNode(cachedTString, Encodings.UTF_8);
521521

522522
assignNodePositionInSource(node, rubyNode);
523+
copyNewlineFlag(s, rubyNode);
523524

524525
return rubyNode;
525526
}
@@ -548,6 +549,7 @@ public RubyNode visitInterpolatedSymbolNode(Nodes.InterpolatedSymbolNode node) {
548549
final RubyNode rubyNode = new ObjectLiteralNode(symbol);
549550

550551
assignNodePositionInSource(node, rubyNode);
552+
copyNewlineFlag(s, rubyNode);
551553

552554
return rubyNode;
553555
}
@@ -946,6 +948,13 @@ private String toString(Nodes.SymbolNode node) {
946948

947949
private void assignNodePositionInSource(Nodes.Node yarpNode, RubyNode rubyNode) {
948950
rubyNode.unsafeSetSourceSection(yarpNode.startOffset, yarpNode.length);
951+
copyNewlineFlag(yarpNode, rubyNode);
952+
}
953+
954+
private void copyNewlineFlag(Nodes.Node yarpNode, RubyNode rubyNode) {
955+
if (yarpNode.hasNewLineFlag()) {
956+
rubyNode.unsafeSetIsNewLine();
957+
}
949958
}
950959

951960
}

0 commit comments

Comments
 (0)