OLD | NEW |
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 static const classDeclaration = const IdentifierContext._('classDeclaration', | 106 static const classDeclaration = const IdentifierContext._('classDeclaration', |
107 inDeclaration: true, isBuiltInIdentifierAllowed: false); | 107 inDeclaration: true, isBuiltInIdentifierAllowed: false); |
108 | 108 |
109 /// Identifier is the name of a type variable being declared (e.g. `Foo` in | 109 /// Identifier is the name of a type variable being declared (e.g. `Foo` in |
110 /// `class C<Foo extends num> {}`). | 110 /// `class C<Foo extends num> {}`). |
111 static const typeVariableDeclaration = const IdentifierContext._( | 111 static const typeVariableDeclaration = const IdentifierContext._( |
112 'typeVariableDeclaration', | 112 'typeVariableDeclaration', |
113 inDeclaration: true, | 113 inDeclaration: true, |
114 isBuiltInIdentifierAllowed: false); | 114 isBuiltInIdentifierAllowed: false); |
115 | 115 |
| 116 /// Identifier is the start of a reference to a type that starts with prefix. |
| 117 static const prefixedTypeReference = const IdentifierContext._( |
| 118 'prefixedTypeReference', |
| 119 isScopeReference: true, |
| 120 isBuiltInIdentifierAllowed: true); |
| 121 |
116 /// Identifier is the start of a reference to a type declared elsewhere. | 122 /// Identifier is the start of a reference to a type declared elsewhere. |
117 static const typeReference = const IdentifierContext._('typeReference', | 123 static const typeReference = const IdentifierContext._('typeReference', |
118 isScopeReference: true, isBuiltInIdentifierAllowed: false); | 124 isScopeReference: true, isBuiltInIdentifierAllowed: false); |
119 | 125 |
120 /// Identifier is part of a reference to a type declared elsewhere, but it's | 126 /// Identifier is part of a reference to a type declared elsewhere, but it's |
121 /// not the first identifier of the reference. | 127 /// not the first identifier of the reference. |
122 static const typeReferenceContinuation = const IdentifierContext._( | 128 static const typeReferenceContinuation = const IdentifierContext._( |
123 'typeReferenceContinuation', | 129 'typeReferenceContinuation', |
124 isContinuation: true, | 130 isContinuation: true, |
125 isBuiltInIdentifierAllowed: false); | 131 isBuiltInIdentifierAllowed: false); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 bool allowedInConstantExpression}) | 295 bool allowedInConstantExpression}) |
290 : this.allowedInConstantExpression = | 296 : this.allowedInConstantExpression = |
291 // Generally, declarations are legal in constant expressions. A | 297 // Generally, declarations are legal in constant expressions. A |
292 // continuation doesn't affect constant expressions: if what it's | 298 // continuation doesn't affect constant expressions: if what it's |
293 // continuing is a problem, it has already been reported. | 299 // continuing is a problem, it has already been reported. |
294 allowedInConstantExpression ?? | 300 allowedInConstantExpression ?? |
295 (inDeclaration || isContinuation || inSymbol); | 301 (inDeclaration || isContinuation || inSymbol); |
296 | 302 |
297 String toString() => _name; | 303 String toString() => _name; |
298 } | 304 } |
OLD | NEW |