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

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

Issue 781683004: Replace hints. Resolve TODO. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_resolver_test.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 engine.incremental_resolver; 5 library engine.incremental_resolver;
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 'ast.dart'; 10 import 'ast.dart';
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 /** 722 /**
723 * Return `true` if the portion of the element model defined by the given node 723 * Return `true` if the portion of the element model defined by the given node
724 * has changed. 724 * has changed.
725 * 725 *
726 * [node] - the node defining the portion of the element model being tested. 726 * [node] - the node defining the portion of the element model being tested.
727 * 727 *
728 * Throws [AnalysisException] if the correctness of the element model cannot 728 * Throws [AnalysisException] if the correctness of the element model cannot
729 * be determined. 729 * be determined.
730 */ 730 */
731 bool _elementModelChanged(AstNode node) { 731 bool _elementModelChanged(AstNode node) {
732 // If we are replacing the whole declaration (e.g. rename a parameter), we 732 // If we are replacing the whole declaration, this means that its signature
733 // can try to find the corresponding Element in the enclosing one, see if it 733 // is changed. It might be an API change, or not.
734 // is compatible, and if 'yes', then restore and update it. 734 //
735 // TODO(scheglov) This should be rewritten. It causes validating the whole 735 // If a required parameter is change, it is not an API change, but we want
Brian Wilkerson 2014/12/04 14:45:22 "change" --> "changed"
736 // class, when just one method is changed. 736 // to find the existing corresponding Element in the enclosing one,
737 // set it for the node and update as needed.
738 //
739 // If, for example, the name of a method is changed, it is an API change,
740 // we need to know the old Element and the new Element. Again, we need to
741 // check the whole enclosing Element.
737 if (node is Declaration) { 742 if (node is Declaration) {
738 node = node.parent; 743 node = node.parent;
739 } 744 }
740 Element element = _getElement(node); 745 Element element = _getElement(node);
741 if (element == null) { 746 if (element == null) {
742 throw new AnalysisException( 747 throw new AnalysisException(
743 "Cannot resolve node: a ${node.runtimeType} does not define an element "); 748 "Cannot resolve node: a ${node.runtimeType} does not define an element ");
744 } 749 }
745 DeclarationMatcher matcher = new DeclarationMatcher(); 750 DeclarationMatcher matcher = new DeclarationMatcher();
746 return !matcher.matches(node, element); 751 return !matcher.matches(node, element);
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 } 1182 }
1178 { 1183 {
1179 List<AnalysisError> oldErrors = 1184 List<AnalysisError> oldErrors =
1180 _entry.getValueInLibrary(DartEntry.VERIFICATION_ERRORS, _librarySource ); 1185 _entry.getValueInLibrary(DartEntry.VERIFICATION_ERRORS, _librarySource );
1181 List<AnalysisError> errors = _updateErrors(oldErrors, _newVerifyErrors); 1186 List<AnalysisError> errors = _updateErrors(oldErrors, _newVerifyErrors);
1182 _entry.setValueInLibrary( 1187 _entry.setValueInLibrary(
1183 DartEntry.VERIFICATION_ERRORS, 1188 DartEntry.VERIFICATION_ERRORS,
1184 _librarySource, 1189 _librarySource,
1185 errors); 1190 errors);
1186 } 1191 }
1187 { 1192 _entry.setValueInLibrary(DartEntry.HINTS, _librarySource, _newHints);
1188 List<AnalysisError> oldErrors =
1189 _entry.getValueInLibrary(DartEntry.HINTS, _librarySource);
1190 List<AnalysisError> errors = _updateErrors(oldErrors, _newHints);
1191 _entry.setValueInLibrary(DartEntry.HINTS, _librarySource, errors);
1192 }
1193 } 1193 }
1194 1194
1195 List<AnalysisError> _updateErrors(List<AnalysisError> oldErrors, 1195 List<AnalysisError> _updateErrors(List<AnalysisError> oldErrors,
1196 List<AnalysisError> newErrors) { 1196 List<AnalysisError> newErrors) {
1197 List<AnalysisError> errors = new List<AnalysisError>(); 1197 List<AnalysisError> errors = new List<AnalysisError>();
1198 // add updated old errors 1198 // add updated old errors
1199 for (AnalysisError error in oldErrors) { 1199 for (AnalysisError error in oldErrors) {
1200 int errorOffset = error.offset; 1200 int errorOffset = error.offset;
1201 if (errorOffset < _updateOffset) { 1201 if (errorOffset < _updateOffset) {
1202 errors.add(error); 1202 errors.add(error);
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 String toString() => name; 1656 String toString() => name;
1657 } 1657 }
1658 1658
1659 1659
1660 class _TokenPair { 1660 class _TokenPair {
1661 final _TokenDifferenceKind kind; 1661 final _TokenDifferenceKind kind;
1662 final Token oldToken; 1662 final Token oldToken;
1663 final Token newToken; 1663 final Token newToken;
1664 _TokenPair(this.kind, this.oldToken, this.newToken); 1664 _TokenPair(this.kind, this.oldToken, this.newToken);
1665 } 1665 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698