Skip to content

Commit 0bb6dde

Browse files
committed
Check InParseNode has a size=1 ArrayParseNode
1 parent 16a58c1 commit 0bb6dde

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/truffleruby/parser/ast/InParseNode.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
***** END LICENSE BLOCK *****/
4040
package org.truffleruby.parser.ast;
4141

42+
import com.oracle.truffle.api.CompilerDirectives;
4243
import org.truffleruby.language.SourceIndexLength;
4344
import org.truffleruby.parser.ast.visitor.NodeVisitor;
4445

@@ -58,7 +59,11 @@ public InParseNode(
5859
super(position);
5960

6061
if (expressionNodes instanceof ArrayParseNode) {
61-
expressionNodes = ((ArrayParseNode) expressionNodes).get(0);
62+
var arrayParseNode = (ArrayParseNode) expressionNodes;
63+
if (arrayParseNode.size() != 1) {
64+
throw CompilerDirectives.shouldNotReachHere();
65+
}
66+
expressionNodes = arrayParseNode.get(0);
6267
}
6368

6469
this.expressionNodes = expressionNodes;

0 commit comments

Comments
 (0)