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

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

Issue 1847633002: Fix more strong mode errors in analyzer (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix copied comment Created 4 years, 8 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.type_system; 5 library analyzer.src.generated.type_system;
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/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 // TODO(jmesserly): this is very similar to code used for flattening futures. 866 // TODO(jmesserly): this is very similar to code used for flattening futures.
867 // The only difference is, because of a lack of TypeProvider, the other method 867 // The only difference is, because of a lack of TypeProvider, the other method
868 // has to match the Future type by its name and library. Here was are passed 868 // has to match the Future type by its name and library. Here was are passed
869 // in the correct type. 869 // in the correct type.
870 DartType mostSpecificTypeArgument(DartType type, DartType genericType) { 870 DartType mostSpecificTypeArgument(DartType type, DartType genericType) {
871 if (type is! InterfaceType) return null; 871 if (type is! InterfaceType) return null;
872 872
873 // Walk the superinterface hierarchy looking for [genericType]. 873 // Walk the superinterface hierarchy looking for [genericType].
874 List<DartType> candidates = <DartType>[]; 874 List<DartType> candidates = <DartType>[];
875 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); 875 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
876 void recurse(InterfaceTypeImpl interface) { 876 void recurse(InterfaceType interface) {
877 if (interface.element == genericType.element && 877 if (interface.element == genericType.element &&
878 interface.typeArguments.isNotEmpty) { 878 interface.typeArguments.isNotEmpty) {
879 candidates.add(interface.typeArguments[0]); 879 candidates.add(interface.typeArguments[0]);
880 } 880 }
881 if (visitedClasses.add(interface.element)) { 881 if (visitedClasses.add(interface.element)) {
882 if (interface.superclass != null) { 882 if (interface.superclass != null) {
883 recurse(interface.superclass); 883 recurse(interface.superclass);
884 } 884 }
885 interface.mixins.forEach(recurse); 885 interface.mixins.forEach(recurse);
886 interface.interfaces.forEach(recurse); 886 interface.interfaces.forEach(recurse);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 } else { 1297 } else {
1298 passedOut = true; 1298 passedOut = true;
1299 } 1299 }
1300 } else if (type is FunctionType) { 1300 } else if (type is FunctionType) {
1301 _visitFunctionType(typeParam, type, paramIn); 1301 _visitFunctionType(typeParam, type, paramIn);
1302 } else if (type is InterfaceType) { 1302 } else if (type is InterfaceType) {
1303 _visitInterfaceType(typeParam, type, paramIn); 1303 _visitInterfaceType(typeParam, type, paramIn);
1304 } 1304 }
1305 } 1305 }
1306 } 1306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698