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

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1380963004: fixes strong mode assignability (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/type_system_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library engine.resolver; 5 library engine.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'ast.dart'; 9 import 'ast.dart';
10 import 'constant.dart'; 10 import 'constant.dart';
(...skipping 15083 matching lines...) Expand 10 before | Expand all | Expand 10 after
15094 15094
15095 @override 15095 @override
15096 DartType getLeastUpperBound( 15096 DartType getLeastUpperBound(
15097 TypeProvider typeProvider, DartType type1, DartType type2) { 15097 TypeProvider typeProvider, DartType type1, DartType type2) {
15098 // TODO(leafp): Implement a strong mode version of this. 15098 // TODO(leafp): Implement a strong mode version of this.
15099 return _specTypeSystem.getLeastUpperBound(typeProvider, type1, type2); 15099 return _specTypeSystem.getLeastUpperBound(typeProvider, type1, type2);
15100 } 15100 }
15101 15101
15102 // TODO(leafp): Document the rules in play here 15102 // TODO(leafp): Document the rules in play here
15103 @override 15103 @override
15104 bool isAssignableTo(DartType toType, DartType fromType) { 15104 bool isAssignableTo(DartType fromType, DartType toType) {
Jennifer Messerly 2015/10/01 22:24:15 think of it as "fromType isAssignableTo toType"
15105 // An actual subtype 15105 // An actual subtype
15106 if (isSubtypeOf(fromType, toType)) { 15106 if (isSubtypeOf(fromType, toType)) {
15107 return true; 15107 return true;
15108 } 15108 }
15109 15109
15110 // Don't allow implicit downcasts between function types 15110 // Don't allow implicit downcasts between function types
15111 // and call method objects, as these will almost always fail. 15111 // and call method objects, as these will almost always fail.
15112 if ((fromType is FunctionType && _getCallMethodType(toType) != null) || 15112 if ((fromType is FunctionType && _getCallMethodType(toType) != null) ||
15113 (toType is FunctionType && _getCallMethodType(fromType) != null)) { 15113 (toType is FunctionType && _getCallMethodType(fromType) != null)) {
15114 return false; 15114 return false;
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
15949 nonFields.add(node); 15949 nonFields.add(node);
15950 return null; 15950 return null;
15951 } 15951 }
15952 15952
15953 @override 15953 @override
15954 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 15954 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
15955 15955
15956 @override 15956 @override
15957 Object visitWithClause(WithClause node) => null; 15957 Object visitWithClause(WithClause node) => null;
15958 } 15958 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/type_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698