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

Unified Diff: pkg/compiler/lib/src/inferrer/type_system.dart

Issue 2970863003: Remove reference of LocalFunctionElement in ParameterTypeInformation. (Closed)
Patch Set: Created 3 years, 5 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/compiler/lib/src/inferrer/type_graph_nodes.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/type_system.dart
diff --git a/pkg/compiler/lib/src/inferrer/type_system.dart b/pkg/compiler/lib/src/inferrer/type_system.dart
index 7ac9105444f5512d3777008633ce8d85c79a2bba..f9c7bae0384d132dd00b8ea488e1844d4b2102d3 100644
--- a/pkg/compiler/lib/src/inferrer/type_system.dart
+++ b/pkg/compiler/lib/src/inferrer/type_system.dart
@@ -5,8 +5,7 @@
import '../common.dart';
import '../elements/elements.dart';
import '../elements/entities.dart';
-import '../elements/resolution_types.dart'
- show ResolutionDartType, ResolutionInterfaceType;
+import '../elements/types.dart';
import '../tree/nodes.dart' as ast;
import '../types/masks.dart';
import '../universe/selector.dart';
@@ -291,26 +290,27 @@ class TypeSystem {
* [isNullable] indicates whether the annotation implies a null
* type.
*/
- TypeInformation narrowType(
- TypeInformation type, ResolutionDartType annotation,
+ TypeInformation narrowType(TypeInformation type, DartType annotation,
{bool isNullable: true}) {
if (annotation.treatAsDynamic) return type;
if (annotation.isVoid) return type;
- if (annotation.element == closedWorld.commonElements.objectClass &&
- isNullable) {
- return type;
- }
TypeMask otherType;
- if (annotation.isTypedef || annotation.isFunctionType) {
+ if (annotation.isInterfaceType) {
+ InterfaceType interface = annotation;
+ if (interface.element == closedWorld.commonElements.objectClass) {
+ if (isNullable) {
+ return type;
+ }
+ otherType = dynamicType.type.nonNullable();
+ } else {
+ otherType = new TypeMask.nonNullSubtype(interface.element, closedWorld);
+ }
+ } else if (annotation.isTypedef || annotation.isFunctionType) {
otherType = functionType.type;
- } else if (annotation.isTypeVariable) {
+ } else {
+ assert(annotation.isTypeVariable);
// TODO(ngeoffray): Narrow to bound.
return type;
- } else {
- ResolutionInterfaceType interface = annotation;
- otherType = annotation.element == closedWorld.commonElements.objectClass
- ? dynamicType.type.nonNullable()
- : new TypeMask.nonNullSubtype(interface.element, closedWorld);
}
if (isNullable) otherType = otherType.nullable();
if (type.type.isExact) {
@@ -345,10 +345,7 @@ class TypeSystem {
LocalFunctionElement localFunction = parameter.functionDeclaration;
MethodElement callMethod = localFunction.callMethod;
return new ParameterTypeInformation.localFunction(
- getInferredTypeOfMember(callMethod),
- parameter,
- localFunction,
- callMethod);
+ getInferredTypeOfMember(callMethod), parameter, callMethod);
} else if (parameter.functionDeclaration.isInstanceMember) {
MethodElement method = parameter.functionDeclaration;
return new ParameterTypeInformation.instanceMember(
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698