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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.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 | « no previous file | pkg/analyzer/lib/src/summary/link.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 analyzer.src.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 * `null`. 448 * `null`.
449 */ 449 */
450 List<ConstructorElement> _constructors; 450 List<ConstructorElement> _constructors;
451 451
452 /** 452 /**
453 * A list containing all of the methods contained in this class. 453 * A list containing all of the methods contained in this class.
454 */ 454 */
455 List<MethodElement> _methods; 455 List<MethodElement> _methods;
456 456
457 /** 457 /**
458 * A flag indicating whether the types associated with the instance methods of
459 * this class have been inferred.
460 */
461 bool _hasInferredInstanceMethods = false;
462
463 /**
458 * A flag indicating whether the types associated with the instance members of 464 * A flag indicating whether the types associated with the instance members of
459 * this class have been inferred. 465 * this class have been inferred.
460 */ 466 */
461 bool _hasBeenInferred = false; 467 bool _hasBeenInferred = false;
462 468
463 /** 469 /**
464 * The version of this element. The version is changed when the element is 470 * The version of this element. The version is changed when the element is
465 * incrementally updated, so that its lists of constructors, accessors and 471 * incrementally updated, so that its lists of constructors, accessors and
466 * methods might be different. 472 * methods might be different.
467 */ 473 */
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 return context.analysisOptions.strongMode; 650 return context.analysisOptions.strongMode;
645 } 651 }
646 return _hasBeenInferred; 652 return _hasBeenInferred;
647 } 653 }
648 654
649 void set hasBeenInferred(bool hasBeenInferred) { 655 void set hasBeenInferred(bool hasBeenInferred) {
650 _assertNotResynthesized(_unlinkedClass); 656 _assertNotResynthesized(_unlinkedClass);
651 _hasBeenInferred = hasBeenInferred; 657 _hasBeenInferred = hasBeenInferred;
652 } 658 }
653 659
660 bool get hasInferredInstanceMethods {
661 if (_unlinkedClass != null) {
662 return context.analysisOptions.strongMode;
663 }
664 return _hasInferredInstanceMethods;
665 }
666
667 void set hasInferredInstanceMethods(bool done) {
668 _assertNotResynthesized(_unlinkedClass);
669 _hasInferredInstanceMethods = done;
670 }
671
654 @override 672 @override
655 bool get hasNonFinalField { 673 bool get hasNonFinalField {
656 List<ClassElement> classesToVisit = new List<ClassElement>(); 674 List<ClassElement> classesToVisit = new List<ClassElement>();
657 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); 675 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
658 classesToVisit.add(this); 676 classesToVisit.add(this);
659 while (!classesToVisit.isEmpty) { 677 while (!classesToVisit.isEmpty) {
660 ClassElement currentElement = classesToVisit.removeAt(0); 678 ClassElement currentElement = classesToVisit.removeAt(0);
661 if (visitedClasses.add(currentElement)) { 679 if (visitedClasses.add(currentElement)) {
662 // check fields 680 // check fields
663 for (FieldElement field in currentElement.fields) { 681 for (FieldElement field in currentElement.fields) {
(...skipping 8216 matching lines...) Expand 10 before | Expand all | Expand 10 after
8880 8898
8881 @override 8899 @override
8882 void visitElement(Element element) { 8900 void visitElement(Element element) {
8883 int offset = element.nameOffset; 8901 int offset = element.nameOffset;
8884 if (offset != -1) { 8902 if (offset != -1) {
8885 map[offset] = element; 8903 map[offset] = element;
8886 } 8904 }
8887 super.visitElement(element); 8905 super.visitElement(element);
8888 } 8906 }
8889 } 8907 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/link.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698