@@ -169,11 +169,12 @@ class AstBuilder extends StackListener {
169169 }
170170
171171 @override
172- void beginFormalParameter (Token token, MemberKind kind, Token covariantToken ,
173- Token varFinalOrConst) {
172+ void beginFormalParameter (Token token, MemberKind kind, Token requiredToken ,
173+ Token covariantToken, Token varFinalOrConst) {
174174 push (new _Modifiers ()
175175 ..covariantKeyword = covariantToken
176- ..finalConstOrVarKeyword = varFinalOrConst);
176+ ..finalConstOrVarKeyword = varFinalOrConst
177+ ..requiredToken = requiredToken);
177178 }
178179
179180 @override
@@ -791,6 +792,9 @@ class AstBuilder extends StackListener {
791792 _Modifiers modifiers = pop ();
792793 Token keyword = modifiers? .finalConstOrVarKeyword;
793794 Token covariantKeyword = modifiers? .covariantKeyword;
795+ Token requiredKeyword = modifiers? .requiredToken;
796+ // TODO(danrubel): handle required token
797+ reportNonNullableModifierError (requiredKeyword);
794798 List <Annotation > metadata = pop ();
795799 Comment comment = _findComment (metadata,
796800 thisKeyword ?? typeOrFunctionTypedParameter? .beginToken ?? nameToken);
@@ -3291,34 +3295,7 @@ class _Modifiers {
32913295 Token finalConstOrVarKeyword;
32923296 Token staticKeyword;
32933297 Token covariantKeyword;
3294-
3295- _Modifiers ([List <Token > modifierTokens]) {
3296- // No need to check the order and uniqueness of the modifiers, or that
3297- // disallowed modifiers are not used; the parser should do that.
3298- // TODO(paulberry,ahe): implement the necessary logic in the parser.
3299- if (modifierTokens != null ) {
3300- for (var token in modifierTokens) {
3301- var s = token.lexeme;
3302- if (identical ('abstract' , s)) {
3303- abstractKeyword = token;
3304- } else if (identical ('const' , s)) {
3305- finalConstOrVarKeyword = token;
3306- } else if (identical ('external' , s)) {
3307- externalKeyword = token;
3308- } else if (identical ('final' , s)) {
3309- finalConstOrVarKeyword = token;
3310- } else if (identical ('static' , s)) {
3311- staticKeyword = token;
3312- } else if (identical ('var' , s)) {
3313- finalConstOrVarKeyword = token;
3314- } else if (identical ('covariant' , s)) {
3315- covariantKeyword = token;
3316- } else {
3317- unhandled ("$s " , "modifier" , token.charOffset, null );
3318- }
3319- }
3320- }
3321- }
3298+ Token requiredToken;
33223299
33233300 /// Return the token that is lexically first.
33243301 Token get beginToken {
@@ -3328,7 +3305,8 @@ class _Modifiers {
33283305 externalKeyword,
33293306 finalConstOrVarKeyword,
33303307 staticKeyword,
3331- covariantKeyword
3308+ covariantKeyword,
3309+ requiredToken,
33323310 ]) {
33333311 if (firstToken == null ) {
33343312 firstToken = token;
0 commit comments