OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.dart.element.builder; | 5 library analyzer.src.dart.element.builder; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1296 * Build the table mapping field names to field elements for the fields define d in the current | 1296 * Build the table mapping field names to field elements for the fields define d in the current |
1297 * class. | 1297 * class. |
1298 * | 1298 * |
1299 * @param fields the field elements defined in the current class | 1299 * @param fields the field elements defined in the current class |
1300 */ | 1300 */ |
1301 void _buildFieldMap(List<FieldElement> fields) { | 1301 void _buildFieldMap(List<FieldElement> fields) { |
1302 _fieldMap = new HashMap<String, FieldElement>(); | 1302 _fieldMap = new HashMap<String, FieldElement>(); |
1303 int count = fields.length; | 1303 int count = fields.length; |
1304 for (int i = 0; i < count; i++) { | 1304 for (int i = 0; i < count; i++) { |
1305 FieldElement field = fields[i]; | 1305 FieldElement field = fields[i]; |
1306 _fieldMap[field.name] = field; | 1306 _fieldMap[field.name] ??= field; |
Brian Wilkerson
2016/05/25 23:14:49
Inline field to avoid a list access when not neces
| |
1307 } | 1307 } |
1308 } | 1308 } |
1309 | 1309 |
1310 /** | 1310 /** |
1311 * Creates the [ConstructorElement]s array with the single default constructor element. | 1311 * Creates the [ConstructorElement]s array with the single default constructor element. |
1312 * | 1312 * |
1313 * @param interfaceType the interface type for which to create a default const ructor | 1313 * @param interfaceType the interface type for which to create a default const ructor |
1314 * @return the [ConstructorElement]s array with the single default constructor element | 1314 * @return the [ConstructorElement]s array with the single default constructor element |
1315 */ | 1315 */ |
1316 List<ConstructorElement> _createDefaultConstructors( | 1316 List<ConstructorElement> _createDefaultConstructors( |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1506 return null; | 1506 return null; |
1507 } | 1507 } |
1508 | 1508 |
1509 /** | 1509 /** |
1510 * Return the lexical identifiers associated with the given [identifiers]. | 1510 * Return the lexical identifiers associated with the given [identifiers]. |
1511 */ | 1511 */ |
1512 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { | 1512 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { |
1513 return identifiers.map((identifier) => identifier.name).toList(); | 1513 return identifiers.map((identifier) => identifier.name).toList(); |
1514 } | 1514 } |
1515 } | 1515 } |
OLD | NEW |