| Index: lib/src/compiler/nullable_type_inference.dart
|
| diff --git a/lib/src/codegen/nullable_type_inference.dart b/lib/src/compiler/nullable_type_inference.dart
|
| similarity index 97%
|
| rename from lib/src/codegen/nullable_type_inference.dart
|
| rename to lib/src/compiler/nullable_type_inference.dart
|
| index 562d63d7885ae2b07ca7f55faee12b768adf0691..f930333ed6fd3dbde59e14def4febf222b65e664 100644
|
| --- a/lib/src/codegen/nullable_type_inference.dart
|
| +++ b/lib/src/compiler/nullable_type_inference.dart
|
| @@ -8,7 +8,7 @@ import 'package:analyzer/dart/ast/token.dart' show TokenType;
|
| import 'package:analyzer/dart/ast/visitor.dart' show RecursiveAstVisitor;
|
| import 'package:analyzer/dart/element/element.dart';
|
| import 'package:analyzer/dart/element/type.dart';
|
| -import '../utils.dart' show getStaticType, isInlineJS;
|
| +import 'element_helpers.dart' show getStaticType, isInlineJS;
|
|
|
| /// An inference engine for nullable types.
|
| ///
|
| @@ -21,15 +21,16 @@ import '../utils.dart' show getStaticType, isInlineJS;
|
| // TODO(vsm): Revisit whether we really need this when we get
|
| // better non-nullability in the type system.
|
| abstract class NullableTypeInference {
|
| + LibraryElement dartCoreLibrary;
|
| bool isPrimitiveType(DartType type);
|
| bool isObjectProperty(String name);
|
|
|
| /// Known non-null local variables.
|
| HashSet<LocalVariableElement> _notNullLocals;
|
|
|
| - void inferNullableTypesInLibrary(Iterable<CompilationUnit> units) {
|
| + void inferNullableTypes(AstNode node) {
|
| var visitor = new _NullableLocalInference(this);
|
| - for (var unit in units) unit.accept(visitor);
|
| + node.accept(visitor);
|
| _notNullLocals = visitor.computeNotNullLocals();
|
| }
|
|
|
| @@ -178,9 +179,7 @@ abstract class NullableTypeInference {
|
| }
|
| }
|
|
|
| - if (e != null &&
|
| - e.name == 'identical' &&
|
| - e.library.source.uri.toString() == 'dart:core') {
|
| + if (e?.name == 'identical' && identical(e.library, dartCoreLibrary)) {
|
| return false;
|
| }
|
| }
|
|
|