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

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

Issue 1302333005: Shift AnalysisError instances only once during incremental resolution. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | no next file » | 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/context/cache.dart' 10 import 'package:analyzer/src/context/cache.dart'
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 */ 889 */
890 final int _updateEndOld; 890 final int _updateEndOld;
891 891
892 /** 892 /**
893 * The end of the changed contents in the new unit. 893 * The end of the changed contents in the new unit.
894 */ 894 */
895 final int _updateEndNew; 895 final int _updateEndNew;
896 896
897 int _updateDelta; 897 int _updateDelta;
898 898
899 /**
900 * The set of [AnalysisError]s that have been already shifted.
901 */
902 Set<AnalysisError> _alreadyShiftedErrors = new HashSet.identity();
903
899 RecordingErrorListener errorListener = new RecordingErrorListener(); 904 RecordingErrorListener errorListener = new RecordingErrorListener();
900 ResolutionContext _resolutionContext; 905 ResolutionContext _resolutionContext;
901 906
902 List<AnalysisError> _resolveErrors = AnalysisError.NO_ERRORS; 907 List<AnalysisError> _resolveErrors = AnalysisError.NO_ERRORS;
903 List<AnalysisError> _verifyErrors = AnalysisError.NO_ERRORS; 908 List<AnalysisError> _verifyErrors = AnalysisError.NO_ERRORS;
904 909
905 /** 910 /**
906 * Initialize a newly created incremental resolver to resolve a node in the 911 * Initialize a newly created incremental resolver to resolve a node in the
907 * given source in the given library. 912 * given source in the given library.
908 */ 913 */
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 1144
1140 void _shiftEntryErrors_OLD() { 1145 void _shiftEntryErrors_OLD() {
1141 _shiftErrors_OLD(DartEntry.RESOLUTION_ERRORS); 1146 _shiftErrors_OLD(DartEntry.RESOLUTION_ERRORS);
1142 _shiftErrors_OLD(DartEntry.VERIFICATION_ERRORS); 1147 _shiftErrors_OLD(DartEntry.VERIFICATION_ERRORS);
1143 _shiftErrors_OLD(DartEntry.HINTS); 1148 _shiftErrors_OLD(DartEntry.HINTS);
1144 _shiftErrors_OLD(DartEntry.LINTS); 1149 _shiftErrors_OLD(DartEntry.LINTS);
1145 } 1150 }
1146 1151
1147 void _shiftErrors(List<AnalysisError> errors) { 1152 void _shiftErrors(List<AnalysisError> errors) {
1148 for (AnalysisError error in errors) { 1153 for (AnalysisError error in errors) {
1149 int errorOffset = error.offset; 1154 if (_alreadyShiftedErrors.add(error)) {
1150 if (errorOffset > _updateOffset) { 1155 int errorOffset = error.offset;
1151 error.offset += _updateDelta; 1156 if (errorOffset > _updateOffset) {
1157 error.offset += _updateDelta;
1158 }
1152 } 1159 }
1153 } 1160 }
1154 } 1161 }
1155 1162
1156 void _shiftErrors_NEW(ResultDescriptor<List<AnalysisError>> descriptor) { 1163 void _shiftErrors_NEW(ResultDescriptor<List<AnalysisError>> descriptor) {
1157 List<AnalysisError> errors = newUnitEntry.getValue(descriptor); 1164 List<AnalysisError> errors = newUnitEntry.getValue(descriptor);
1158 _shiftErrors(errors); 1165 _shiftErrors(errors);
1159 } 1166 }
1160 1167
1161 void _shiftErrors_OLD(DataDescriptor<List<AnalysisError>> descriptor) { 1168 void _shiftErrors_OLD(DataDescriptor<List<AnalysisError>> descriptor) {
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 @override 2031 @override
2025 String toString() => name; 2032 String toString() => name;
2026 } 2033 }
2027 2034
2028 class _TokenPair { 2035 class _TokenPair {
2029 final _TokenDifferenceKind kind; 2036 final _TokenDifferenceKind kind;
2030 final Token oldToken; 2037 final Token oldToken;
2031 final Token newToken; 2038 final Token newToken;
2032 _TokenPair(this.kind, this.oldToken, this.newToken); 2039 _TokenPair(this.kind, this.oldToken, this.newToken);
2033 } 2040 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698