Fix parsing bug

This commit is contained in:
Clément Fournier
2022-01-29 19:04:32 +01:00
parent da96eab924
commit ed1c9e970a

View File

@ -1734,14 +1734,15 @@ void InstanceOfExpression() #void:
LOOKAHEAD(1)
("instanceof"
(
LOOKAHEAD(1, "(" | "final" | "@") PrimaryPattern()
| LOOKAHEAD(1) AnnotatedRefType() [ VariableDeclaratorId() #TypePattern(2) ]
AnnotatedRefType() [ VariableDeclaratorId() #TypePattern(2) ]
| PrimaryPattern()
)
{
jjtThis.setOp(BinaryOp.INSTANCEOF);
AbstractJavaNode top = jjtree.popNode();
if (top instanceof ASTPattern) {
if (top instanceof ASTTypePattern) {
if (top instanceof ASTTypePattern && !(top.getChild(0) instanceof ASTModifierList)) {
insertEmptyModifierListWithAnnotations(top, (AbstractJavaNode) top.getChild(0));
}
top = new ASTPatternExpression((ASTPattern) top);