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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1588733008: dart2js: Default to an empty set instead of null (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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 05b00d18ac7597b2ca7f308ba7d8f447340387ea..5a467f5515caa27cf5ef87bf27bd1ff76d74db69 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -940,14 +940,14 @@ class JavaScriptBackend extends Backend {
final Map<String, Set<ClassElement>> interceptedClassesCache =
new Map<String, Set<ClassElement>>();
+ final Set<ClassElement> _noClasses = new Set<ClassElement>();
- /**
- * Returns a set of interceptor classes that contain a member named
- * [name]. Returns [:null:] if there is no class.
- */
+ /// Returns a set of interceptor classes that contain a member named [name]
+ ///
+ /// Returns an empty set if there is no class. Do not modify the returned set.
Set<ClassElement> getInterceptedClassesOn(String name) {
Set<Element> intercepted = interceptedElements[name];
- if (intercepted == null) return null;
+ if (intercepted == null) return _noClasses;
return interceptedClassesCache.putIfAbsent(name, () {
// Populate the cache by running through all the elements and
// determine if the given selector applies to them.
« 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