Index: pkg/compiler/lib/src/common_elements.dart |
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart |
index 379e9c8ba2922db9ee8ba59b4a985287c5009780..580935ed9c6c8cae97da7357fa2eabdefaedd99d 100644 |
--- a/pkg/compiler/lib/src/common_elements.dart |
+++ b/pkg/compiler/lib/src/common_elements.dart |
@@ -5,6 +5,7 @@ |
// TODO(sigmund): rename and move to common/elements.dart |
library dart2js.type_system; |
+import 'common.dart'; |
import 'common/names.dart' show Identifiers, Uris; |
import 'constants/values.dart'; |
import 'elements/entities.dart'; |
@@ -1161,6 +1162,17 @@ class CommonElements { |
_ensureExpectAnnotations(); |
return _expectAssumeDynamicClass; |
} |
+ |
+ /// Returns `true` if the implementation of the 'operator ==' [function] is |
+ /// known to handle `null` as argument. |
+ bool operatorEqHandlesNullArgument(FunctionEntity function) { |
+ assert(function.name == '==', |
+ failedAt(function, "Unexpected function $function.")); |
+ ClassEntity cls = function.enclosingClass; |
+ return cls == objectClass || |
+ cls == jsInterceptorClass || |
+ cls == jsNullClass; |
+ } |
} |
/// Interface for accessing libraries, classes and members. |