Skip to content

Commit 8fa0d25

Browse files
committed
Handle arguments after rest in super calls.
1 parent c44a6de commit 8fa0d25

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import java.util.List;
1414

1515
import org.truffleruby.RubyContext;
16-
import org.truffleruby.RubyLanguage;
1716
import org.truffleruby.core.hash.ConcatHashLiteralNode;
1817
import org.truffleruby.core.hash.HashLiteralNode;
1918
import org.truffleruby.language.RubyNode;
@@ -62,8 +61,6 @@ public int getRestParameterIndex() {
6261

6362
@Override
6463
public RubyNode visitArgsNode(ArgsParseNode node) {
65-
final SourceIndexLength sourceSection = node.getPosition();
66-
6764
final List<RubyNode> sequence = new ArrayList<>();
6865
final ParseNode[] args = node.getArgs();
6966
final int preCount = node.getPreCount();
@@ -89,11 +86,16 @@ public RubyNode visitArgsNode(ArgsParseNode node) {
8986
sequence.add(node.getRestArgNode().accept(this));
9087
}
9188

92-
if (node.getPostCount() > 0) {
93-
RubyLanguage.LOGGER.warning(
94-
String.format(
95-
"post args in zsuper not yet implemented at %s%n",
96-
RubyContext.fileLine(sourceSection.toSourceSection(source))));
89+
int postCount = node.getPostCount();
90+
91+
if (postCount > 0) {
92+
index = -1;
93+
94+
int postIndex = node.getPostIndex();
95+
for (int i = postCount - 1; i >= 0; i--) {
96+
sequence.add(args[postIndex + i].accept(this));
97+
index--;
98+
}
9799
}
98100

99101
RubyNode kwArgsNode = null;

0 commit comments

Comments
 (0)