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

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

Issue 2156873002: Invalidate resolution if a unit instantiate a class with the unnamed constructor change. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/task/incremental_element_builder.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) 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.dart; 5 library analyzer.src.task.dart;
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/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 2588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 } 2599 }
2600 2600
2601 bool hasAffectedReferences(ReferencedNames references, Source refLibrary) { 2601 bool hasAffectedReferences(ReferencedNames references, Source refLibrary) {
2602 // Resolution must be performed when a referenced element changes. 2602 // Resolution must be performed when a referenced element changes.
2603 for (String name in references.names) { 2603 for (String name in references.names) {
2604 if (isChangedOrClassMember(refLibrary, name)) { 2604 if (isChangedOrClassMember(refLibrary, name)) {
2605 _log(() => '$refLibrary is affected by $name'); 2605 _log(() => '$refLibrary is affected by $name');
2606 return true; 2606 return true;
2607 } 2607 }
2608 } 2608 }
2609 // Resolution must be performed when the unnamed constructor of
2610 // an instantiated class is added/changed/removed.
2611 // TODO(scheglov) Use only instantiations with default constructor.
2612 for (String name in references.instantiatedNames) {
2613 for (ClassElementDelta classDelta in changedClasses.values) {
2614 if (classDelta.name == name && classDelta.hasUnnamedConstructorChange) {
2615 _log(() =>
2616 '$refLibrary is affected by the default constructor of $name');
2617 return true;
2618 }
2619 }
2620 }
2609 return false; 2621 return false;
2610 } 2622 }
2611 2623
2612 /** 2624 /**
2613 * Return `true` if the given [name], used in a unit of the [librarySource], 2625 * Return `true` if the given [name], used in a unit of the [librarySource],
2614 * is affected by a changed top-level element, excluding classes. 2626 * is affected by a changed top-level element, excluding classes.
2615 */ 2627 */
2616 bool isChanged(Source librarySource, String name) { 2628 bool isChanged(Source librarySource, String name) {
2617 if (_isPrivateName(name)) { 2629 if (_isPrivateName(name)) {
2618 if (changedPrivateNames[librarySource]?.contains(name) ?? false) { 2630 if (changedPrivateNames[librarySource]?.contains(name) ?? false) {
(...skipping 3852 matching lines...) Expand 10 before | Expand all | Expand 10 after
6471 6483
6472 @override 6484 @override
6473 bool moveNext() { 6485 bool moveNext() {
6474 if (_newSources.isEmpty) { 6486 if (_newSources.isEmpty) {
6475 return false; 6487 return false;
6476 } 6488 }
6477 currentTarget = _newSources.removeLast(); 6489 currentTarget = _newSources.removeLast();
6478 return true; 6490 return true;
6479 } 6491 }
6480 } 6492 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/incremental_element_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698