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

Side by Side Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 2741033004: Infer types of instance methods before any other inference. (Closed)
Patch Set: Created 3 years, 9 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/dart/element/element.dart ('k') | pkg/analyzer/lib/src/task/dart.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /** 5 /**
6 * This library is capable of producing linked summaries from unlinked 6 * This library is capable of producing linked summaries from unlinked
7 * ones (or prelinked ones). It functions by building a miniature 7 * ones (or prelinked ones). It functions by building a miniature
8 * element model to represent the contents of the summaries, and then 8 * element model to represent the contents of the summaries, and then
9 * scanning the element model to gather linked information and adding 9 * scanning the element model to gather linked information and adding
10 * it to the summary data structures. 10 * it to the summary data structures.
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 with ReferenceableElementForLink 347 with ReferenceableElementForLink
348 implements AbstractClassElementImpl { 348 implements AbstractClassElementImpl {
349 Map<String, ReferenceableElementForLink> _containedNames; 349 Map<String, ReferenceableElementForLink> _containedNames;
350 350
351 @override 351 @override
352 final CompilationUnitElementForLink enclosingElement; 352 final CompilationUnitElementForLink enclosingElement;
353 353
354 /// TODO(brianwilkerson) This appears to be unused and might be removable. 354 /// TODO(brianwilkerson) This appears to be unused and might be removable.
355 bool hasBeenInferred; 355 bool hasBeenInferred;
356 356
357 bool hasInferredInstanceMethods = false;
358
357 ClassElementForLink(CompilationUnitElementForLink enclosingElement) 359 ClassElementForLink(CompilationUnitElementForLink enclosingElement)
358 : enclosingElement = enclosingElement, 360 : enclosingElement = enclosingElement,
359 hasBeenInferred = !enclosingElement.isInBuildUnit; 361 hasBeenInferred = !enclosingElement.isInBuildUnit;
360 362
361 @override 363 @override
362 List<PropertyAccessorElementForLink> get accessors; 364 List<PropertyAccessorElementForLink> get accessors;
363 365
364 @override 366 @override
365 ClassElementForLink get asClass => this; 367 ClassElementForLink get asClass => this;
366 368
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 throw new StateError( 1282 throw new StateError(
1281 'Linker tried to access linked type from current build unit'); 1283 'Linker tried to access linked type from current build unit');
1282 } 1284 }
1283 1285
1284 /** 1286 /**
1285 * Perform type inference and const cycle detection on this 1287 * Perform type inference and const cycle detection on this
1286 * compilation unit. 1288 * compilation unit.
1287 */ 1289 */
1288 void link() { 1290 void link() {
1289 if (library._linker.strongMode) { 1291 if (library._linker.strongMode) {
1290 new InstanceMemberInferrer(enclosingElement._linker.typeProvider, 1292 var inferrer = new InstanceMemberInferrer(
1291 enclosingElement.inheritanceManager) 1293 enclosingElement._linker.typeProvider,
1292 .inferCompilationUnit(this); 1294 enclosingElement.inheritanceManager);
1295 inferrer.inferInstanceMethods(this);
1296 inferrer.inferCompilationUnit(this);
1293 for (TopLevelVariableElementForLink variable in topLevelVariables) { 1297 for (TopLevelVariableElementForLink variable in topLevelVariables) {
1294 variable.link(this); 1298 variable.link(this);
1295 } 1299 }
1296 } 1300 }
1297 for (ClassElementForLink classElement in types) { 1301 for (ClassElementForLink classElement in types) {
1298 classElement.link(this); 1302 classElement.link(this);
1299 } 1303 }
1300 } 1304 }
1301 1305
1302 /** 1306 /**
(...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after
5138 * there are no type parameters in scope. 5142 * there are no type parameters in scope.
5139 */ 5143 */
5140 TypeParameterizedElementMixin get _typeParameterContext; 5144 TypeParameterizedElementMixin get _typeParameterContext;
5141 5145
5142 @override 5146 @override
5143 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 5147 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
5144 5148
5145 @override 5149 @override
5146 String toString() => '$enclosingElement.$name'; 5150 String toString() => '$enclosingElement.$name';
5147 } 5151 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698