Relax assertion in parser for a recovery case with annotations
^KT-24937 Fixed
This commit is contained in:
@@ -750,7 +750,10 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
*/
|
||||
private boolean parseAnnotation(AnnotationParsingMode mode) {
|
||||
assert _at(IDENTIFIER) ||
|
||||
(_at(AT) && !WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(1)));
|
||||
// We have "@ann" or "@:ann" or "@ :ann", but not "@ ann"
|
||||
// (it's guaranteed that call sites do not allow the latter case)
|
||||
(_at(AT) && (!isNextRawTokenCommentOrWhitespace() || lookahead(1) == COLON))
|
||||
: "Invalid annotation prefix";
|
||||
|
||||
PsiBuilder.Marker annotation = mark();
|
||||
|
||||
@@ -780,6 +783,10 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isNextRawTokenCommentOrWhitespace() {
|
||||
return WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(1));
|
||||
}
|
||||
|
||||
public enum NameParsingMode {
|
||||
REQUIRED,
|
||||
ALLOWED,
|
||||
|
||||
Reference in New Issue
Block a user