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

Unified Diff: pkg/compiler/lib/src/typechecker.dart

Issue 1338683002: Add related types check to analyze_dart2js_test (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 3 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/tree_ir/tree_ir_integrity.dart ('k') | pkg/compiler/lib/src/use_unused_api.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/typechecker.dart
diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart
index 74b9659d39e1bf3c60dc4a426305e3ca51a394d2..2f22dae370ae5e3faab6d8083b94ef6fbd6bee7b 100644
--- a/pkg/compiler/lib/src/typechecker.dart
+++ b/pkg/compiler/lib/src/typechecker.dart
@@ -741,35 +741,6 @@ class TypeCheckerVisitor extends Visitor<DartType> {
Name memberName = new Name(name, currentLibrary,
isSetter: memberKind == MemberKind.SETTER);
- // Compute the unaliased type of the first non type variable bound of
- // [type].
- DartType computeUnaliasedBound(DartType type) {
- DartType originalType = type;
- while (identical(type.kind, TypeKind.TYPE_VARIABLE)) {
- TypeVariableType variable = type;
- type = variable.element.bound;
- if (type == originalType) {
- type = compiler.objectClass.rawType;
- }
- }
- if (type.isMalformed) {
- return const DynamicType();
- }
- return type.unalias(compiler);
- }
-
- // Compute the interface type of [type]. For type variable it is the
- // interface type of the bound, for function types and typedefs it is the
- // `Function` type.
- InterfaceType computeInterfaceType(DartType type) {
- if (type.isFunctionType) {
- type = compiler.functionClass.rawType;
- }
- assert(invariant(node, type.isInterfaceType,
- message: "unexpected type kind ${type.kind}."));
- return type;
- }
-
// Lookup the class or interface member [name] in [interface].
MemberSignature lookupMemberSignature(Name name, InterfaceType interface) {
MembersCreator.computeClassMembersByName(
@@ -802,11 +773,13 @@ class TypeCheckerVisitor extends Visitor<DartType> {
return null;
}
- DartType unaliasedBound = computeUnaliasedBound(receiverType);
+ DartType unaliasedBound =
+ Types.computeUnaliasedBound(compiler, receiverType);
if (unaliasedBound.treatAsDynamic) {
return new DynamicAccess();
}
- InterfaceType interface = computeInterfaceType(unaliasedBound);
+ InterfaceType interface =
+ Types.computeInterfaceType(compiler, unaliasedBound);
ElementAccess access = getAccess(memberName, unaliasedBound, interface);
if (access != null) {
return access;
@@ -818,9 +791,11 @@ class TypeCheckerVisitor extends Visitor<DartType> {
while (!typePromotions.isEmpty) {
TypePromotion typePromotion = typePromotions.head;
if (!typePromotion.isValid) {
- DartType unaliasedBound = computeUnaliasedBound(typePromotion.type);
+ DartType unaliasedBound =
+ Types.computeUnaliasedBound(compiler, typePromotion.type);
if (!unaliasedBound.treatAsDynamic) {
- InterfaceType interface = computeInterfaceType(unaliasedBound);
+ InterfaceType interface =
+ Types.computeInterfaceType(compiler, unaliasedBound);
if (getAccess(memberName, unaliasedBound, interface) != null) {
reportTypePromotionHint(typePromotion);
}
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart ('k') | pkg/compiler/lib/src/use_unused_api.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698