@@ -946,17 +946,6 @@ class AstBuilder extends StackListener {
946946 Token covariantKeyword = covariantToken;
947947 List <Annotation > metadata = pop ();
948948 Comment comment = _findComment (metadata, beginToken);
949- if (extensionDeclaration != null && staticToken == null ) {
950- // TODO(brianwilkerson) Decide how to handle constructor and field
951- // declarations within extensions. They are invalid, but we might want to
952- // resolve them in order to get navigation, search, etc.
953- for (VariableDeclaration variable in variables) {
954- errorReporter.errorReporter.reportErrorForNode (
955- CompileTimeErrorCode .EXTENSION_DECLARES_INSTANCE_FIELD ,
956- variable.name);
957- }
958- return ;
959- }
960949 currentDeclarationMembers.add (ast.fieldDeclaration2 (
961950 comment: comment,
962951 metadata: metadata,
@@ -966,6 +955,32 @@ class AstBuilder extends StackListener {
966955 semicolon: semicolon));
967956 }
968957
958+ @override
959+ void endMixinFields (Token staticToken, Token covariantToken, Token lateToken,
960+ Token varFinalOrConst, int count, Token beginToken, Token endToken) {
961+ endClassFields (staticToken, covariantToken, lateToken, varFinalOrConst,
962+ count, beginToken, endToken);
963+ }
964+
965+ @override
966+ void endExtensionFields (
967+ Token staticToken,
968+ Token covariantToken,
969+ Token lateToken,
970+ Token varFinalOrConst,
971+ int count,
972+ Token beginToken,
973+ Token endToken) {
974+ if (staticToken == null ) {
975+ // TODO(danrubel) Decide how to handle instance field declarations
976+ // within extensions. They are invalid and the parser has already reported
977+ // an error at this point, but we include them in order to get navigation,
978+ // search, etc.
979+ }
980+ endClassFields (staticToken, covariantToken, lateToken, varFinalOrConst,
981+ count, beginToken, endToken);
982+ }
983+
969984 @override
970985 void endForControlFlow (Token token) {
971986 debugEvent ("endForControlFlow" );
0 commit comments