Skip to content

Commit b33f5fd

Browse files
committed
Use length field directly and use Node.EMPTY_ARRAY
1 parent cfad840 commit b33f5fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public RubyNode visitCallNode(Nodes.CallNode node) {
201201
var arguments = node.arguments.arguments;
202202

203203
if (arguments == null) {
204-
arguments = new Nodes.Node[]{};
204+
arguments = Nodes.Node.EMPTY_ARRAY;
205205
}
206206

207207
var translatedArguments = new RubyNode[arguments.length];
@@ -784,7 +784,7 @@ public RubyNode visitSplatNode(Nodes.SplatNode node) {
784784
}
785785

786786
public RubyNode visitStatementsNode(Nodes.StatementsNode node) {
787-
var location = new SourceIndexLength(node.startOffset, node.length());
787+
var location = new SourceIndexLength(node.startOffset, node.length);
788788

789789
var body = node.body;
790790
var translated = new RubyNode[body.length];
@@ -933,11 +933,11 @@ protected RubyContextSourceNode createCallNode(RubyNode receiver, String method,
933933
}
934934

935935
private String toString(Nodes.Location location) {
936-
return new String(sourceBytes, location.startOffset, location.length(), StandardCharsets.US_ASCII);
936+
return new String(sourceBytes, location.startOffset, location.length, StandardCharsets.US_ASCII);
937937
}
938938

939939
private String toString(Nodes.Node node) {
940-
return new String(sourceBytes, node.startOffset, node.length(), StandardCharsets.US_ASCII);
940+
return new String(sourceBytes, node.startOffset, node.length, StandardCharsets.US_ASCII);
941941
}
942942

943943
private String toString(Nodes.SymbolNode node) {

0 commit comments

Comments
 (0)