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

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

Issue 2590883004: Put a TypeProvider on the TypeSystem implementations. (Closed)
Patch Set: Rebase Created 3 years, 11 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
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 analyzer.src.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 6148 matching lines...) Expand 10 before | Expand all | Expand 10 after
6159 return _typeProvider.futureType.instantiate( 6159 return _typeProvider.futureType.instantiate(
6160 <DartType>[staticReturnType.flattenFutures(_typeSystem)]); 6160 <DartType>[staticReturnType.flattenFutures(_typeSystem)]);
6161 } 6161 }
6162 return staticReturnType; 6162 return staticReturnType;
6163 } 6163 }
6164 6164
6165 bool _expressionIsAssignableAtType(Expression expression, 6165 bool _expressionIsAssignableAtType(Expression expression,
6166 DartType actualStaticType, DartType expectedStaticType) { 6166 DartType actualStaticType, DartType expectedStaticType) {
6167 bool concrete = _options.strongMode && checker.isKnownFunction(expression); 6167 bool concrete = _options.strongMode && checker.isKnownFunction(expression);
6168 if (concrete && actualStaticType is FunctionType) { 6168 if (concrete && actualStaticType is FunctionType) {
6169 actualStaticType = _typeSystem.functionTypeToConcreteType( 6169 actualStaticType =
6170 _typeProvider, actualStaticType); 6170 _typeSystem.functionTypeToConcreteType(actualStaticType);
6171 // TODO(leafp): Move the Downcast functionality here. 6171 // TODO(leafp): Move the Downcast functionality here.
6172 } 6172 }
6173 return _typeSystem.isAssignableTo(actualStaticType, expectedStaticType); 6173 return _typeSystem.isAssignableTo(actualStaticType, expectedStaticType);
6174 } 6174 }
6175 6175
6176 MethodElement _findOverriddenMemberThatMustCallSuper(MethodDeclaration node) { 6176 MethodElement _findOverriddenMemberThatMustCallSuper(MethodDeclaration node) {
6177 ExecutableElement overriddenMember = _getOverriddenMember(node.element); 6177 ExecutableElement overriddenMember = _getOverriddenMember(node.element);
6178 List<ExecutableElement> seen = <ExecutableElement>[]; 6178 List<ExecutableElement> seen = <ExecutableElement>[];
6179 while ( 6179 while (
6180 overriddenMember is MethodElement && !seen.contains(overriddenMember)) { 6180 overriddenMember is MethodElement && !seen.contains(overriddenMember)) {
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
6619 if ((elt is MethodElement && !elt.isAbstract) || 6619 if ((elt is MethodElement && !elt.isAbstract) ||
6620 (elt is PropertyAccessorElement && !elt.isAbstract)) { 6620 (elt is PropertyAccessorElement && !elt.isAbstract)) {
6621 // Since we are comparing two function types, we need to do the 6621 // Since we are comparing two function types, we need to do the
6622 // appropriate type substitutions first (). 6622 // appropriate type substitutions first ().
6623 FunctionType foundConcreteFT = 6623 FunctionType foundConcreteFT =
6624 inheritanceManager.substituteTypeArgumentsInMemberFromInheritance( 6624 inheritanceManager.substituteTypeArgumentsInMemberFromInheritance(
6625 concreteType, memberName, enclosingType); 6625 concreteType, memberName, enclosingType);
6626 FunctionType requiredMemberFT = 6626 FunctionType requiredMemberFT =
6627 inheritanceManager.substituteTypeArgumentsInMemberFromInheritance( 6627 inheritanceManager.substituteTypeArgumentsInMemberFromInheritance(
6628 requiredMemberType, memberName, enclosingType); 6628 requiredMemberType, memberName, enclosingType);
6629 foundConcreteFT = typeSystem.functionTypeToConcreteType( 6629 foundConcreteFT =
6630 typeProvider, foundConcreteFT); 6630 typeSystem.functionTypeToConcreteType(foundConcreteFT);
6631 requiredMemberFT = typeSystem.functionTypeToConcreteType( 6631 requiredMemberFT =
6632 typeProvider, requiredMemberFT); 6632 typeSystem.functionTypeToConcreteType(requiredMemberFT);
6633 6633
6634 // Strong mode does override checking for types in CodeChecker, so 6634 // Strong mode does override checking for types in CodeChecker, so
6635 // we can skip it here. Doing it here leads to unnecessary duplicate 6635 // we can skip it here. Doing it here leads to unnecessary duplicate
6636 // error messages in subclasses that inherit from one that has an 6636 // error messages in subclasses that inherit from one that has an
6637 // override error. 6637 // override error.
6638 // 6638 //
6639 // See: https://github.com/dart-lang/sdk/issues/25232 6639 // See: https://github.com/dart-lang/sdk/issues/25232
6640 if (strongMode || 6640 if (strongMode ||
6641 typeSystem.isSubtypeOf(foundConcreteFT, requiredMemberFT)) { 6641 typeSystem.isSubtypeOf(foundConcreteFT, requiredMemberFT)) {
6642 continue; 6642 continue;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
6993 class _InvocationCollector extends RecursiveAstVisitor { 6993 class _InvocationCollector extends RecursiveAstVisitor {
6994 final List<String> superCalls = <String>[]; 6994 final List<String> superCalls = <String>[];
6995 6995
6996 @override 6996 @override
6997 visitMethodInvocation(MethodInvocation node) { 6997 visitMethodInvocation(MethodInvocation node) {
6998 if (node.target is SuperExpression) { 6998 if (node.target is SuperExpression) {
6999 superCalls.add(node.methodName.name); 6999 superCalls.add(node.methodName.name);
7000 } 7000 }
7001 } 7001 }
7002 } 7002 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698