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

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

Issue 1078953002: Issue 23155. Don't perform incremental resolution if a constructor initializer is changed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | 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 'package:analyzer/src/generated/constant.dart'; 10 import 'package:analyzer/src/generated/constant.dart';
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 incrementalResolver._shiftEntryErrors(); 1236 incrementalResolver._shiftEntryErrors();
1237 } 1237 }
1238 _updateEntry(); 1238 _updateEntry();
1239 logger.log('Success.'); 1239 logger.log('Success.');
1240 return true; 1240 return true;
1241 } 1241 }
1242 // fall-through, end-of-line comment 1242 // fall-through, end-of-line comment
1243 } 1243 }
1244 // Find nodes covering the "old" and "new" token ranges. 1244 // Find nodes covering the "old" and "new" token ranges.
1245 AstNode oldNode = 1245 AstNode oldNode =
1246 _findNodeCovering(_oldUnit, beginOffsetOld, endOffsetOld); 1246 _findNodeCovering(_oldUnit, beginOffsetOld, endOffsetOld - 1);
1247 AstNode newNode = 1247 AstNode newNode =
1248 _findNodeCovering(newUnit, beginOffsetNew, endOffsetNew); 1248 _findNodeCovering(newUnit, beginOffsetNew, endOffsetNew - 1);
1249 logger.log(() => 'oldNode: $oldNode'); 1249 logger.log(() => 'oldNode: $oldNode');
1250 logger.log(() => 'newNode: $newNode'); 1250 logger.log(() => 'newNode: $newNode');
1251 // Try to find the smallest common node, a FunctionBody currently. 1251 // Try to find the smallest common node, a FunctionBody currently.
1252 { 1252 {
1253 List<AstNode> oldParents = _getParents(oldNode); 1253 List<AstNode> oldParents = _getParents(oldNode);
1254 List<AstNode> newParents = _getParents(newNode); 1254 List<AstNode> newParents = _getParents(newNode);
1255 int length = math.min(oldParents.length, newParents.length); 1255 int length = math.min(oldParents.length, newParents.length);
1256 bool found = false; 1256 bool found = false;
1257 for (int i = 0; i < length; i++) { 1257 for (int i = 0; i < length; i++) {
1258 AstNode oldParent = oldParents[i]; 1258 AstNode oldParent = oldParents[i];
1259 AstNode newParent = newParents[i]; 1259 AstNode newParent = newParents[i];
1260 if (oldParent is ConstructorInitializer ||
1261 newParent is ConstructorInitializer) {
1262 logger.log('Failure: changes in constant constructor initializers'
1263 ' may cause external changes in constant objects.');
1264 return false;
1265 }
1260 if (oldParent is FunctionDeclaration && 1266 if (oldParent is FunctionDeclaration &&
1261 newParent is FunctionDeclaration || 1267 newParent is FunctionDeclaration ||
1262 oldParent is MethodDeclaration && 1268 oldParent is MethodDeclaration &&
1263 newParent is MethodDeclaration || 1269 newParent is MethodDeclaration ||
1264 oldParent is ConstructorDeclaration && 1270 oldParent is ConstructorDeclaration &&
1265 newParent is ConstructorDeclaration) { 1271 newParent is ConstructorDeclaration) {
1266 oldNode = oldParent; 1272 oldNode = oldParent;
1267 newNode = newParent; 1273 newNode = newParent;
1268 found = true; 1274 found = true;
1269 } 1275 }
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 @override 1843 @override
1838 String toString() => name; 1844 String toString() => name;
1839 } 1845 }
1840 1846
1841 class _TokenPair { 1847 class _TokenPair {
1842 final _TokenDifferenceKind kind; 1848 final _TokenDifferenceKind kind;
1843 final Token oldToken; 1849 final Token oldToken;
1844 final Token newToken; 1850 final Token newToken;
1845 _TokenPair(this.kind, this.oldToken, this.newToken); 1851 _TokenPair(this.kind, this.oldToken, this.newToken);
1846 } 1852 }
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