Minor, drop redundant allowAtAnnotations option

As '@' annotations are allowed everywhere
This commit is contained in:
Denis Zharkov
2015-05-12 20:00:22 +03:00
parent 488464dd3b
commit 1df08cfa6c
@@ -444,10 +444,6 @@ public class JetParsing extends AbstractJetParsing {
if (at(AT)) { if (at(AT)) {
IElementType strictlyNextToken = myBuilder.rawLookup(1); IElementType strictlyNextToken = myBuilder.rawLookup(1);
if (strictlyNextToken == IDENTIFIER || MODIFIER_KEYWORDS.contains(strictlyNextToken)) { if (strictlyNextToken == IDENTIFIER || MODIFIER_KEYWORDS.contains(strictlyNextToken)) {
if (!annotationParsingMode.allowAtAnnotations) {
errorAndAdvance("Only annotations in '[]' can be declared here"); // AT
}
if (!tryParseModifier(tokenConsumer)) { if (!tryParseModifier(tokenConsumer)) {
parseAnnotationEntry(); parseAnnotationEntry();
} }
@@ -547,7 +543,7 @@ public class JetParsing extends AbstractJetParsing {
parseAnnotationEntry(); parseAnnotationEntry();
return true; return true;
} }
else if (mode.allowAtAnnotations && at(AT)) { else if (at(AT)) {
if (myBuilder.rawLookup(1) == IDENTIFIER) { if (myBuilder.rawLookup(1) == IDENTIFIER) {
parseAnnotationEntry(); parseAnnotationEntry();
} }
@@ -2263,28 +2259,25 @@ public class JetParsing extends AbstractJetParsing {
} }
enum AnnotationParsingMode { enum AnnotationParsingMode {
FILE_ANNOTATIONS_BEFORE_PACKAGE(false, true, false, false), FILE_ANNOTATIONS_BEFORE_PACKAGE(false, true, false),
FILE_ANNOTATIONS_WHEN_PACKAGE_OMITTED(false, true, false, false), FILE_ANNOTATIONS_WHEN_PACKAGE_OMITTED(false, true, false),
ONLY_ESCAPED_REGULAR_ANNOTATIONS(false, false, false, true), ONLY_ESCAPED_REGULAR_ANNOTATIONS(false, false, false),
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS(true, false, false, true), ALLOW_UNESCAPED_REGULAR_ANNOTATIONS(true, false, false),
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS_AT_MEMBER_MODIFIER_LIST(true, false, true, true), ALLOW_UNESCAPED_REGULAR_ANNOTATIONS_AT_MEMBER_MODIFIER_LIST(true, false, true),
PRIMARY_CONSTRUCTOR_MODIFIER_LIST(true, false, false, true); PRIMARY_CONSTRUCTOR_MODIFIER_LIST(true, false, false);
boolean allowShortAnnotations; boolean allowShortAnnotations;
boolean isFileAnnotationParsingMode; boolean isFileAnnotationParsingMode;
boolean atMemberStart = false; boolean atMemberStart;
boolean allowAtAnnotations = true;
AnnotationParsingMode( AnnotationParsingMode(
boolean allowShortAnnotations, boolean allowShortAnnotations,
boolean isFileAnnotationParsingMode, boolean isFileAnnotationParsingMode,
boolean atMemberStart, boolean atMemberStart
boolean allowAtAnnotations
) { ) {
this.allowShortAnnotations = allowShortAnnotations; this.allowShortAnnotations = allowShortAnnotations;
this.isFileAnnotationParsingMode = isFileAnnotationParsingMode; this.isFileAnnotationParsingMode = isFileAnnotationParsingMode;
this.atMemberStart = atMemberStart; this.atMemberStart = atMemberStart;
this.allowAtAnnotations = allowAtAnnotations;
} }
} }
} }