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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 680913002: Remove JavaIterator and MapEntry (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/html.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index c0b61f2e69ab0c29218cc31b51644039ef6df1bb..29746a6f4fb82b1f2efdbfb84214cecc181fe33e 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1003,14 +1003,13 @@ class AnalysisContextImpl implements InternalAnalysisContext {
@override
void applyAnalysisDelta(AnalysisDelta delta) {
ChangeSet changeSet = new ChangeSet();
- for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(delta.analysisLevels)) {
- Source source = entry.getKey();
- if (entry.getValue() == AnalysisLevel.NONE) {
+ delta.analysisLevels.forEach((Source source, AnalysisLevel level) {
+ if (level == AnalysisLevel.NONE) {
changeSet.removedSource(source);
} else {
changeSet.addedSource(source);
}
- }
+ });
applyChanges(changeSet);
}
@@ -1043,13 +1042,17 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
_sourceChanged(source);
}
- for (MapEntry<Source, String> entry in getMapEntrySet(changeSet.changedContents)) {
- setContents(entry.getKey(), entry.getValue());
- }
- for (MapEntry<Source, ChangeSet_ContentChange> entry in getMapEntrySet(changeSet.changedRanges)) {
- ChangeSet_ContentChange change = entry.getValue();
- setChangedContents(entry.getKey(), change.contents, change.offset, change.oldLength, change.newLength);
- }
+ changeSet.changedContents.forEach((Source key, String value) {
+ setContents(key, value);
+ });
+ changeSet.changedRanges.forEach((Source source, ChangeSet_ContentChange change) {
+ setChangedContents(
+ source,
+ change.contents,
+ change.offset,
+ change.oldLength,
+ change.newLength);
+ });
for (Source source in changeSet.deletedSources) {
_sourceDeleted(source);
}
@@ -1755,9 +1758,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
@override
void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML);
- for (MapEntry<Source, LibraryElement> entry in getMapEntrySet(elementMap)) {
- Source librarySource = entry.getKey();
- LibraryElement library = entry.getValue();
+ elementMap.forEach((Source librarySource, LibraryElement library) {
//
// Cache the element in the library's info.
//
@@ -1784,7 +1785,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
dartEntry.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, AnalysisError.NO_ERRORS);
dartEntry.setValueInLibrary(DartEntry.HINTS, librarySource, AnalysisError.NO_ERRORS);
}
- }
+ });
}
@override
@@ -4230,9 +4231,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
* @param oldPartMap the table containing the parts associated with each library
*/
void _removeFromPartsUsingMap(HashMap<Source, List<Source>> oldPartMap) {
- for (MapEntry<Source, List<Source>> entry in getMapEntrySet(oldPartMap)) {
- Source librarySource = entry.getKey();
- List<Source> oldParts = entry.getValue();
+ oldPartMap.forEach((Source librarySource, List<Source> oldParts) {
for (int i = 0; i < oldParts.length; i++) {
Source partSource = oldParts[i];
if (partSource != librarySource) {
@@ -4245,7 +4244,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
}
}
- }
+ });
}
/**
@@ -5320,8 +5319,8 @@ class AnalysisDelta {
*/
bool _appendSources(StringBuffer buffer, bool needsSeparator, AnalysisLevel level) {
bool first = true;
- for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(_analysisMap)) {
- if (entry.getValue() == level) {
+ _analysisMap.forEach((Source source, AnalysisLevel sourceLevel) {
+ if (sourceLevel == level) {
if (first) {
first = false;
if (needsSeparator) {
@@ -5332,9 +5331,9 @@ class AnalysisDelta {
} else {
buffer.write(", ");
}
- buffer.write(entry.getKey().fullName);
+ buffer.write(source.fullName);
}
- }
+ });
return needsSeparator || !first;
}
}
@@ -11630,14 +11629,13 @@ class RecordingErrorListener implements AnalysisErrorListener {
* @return an array of errors (not `null`, contains no `null`s)
*/
List<AnalysisError> get errors {
- Iterable<MapEntry<Source, HashSet<AnalysisError>>> entrySet = getMapEntrySet(_errors);
- int numEntries = entrySet.length;
+ int numEntries = _errors.length;
if (numEntries == 0) {
return AnalysisError.NO_ERRORS;
}
List<AnalysisError> resultList = new List<AnalysisError>();
- for (MapEntry<Source, HashSet<AnalysisError>> entry in entrySet) {
- resultList.addAll(entry.getValue());
+ for (HashSet<AnalysisError> errors in _errors.values) {
+ resultList.addAll(errors);
}
return new List.from(resultList);
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698