OLD | NEW |
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' |
11 show CacheEntry, TargetedResult; | 11 show CacheEntry, TargetedResult; |
12 import 'package:analyzer/src/generated/constant.dart'; | 12 import 'package:analyzer/src/generated/constant.dart'; |
13 import 'package:analyzer/src/services/lint.dart'; | 13 import 'package:analyzer/src/services/lint.dart'; |
14 import 'package:analyzer/src/task/dart.dart' | 14 import 'package:analyzer/src/task/dart.dart' |
15 show | 15 show |
16 HINTS, | 16 HINTS, |
17 PARSE_ERRORS, | 17 PARSE_ERRORS, |
18 RESOLVE_REFERENCES_ERRORS, | 18 RESOLVE_REFERENCES_ERRORS, |
19 RESOLVE_TYPE_NAMES_ERRORS, | 19 RESOLVE_TYPE_NAMES_ERRORS, |
20 SCAN_ERRORS, | 20 SCAN_ERRORS, |
21 USED_IMPORTED_ELEMENTS, | 21 USED_IMPORTED_ELEMENTS, |
22 USED_LOCAL_ELEMENTS, | 22 USED_LOCAL_ELEMENTS, |
| 23 VARIABLE_REFERENCE_ERRORS, |
23 VERIFY_ERRORS; | 24 VERIFY_ERRORS; |
24 import 'package:analyzer/task/dart.dart' | 25 import 'package:analyzer/task/dart.dart' |
25 show DART_ERRORS, LibrarySpecificUnit, PARSED_UNIT, TOKEN_STREAM; | 26 show DART_ERRORS, LibrarySpecificUnit, PARSED_UNIT, TOKEN_STREAM; |
26 import 'package:analyzer/task/general.dart' show CONTENT; | 27 import 'package:analyzer/task/general.dart' show CONTENT; |
27 import 'package:analyzer/task/model.dart' show ResultDescriptor; | 28 import 'package:analyzer/task/model.dart' show ResultDescriptor; |
28 | 29 |
29 import 'ast.dart'; | 30 import 'ast.dart'; |
30 import 'element.dart'; | 31 import 'element.dart'; |
31 import 'engine.dart'; | 32 import 'engine.dart'; |
32 import 'error.dart'; | 33 import 'error.dart'; |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 | 1127 |
1127 void _shiftEntryErrors() { | 1128 void _shiftEntryErrors() { |
1128 if (oldEntry != null) { | 1129 if (oldEntry != null) { |
1129 _shiftEntryErrors_OLD(); | 1130 _shiftEntryErrors_OLD(); |
1130 } else { | 1131 } else { |
1131 _shiftEntryErrors_NEW(); | 1132 _shiftEntryErrors_NEW(); |
1132 } | 1133 } |
1133 } | 1134 } |
1134 | 1135 |
1135 void _shiftEntryErrors_NEW() { | 1136 void _shiftEntryErrors_NEW() { |
| 1137 _shiftErrors_NEW(HINTS); |
| 1138 _shiftErrors_NEW(RESOLVE_REFERENCES_ERRORS); |
1136 _shiftErrors_NEW(RESOLVE_TYPE_NAMES_ERRORS); | 1139 _shiftErrors_NEW(RESOLVE_TYPE_NAMES_ERRORS); |
1137 _shiftErrors_NEW(RESOLVE_REFERENCES_ERRORS); | 1140 _shiftErrors_NEW(VARIABLE_REFERENCE_ERRORS); |
1138 _shiftErrors_NEW(VERIFY_ERRORS); | 1141 _shiftErrors_NEW(VERIFY_ERRORS); |
1139 _shiftErrors_NEW(HINTS); | |
1140 } | 1142 } |
1141 | 1143 |
1142 void _shiftEntryErrors_OLD() { | 1144 void _shiftEntryErrors_OLD() { |
1143 _shiftErrors_OLD(DartEntry.RESOLUTION_ERRORS); | 1145 _shiftErrors_OLD(DartEntry.RESOLUTION_ERRORS); |
1144 _shiftErrors_OLD(DartEntry.VERIFICATION_ERRORS); | 1146 _shiftErrors_OLD(DartEntry.VERIFICATION_ERRORS); |
1145 _shiftErrors_OLD(DartEntry.HINTS); | 1147 _shiftErrors_OLD(DartEntry.HINTS); |
1146 _shiftErrors_OLD(DartEntry.LINTS); | 1148 _shiftErrors_OLD(DartEntry.LINTS); |
1147 } | 1149 } |
1148 | 1150 |
1149 void _shiftErrors(List<AnalysisError> errors) { | 1151 void _shiftErrors(List<AnalysisError> errors) { |
(...skipping 28 matching lines...) Expand all Loading... |
1178 | 1180 |
1179 void _updateEntry() { | 1181 void _updateEntry() { |
1180 if (oldEntry != null) { | 1182 if (oldEntry != null) { |
1181 _updateEntry_OLD(); | 1183 _updateEntry_OLD(); |
1182 } else { | 1184 } else { |
1183 _updateEntry_NEW(); | 1185 _updateEntry_NEW(); |
1184 } | 1186 } |
1185 } | 1187 } |
1186 | 1188 |
1187 void _updateEntry_NEW() { | 1189 void _updateEntry_NEW() { |
| 1190 _updateErrors_NEW(RESOLVE_REFERENCES_ERRORS, _resolveErrors); |
1188 _updateErrors_NEW(RESOLVE_TYPE_NAMES_ERRORS, []); | 1191 _updateErrors_NEW(RESOLVE_TYPE_NAMES_ERRORS, []); |
1189 _updateErrors_NEW(RESOLVE_REFERENCES_ERRORS, _resolveErrors); | 1192 _updateErrors_NEW(VARIABLE_REFERENCE_ERRORS, []); |
1190 _updateErrors_NEW(VERIFY_ERRORS, _verifyErrors); | 1193 _updateErrors_NEW(VERIFY_ERRORS, _verifyErrors); |
1191 // invalidate results we don't update incrementally | 1194 // invalidate results we don't update incrementally |
1192 newUnitEntry.setState(USED_IMPORTED_ELEMENTS, CacheState.INVALID); | 1195 newUnitEntry.setState(USED_IMPORTED_ELEMENTS, CacheState.INVALID); |
1193 newUnitEntry.setState(USED_LOCAL_ELEMENTS, CacheState.INVALID); | 1196 newUnitEntry.setState(USED_LOCAL_ELEMENTS, CacheState.INVALID); |
1194 newUnitEntry.setState(HINTS, CacheState.INVALID); | 1197 newUnitEntry.setState(HINTS, CacheState.INVALID); |
1195 } | 1198 } |
1196 | 1199 |
1197 void _updateEntry_OLD() { | 1200 void _updateEntry_OLD() { |
1198 { | 1201 { |
1199 List<AnalysisError> oldErrors = oldEntry.getValueInLibrary( | 1202 List<AnalysisError> oldErrors = oldEntry.getValueInLibrary( |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 @override | 1994 @override |
1992 String toString() => name; | 1995 String toString() => name; |
1993 } | 1996 } |
1994 | 1997 |
1995 class _TokenPair { | 1998 class _TokenPair { |
1996 final _TokenDifferenceKind kind; | 1999 final _TokenDifferenceKind kind; |
1997 final Token oldToken; | 2000 final Token oldToken; |
1998 final Token newToken; | 2001 final Token newToken; |
1999 _TokenPair(this.kind, this.oldToken, this.newToken); | 2002 _TokenPair(this.kind, this.oldToken, this.newToken); |
2000 } | 2003 } |
OLD | NEW |