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

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 996053003: Use Map.addAll() where possible in the resolver. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 engine.resolver; 5 library engine.resolver;
6 6
7 import "dart:math" as math; 7 import "dart:math" as math;
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/src/generated/utilities_collection.dart'; 10 import 'package:analyzer/src/generated/utilities_collection.dart';
(...skipping 9341 matching lines...) Expand 10 before | Expand all | Expand 10 after
9352 } 9352 }
9353 return new Namespace(definedNames); 9353 return new Namespace(definedNames);
9354 } 9354 }
9355 9355
9356 /** 9356 /**
9357 * Add all of the names in the given namespace to the given mapping table. 9357 * Add all of the names in the given namespace to the given mapping table.
9358 * 9358 *
9359 * @param definedNames the mapping table to which the names in the given names pace are to be added 9359 * @param definedNames the mapping table to which the names in the given names pace are to be added
9360 * @param namespace the namespace containing the names to be added to this nam espace 9360 * @param namespace the namespace containing the names to be added to this nam espace
9361 */ 9361 */
9362 void _addAllFromMap( 9362 void _addAllFromMap(
Brian Wilkerson 2015/03/12 18:59:44 Shouldn't we just get rid of this helper method?
9363 Map<String, Element> definedNames, Map<String, Element> newNames) { 9363 Map<String, Element> definedNames, Map<String, Element> newNames) {
9364 newNames.forEach((String name, Element element) { 9364 definedNames.addAll(newNames);
9365 definedNames[name] = element;
9366 });
9367 } 9365 }
9368 9366
9369 /** 9367 /**
9370 * Add all of the names in the given namespace to the given mapping table. 9368 * Add all of the names in the given namespace to the given mapping table.
9371 * 9369 *
9372 * @param definedNames the mapping table to which the names in the given names pace are to be added 9370 * @param definedNames the mapping table to which the names in the given names pace are to be added
9373 * @param namespace the namespace containing the names to be added to this nam espace 9371 * @param namespace the namespace containing the names to be added to this nam espace
9374 */ 9372 */
9375 void _addAllFromNamespace( 9373 void _addAllFromNamespace(
9376 Map<String, Element> definedNames, Namespace namespace) { 9374 Map<String, Element> definedNames, Namespace namespace) {
9377 if (namespace != null) { 9375 if (namespace != null) {
9378 _addAllFromMap(definedNames, namespace.definedNames); 9376 definedNames.addAll(namespace.definedNames);
9379 } 9377 }
9380 } 9378 }
9381 9379
9382 /** 9380 /**
9383 * Add the given element to the given mapping table if it has a publicly visib le name. 9381 * Add the given element to the given mapping table if it has a publicly visib le name.
9384 * 9382 *
9385 * @param definedNames the mapping table to which the public name is to be add ed 9383 * @param definedNames the mapping table to which the public name is to be add ed
9386 * @param element the element to be added 9384 * @param element the element to be added
9387 */ 9385 */
9388 void _addIfPublic(Map<String, Element> definedNames, Element element) { 9386 void _addIfPublic(Map<String, Element> definedNames, Element element) {
(...skipping 3503 matching lines...) Expand 10 before | Expand all | Expand 10 after
12892 * @param outerScope the outer scope in which types might be overridden 12890 * @param outerScope the outer scope in which types might be overridden
12893 */ 12891 */
12894 TypeOverrideManager_TypeOverrideScope(this._outerScope); 12892 TypeOverrideManager_TypeOverrideScope(this._outerScope);
12895 12893
12896 /** 12894 /**
12897 * Apply a set of overrides that were previously captured. 12895 * Apply a set of overrides that were previously captured.
12898 * 12896 *
12899 * @param overrides the overrides to be applied 12897 * @param overrides the overrides to be applied
12900 */ 12898 */
12901 void applyOverrides(Map<VariableElement, DartType> overrides) { 12899 void applyOverrides(Map<VariableElement, DartType> overrides) {
12902 overrides.forEach((VariableElement element, DartType type) { 12900 _overridenTypes.addAll(overrides);
12903 _overridenTypes[element] = type;
12904 });
12905 } 12901 }
12906 12902
12907 /** 12903 /**
12908 * Return a table mapping the elements whose type is overridden in the current scope to the 12904 * Return a table mapping the elements whose type is overridden in the current scope to the
12909 * overriding type. 12905 * overriding type.
12910 * 12906 *
12911 * @return the overrides in the current scope 12907 * @return the overrides in the current scope
12912 */ 12908 */
12913 Map<VariableElement, DartType> captureLocalOverrides() => _overridenTypes; 12909 Map<VariableElement, DartType> captureLocalOverrides() => _overridenTypes;
12914 12910
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after
15393 * library. 15389 * library.
15394 */ 15390 */
15395 final HashSet<String> members = new HashSet<String>(); 15391 final HashSet<String> members = new HashSet<String>();
15396 15392
15397 /** 15393 /**
15398 * Names of resolved or unresolved class members that are read in the 15394 * Names of resolved or unresolved class members that are read in the
15399 * library. 15395 * library.
15400 */ 15396 */
15401 final HashSet<String> readMembers = new HashSet<String>(); 15397 final HashSet<String> readMembers = new HashSet<String>();
15402 } 15398 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698