Chromium Code Reviews| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 'constructorReferenceContinuationAfterTypeArguments', | 193 'constructorReferenceContinuationAfterTypeArguments', |
| 194 isContinuation: true); | 194 isContinuation: true); |
| 195 | 195 |
| 196 /// Identifier is the declaration of a label (i.e. it is followed by `:` and | 196 /// Identifier is the declaration of a label (i.e. it is followed by `:` and |
| 197 /// then a statement). | 197 /// then a statement). |
| 198 static const labelDeclaration = const IdentifierContext._('labelDeclaration'); | 198 static const labelDeclaration = const IdentifierContext._('labelDeclaration'); |
| 199 | 199 |
| 200 /// Identifier is the start of a reference occurring in a literal symbol (e.g. | 200 /// Identifier is the start of a reference occurring in a literal symbol (e.g. |
| 201 /// `foo` in `#foo`). | 201 /// `foo` in `#foo`). |
| 202 static const literalSymbol = | 202 static const literalSymbol = |
| 203 const IdentifierContext._('literalSymbol', isScopeReference: true); | 203 const IdentifierContext._('literalSymbol', inSymbol: true); |
|
Paul Berry
2017/03/06 13:54:06
Oh yeah, symbols shouldn't be looked up in the loc
| |
| 204 | 204 |
| 205 /// Identifier is part of a reference occurring in a literal symbol, but it's | 205 /// Identifier is part of a reference occurring in a literal symbol, but it's |
| 206 /// not the first identifier of the reference (e.g. `foo` in `#prefix.foo`). | 206 /// not the first identifier of the reference (e.g. `foo` in `#prefix.foo`). |
| 207 static const literalSymbolContinuation = const IdentifierContext._( | 207 static const literalSymbolContinuation = |
| 208 'literalSymbolContinuation', | 208 const IdentifierContext._('literalSymbolContinuation', inSymbol: true); |
|
Paul Berry
2017/03/06 13:54:06
I think we should keep `isContinuation: true`. Ev
scheglov
2017/03/06 15:44:55
Done.
| |
| 209 isContinuation: true); | |
| 210 | 209 |
| 211 /// Identifier appears in an expression, and it does not immediately follow a | 210 /// Identifier appears in an expression, and it does not immediately follow a |
| 212 /// `.`. | 211 /// `.`. |
| 213 static const expression = | 212 static const expression = |
| 214 const IdentifierContext._('expression', isScopeReference: true); | 213 const IdentifierContext._('expression', isScopeReference: true); |
| 215 | 214 |
| 216 /// Identifier appears in an expression, and it immediately follows a `.`. | 215 /// Identifier appears in an expression, and it immediately follows a `.`. |
| 217 static const expressionContinuation = | 216 static const expressionContinuation = |
| 218 const IdentifierContext._('expressionContinuation', isContinuation: true); | 217 const IdentifierContext._('expressionContinuation', isContinuation: true); |
| 219 | 218 |
| 220 /// Identifier is a reference to a named argument of a function or method | 219 /// Identifier is a reference to a named argument of a function or method |
| 221 /// invocation (e.g. `foo` in `f(foo: 0);`. | 220 /// invocation (e.g. `foo` in `f(foo: 0);`. |
| 222 static const namedArgumentReference = | 221 static const namedArgumentReference = |
| 223 const IdentifierContext._('namedArgumentReference'); | 222 const IdentifierContext._('namedArgumentReference'); |
| 224 | 223 |
| 225 /// Identifier is a name being declared by a local variable declaration. | 224 /// Identifier is a name being declared by a local variable declaration. |
| 226 static const localVariableDeclaration = | 225 static const localVariableDeclaration = |
| 227 const IdentifierContext._('localVariableDeclaration'); | 226 const IdentifierContext._('localVariableDeclaration'); |
| 228 | 227 |
| 229 /// Identifier is a reference to a label (e.g. `foo` in `break foo;`). | 228 /// Identifier is a reference to a label (e.g. `foo` in `break foo;`). |
| 230 static const labelReference = | 229 static const labelReference = |
| 231 const IdentifierContext._('labelReference', isScopeReference: true); | 230 const IdentifierContext._('labelReference', isScopeReference: true); |
| 232 | 231 |
| 233 final String _name; | 232 final String _name; |
| 234 | 233 |
| 235 /// Indicates whether the identifier is within a `library` or `part of` | 234 /// Indicates whether the identifier is within a `library` or `part of` |
| 236 /// declaration. | 235 /// declaration. |
| 237 final bool inLibraryOrPartOfDeclaration; | 236 final bool inLibraryOrPartOfDeclaration; |
| 238 | 237 |
| 238 /// Indicates whether the identifier is within a symbol literal. | |
| 239 final bool inSymbol; | |
| 240 | |
| 239 /// Indicates whether the identifier follows a `.`. | 241 /// Indicates whether the identifier follows a `.`. |
| 240 final bool isContinuation; | 242 final bool isContinuation; |
| 241 | 243 |
| 242 /// Indicates whether the identifier should be looked up in the current scope. | 244 /// Indicates whether the identifier should be looked up in the current scope. |
| 243 final bool isScopeReference; | 245 final bool isScopeReference; |
| 244 | 246 |
| 245 const IdentifierContext._(this._name, | 247 const IdentifierContext._(this._name, |
| 246 {this.inLibraryOrPartOfDeclaration: false, | 248 {this.inLibraryOrPartOfDeclaration: false, |
| 249 this.inSymbol: false, | |
| 247 this.isContinuation: false, | 250 this.isContinuation: false, |
| 248 this.isScopeReference: false}); | 251 this.isScopeReference: false}); |
| 249 | 252 |
| 250 String toString() => _name; | 253 String toString() => _name; |
| 251 } | 254 } |
| OLD | NEW |