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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/InheritanceManager.java

Issue 187803004: Have MemberMap backed by a HashMap, not an array (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/MemberMap.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/InheritanceManager.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/InheritanceManager.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/InheritanceManager.java
index 0df7b176f479a1155eb72e9fecb16ab1dc306ee8..4274990f1cfb065ab47d85552bf0acbe2c70e7f8 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/InheritanceManager.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/InheritanceManager.java
@@ -483,9 +483,9 @@ public class InheritanceManager {
//
// Add the members from map into result map.
//
- for (int j = 0; j < map.getSize(); j++) {
- String key = map.getKey(j);
- ExecutableElement value = map.getValue(j);
+ Set<String> keys = map.getKeys();
+ for (String key : keys) {
+ ExecutableElement value = map.getValue(key);
if (key != null) {
if (resultMap.get(key) == null
|| (resultMap.get(key) != null && !isAbstract(value))) {
@@ -741,14 +741,8 @@ public class InheritanceManager {
//
HashMap<String, ArrayList<ExecutableElement>> unionMap = new HashMap<String, ArrayList<ExecutableElement>>();
for (MemberMap lookupMap : lookupMaps) {
- int lookupMapSize = lookupMap.getSize();
- for (int i = 0; i < lookupMapSize; i++) {
- // Get the string key, if null, break.
- String key = lookupMap.getKey(i);
- if (key == null) {
- break;
- }
-
+ Set<String> keys = lookupMap.getKeys();
+ for (String key : keys) {
// Get the list value out of the unionMap
ArrayList<ExecutableElement> list = unionMap.get(key);
@@ -760,7 +754,7 @@ public class InheritanceManager {
}
// Fetch the entry out of this lookupMap
- ExecutableElement newExecutableElementEntry = lookupMap.getValue(i);
+ ExecutableElement newExecutableElementEntry = lookupMap.getValue(key);
if (list.isEmpty()) {
// If the list is empty, just the new value
@@ -997,16 +991,17 @@ public class InheritanceManager {
* @param map the MemberMap to perform the substitutions on
*/
private void substituteTypeParametersDownHierarchy(InterfaceType superType, MemberMap map) {
- for (int i = 0; i < map.getSize(); i++) {
- ExecutableElement executableElement = map.getValue(i);
+ Set<String> keys = map.getKeys();
+ for (String key : keys) {
+ ExecutableElement executableElement = map.getValue(key);
if (executableElement instanceof MethodMember) {
executableElement = MethodMember.from((MethodMember) executableElement, superType);
- map.setValue(i, executableElement);
+ map.put(key, executableElement);
} else if (executableElement instanceof PropertyAccessorMember) {
executableElement = PropertyAccessorMember.from(
(PropertyAccessorMember) executableElement,
superType);
- map.setValue(i, executableElement);
+ map.put(key, executableElement);
}
}
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/MemberMap.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698