Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/identifier_context.dart

Issue 2948383002: Remove peeking from parseTypedef and parseClassOrNamedMixinApplication. (Closed)
Patch Set: Addressed comments and then some. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Information about the parser state which is passed to the listener at the 5 /// Information about the parser state which is passed to the listener at the
6 /// time an identifier is encountered. 6 /// time an identifier is encountered.
7 /// 7 ///
8 /// This can be used by the listener to determine the context in which the 8 /// This can be used by the listener to determine the context in which the
9 /// identifier appears; that in turn can help the listener decide how to resolve 9 /// identifier appears; that in turn can help the listener decide how to resolve
10 /// the identifier (if the listener is doing resolution). 10 /// the identifier (if the listener is doing resolution).
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 /// Identifier is the type name being declared by an enum declaration. 89 /// Identifier is the type name being declared by an enum declaration.
90 static const enumDeclaration = const IdentifierContext._('enumDeclaration', 90 static const enumDeclaration = const IdentifierContext._('enumDeclaration',
91 inDeclaration: true, isBuiltInIdentifierAllowed: false); 91 inDeclaration: true, isBuiltInIdentifierAllowed: false);
92 92
93 /// Identifier is an enumerated value name being declared by an enum 93 /// Identifier is an enumerated value name being declared by an enum
94 /// declaration. 94 /// declaration.
95 static const enumValueDeclaration = 95 static const enumValueDeclaration =
96 const IdentifierContext._('enumValueDeclaration', inDeclaration: true); 96 const IdentifierContext._('enumValueDeclaration', inDeclaration: true);
97 97
98 /// Identifier is the name being declared by a named mixin declaration (e.g. 98 /// Identifier is the name being declared by a class declaration or a named
99 /// `Foo` in `class Foo = X with Y;`). 99 /// mixin application, for example, `Foo` in `class Foo = X with Y;`.
100 static const namedMixinDeclaration = const IdentifierContext._( 100 static const classOrNamedMixinDeclaration = const IdentifierContext._(
101 'namedMixinDeclaration', 101 'classOrNamedMixinDeclaration',
102 inDeclaration: true, 102 inDeclaration: true,
103 isBuiltInIdentifierAllowed: false); 103 isBuiltInIdentifierAllowed: false);
104 104
105 /// Identifier is the name being declared by a class declaration.
106 static const classDeclaration = const IdentifierContext._('classDeclaration',
107 inDeclaration: true, isBuiltInIdentifierAllowed: false);
108
109 /// Identifier is the name of a type variable being declared (e.g. `Foo` in 105 /// Identifier is the name of a type variable being declared (e.g. `Foo` in
110 /// `class C<Foo extends num> {}`). 106 /// `class C<Foo extends num> {}`).
111 static const typeVariableDeclaration = const IdentifierContext._( 107 static const typeVariableDeclaration = const IdentifierContext._(
112 'typeVariableDeclaration', 108 'typeVariableDeclaration',
113 inDeclaration: true, 109 inDeclaration: true,
114 isBuiltInIdentifierAllowed: false); 110 isBuiltInIdentifierAllowed: false);
115 111
116 /// Identifier is the start of a reference to a type that starts with prefix. 112 /// Identifier is the start of a reference to a type that starts with prefix.
117 static const prefixedTypeReference = const IdentifierContext._( 113 static const prefixedTypeReference = const IdentifierContext._(
118 'prefixedTypeReference', 114 'prefixedTypeReference',
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 bool allowedInConstantExpression}) 291 bool allowedInConstantExpression})
296 : this.allowedInConstantExpression = 292 : this.allowedInConstantExpression =
297 // Generally, declarations are legal in constant expressions. A 293 // Generally, declarations are legal in constant expressions. A
298 // continuation doesn't affect constant expressions: if what it's 294 // continuation doesn't affect constant expressions: if what it's
299 // continuing is a problem, it has already been reported. 295 // continuing is a problem, it has already been reported.
300 allowedInConstantExpression ?? 296 allowedInConstantExpression ??
301 (inDeclaration || isContinuation || inSymbol); 297 (inDeclaration || isContinuation || inSymbol);
302 298
303 String toString() => _name; 299 String toString() => _name;
304 } 300 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/fasta/ast_builder.dart ('k') | pkg/front_end/lib/src/fasta/parser/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698