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

Side by Side Diff: pkg/analyzer/lib/src/task/strong_mode.dart

Issue 2028253002: Infer only ClassElementImpl in InstanceMemberInferrer, tweaks for link. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | 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) 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.task.strong_mode; 5 library analyzer.src.task.strong_mode;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 /** 67 /**
68 * The inheritance manager used to find overridden method. 68 * The inheritance manager used to find overridden method.
69 */ 69 */
70 final InheritanceManager inheritanceManager; 70 final InheritanceManager inheritanceManager;
71 71
72 /** 72 /**
73 * The classes that have been visited while attempting to infer the types of 73 * The classes that have been visited while attempting to infer the types of
74 * instance members of some base class. 74 * instance members of some base class.
75 */ 75 */
76 HashSet<AbstractClassElementImpl> elementsBeingInferred = 76 HashSet<ClassElementImpl> elementsBeingInferred =
77 new HashSet<AbstractClassElementImpl>(); 77 new HashSet<ClassElementImpl>();
78 78
79 /** 79 /**
80 * Initialize a newly create inferrer. 80 * Initialize a newly create inferrer.
81 */ 81 */
82 InstanceMemberInferrer(this.typeProvider, this.inheritanceManager, 82 InstanceMemberInferrer(this.typeProvider, this.inheritanceManager,
83 {TypeSystem typeSystem}) 83 {TypeSystem typeSystem})
84 : typeSystem = (typeSystem != null) ? typeSystem : new TypeSystemImpl(); 84 : typeSystem = (typeSystem != null) ? typeSystem : new TypeSystemImpl();
85 85
86 /** 86 /**
87 * Infer type information for all of the instance members in the given 87 * Infer type information for all of the instance members in the given
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return matchingParameter == null 195 return matchingParameter == null
196 ? typeProvider.dynamicType 196 ? typeProvider.dynamicType
197 : matchingParameter.type; 197 : matchingParameter.type;
198 } 198 }
199 199
200 /** 200 /**
201 * Infer type information for all of the instance members in the given 201 * Infer type information for all of the instance members in the given
202 * [classElement]. 202 * [classElement].
203 */ 203 */
204 void _inferClass(ClassElement classElement) { 204 void _inferClass(ClassElement classElement) {
205 if (classElement is AbstractClassElementImpl) { 205 if (classElement is ClassElementImpl) {
206 if (classElement.hasBeenInferred) { 206 if (classElement.hasBeenInferred) {
207 return; 207 return;
208 } 208 }
209 if (!elementsBeingInferred.add(classElement)) { 209 if (!elementsBeingInferred.add(classElement)) {
210 // We have found a circularity in the class hierarchy. For now we just 210 // We have found a circularity in the class hierarchy. For now we just
211 // stop trying to infer any type information for any classes that 211 // stop trying to infer any type information for any classes that
212 // inherit from any class in the cycle. We could potentially limit the 212 // inherit from any class in the cycle. We could potentially limit the
213 // algorithm to only not inferring types in the classes in the cycle, 213 // algorithm to only not inferring types in the classes in the cycle,
214 // but it isn't clear that the results would be significantly better. 214 // but it isn't clear that the results would be significantly better.
215 throw new _CycleException(); 215 throw new _CycleException();
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 results.add(element); 471 results.add(element);
472 } 472 }
473 } 473 }
474 } 474 }
475 } 475 }
476 476
477 /** 477 /**
478 * A class of exception that is not used anywhere else. 478 * A class of exception that is not used anywhere else.
479 */ 479 */
480 class _CycleException implements Exception {} 480 class _CycleException implements Exception {}
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698