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

Unified Diff: pkg/analyzer/lib/src/summary/summarize_elements.dart

Issue 1574053002: Move NameFilter to its own file so it can be conveniently reused. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/summary/prelink.dart ('k') | pkg/analyzer/test/src/summary/name_filter_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/summarize_elements.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_elements.dart b/pkg/analyzer/lib/src/summary/summarize_elements.dart
index 80f846e6382d6df059ca5ef8c1768907c4f43d8f..0aac780e54fb4fb313354d4bd19905dc7ced2520 100644
--- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
@@ -10,6 +10,7 @@ import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/summary/format.dart';
+import 'package:analyzer/src/summary/name_filter.dart';
/**
* Serialize all the elements in [lib] to a summary using [ctx] as the context
@@ -282,31 +283,15 @@ class _LibrarySerializer {
}
import.importedLibrary.exportNamespace.definedNames
.forEach((String name, Element e) {
- if (import.combinators.any((NamespaceCombinator combinator) =>
- doesCombinatorReject(combinator, name))) {
- return;
+ if (new NameFilter.forNamespaceCombinators(import.combinators)
+ .accepts(name)) {
+ prefixMap[e] = import.prefix;
}
- prefixMap[e] = import.prefix;
});
}
}
/**
- * Determine if the given [combinator] would reject an element having the
- * given [name].
- */
- bool doesCombinatorReject(NamespaceCombinator combinator, String name) {
- if (combinator is ShowElementCombinator) {
- return !combinator.shownNames.contains(name);
- } else if (combinator is HideElementCombinator) {
- return combinator.hiddenNames.contains(name);
- } else {
- throw new StateError(
- 'Unexpected combinator type ${combinator.runtimeType}');
- }
- }
-
- /**
* Compute the appropriate De Bruijn index to represent the given type
* parameter [type].
*/
@@ -727,8 +712,7 @@ class _LibrarySerializer {
if (unresolvedReferenceIndex == null) {
assert(unlinkedReferences.length == prelinkedReferences.length);
unresolvedReferenceIndex = unlinkedReferences.length;
- unlinkedReferences
- .add(encodeUnlinkedReference(name: '*unresolved*'));
+ unlinkedReferences.add(encodeUnlinkedReference(name: '*unresolved*'));
prelinkedReferences.add(
encodePrelinkedReference(kind: PrelinkedReferenceKind.unresolved));
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/prelink.dart ('k') | pkg/analyzer/test/src/summary/name_filter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698