Minor. Drop unreachable conditional branch
- allowShortAnnotations is true only for IN_ANNOTATION_LIST - when starting parsing of annotation list we can't come to modifier list (see the only usage of IN_ANNOTATION_LIST)
This commit is contained in:
@@ -473,10 +473,6 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
else if (tryParseModifier(tokenConsumer, noModifiersBefore)) {
|
else if (tryParseModifier(tokenConsumer, noModifiersBefore)) {
|
||||||
// modifier advanced
|
// modifier advanced
|
||||||
}
|
}
|
||||||
else if (annotationParsingMode.allowShortAnnotations && at(IDENTIFIER)) {
|
|
||||||
error("Use '@' symbol before annotations");
|
|
||||||
parseAnnotation(annotationParsingMode);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2282,22 +2278,19 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum AnnotationParsingMode {
|
enum AnnotationParsingMode {
|
||||||
DEFAULT(false, false, true),
|
DEFAULT(false, true),
|
||||||
FILE_ANNOTATIONS_BEFORE_PACKAGE(false, true, true),
|
FILE_ANNOTATIONS_BEFORE_PACKAGE(true, true),
|
||||||
FILE_ANNOTATIONS_WHEN_PACKAGE_OMITTED(false, true, true),
|
FILE_ANNOTATIONS_WHEN_PACKAGE_OMITTED(true, true),
|
||||||
IN_ANNOTATION_LIST(true, false, true),
|
IN_ANNOTATION_LIST(false, true),
|
||||||
NO_ANNOTATIONS(false, false, false);
|
NO_ANNOTATIONS(false, false);
|
||||||
|
|
||||||
boolean allowShortAnnotations;
|
|
||||||
boolean isFileAnnotationParsingMode;
|
boolean isFileAnnotationParsingMode;
|
||||||
boolean allowAnnotations;
|
boolean allowAnnotations;
|
||||||
|
|
||||||
AnnotationParsingMode(
|
AnnotationParsingMode(
|
||||||
boolean allowShortAnnotations,
|
|
||||||
boolean isFileAnnotationParsingMode,
|
boolean isFileAnnotationParsingMode,
|
||||||
boolean allowAnnotations
|
boolean allowAnnotations
|
||||||
) {
|
) {
|
||||||
this.allowShortAnnotations = allowShortAnnotations;
|
|
||||||
this.isFileAnnotationParsingMode = isFileAnnotationParsingMode;
|
this.isFileAnnotationParsingMode = isFileAnnotationParsingMode;
|
||||||
this.allowAnnotations = allowAnnotations;
|
this.allowAnnotations = allowAnnotations;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user