| 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 analyzer.test.generated.incremental_resolver_test; | 5 library analyzer.test.generated.incremental_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/dart/ast/utilities.dart'; | 10 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| (...skipping 3426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3437 int delta = edit.replacement.length - edit.length; | 3437 int delta = edit.replacement.length - edit.length; |
| 3438 _shiftTokens(unit.beginToken, offset, delta); | 3438 _shiftTokens(unit.beginToken, offset, delta); |
| 3439 } | 3439 } |
| 3440 // do incremental resolution | 3440 // do incremental resolution |
| 3441 int updateOffset = edit.offset; | 3441 int updateOffset = edit.offset; |
| 3442 int updateEndOld = updateOffset + edit.length; | 3442 int updateEndOld = updateOffset + edit.length; |
| 3443 int updateOldNew = updateOffset + edit.replacement.length; | 3443 int updateOldNew = updateOffset + edit.replacement.length; |
| 3444 IncrementalResolver resolver; | 3444 IncrementalResolver resolver; |
| 3445 LibrarySpecificUnit lsu = new LibrarySpecificUnit(source, source); | 3445 LibrarySpecificUnit lsu = new LibrarySpecificUnit(source, source); |
| 3446 AnalysisCache cache = analysisContext2.analysisCache; | 3446 AnalysisCache cache = analysisContext2.analysisCache; |
| 3447 resolver = new IncrementalResolver(cache.get(source), cache.get(lsu), | 3447 resolver = new IncrementalResolver(cache, cache.get(source), cache.get(lsu), |
| 3448 unit.element, updateOffset, updateEndOld, updateOldNew); | 3448 unit.element, updateOffset, updateEndOld, updateOldNew); |
| 3449 bool success = resolver.resolve(newNode); | 3449 bool success = resolver.resolve(newNode); |
| 3450 expect(success, isTrue); | 3450 expect(success, isTrue); |
| 3451 List<AnalysisError> newErrors = analysisContext.computeErrors(source); | 3451 List<AnalysisError> newErrors = analysisContext.computeErrors(source); |
| 3452 // resolve "newCode" from scratch | 3452 // resolve "newCode" from scratch |
| 3453 CompilationUnit fullNewUnit; | 3453 CompilationUnit fullNewUnit; |
| 3454 { | 3454 { |
| 3455 source = addSource(newCode); | 3455 source = addSource(newCode); |
| 3456 _runTasks(); | 3456 _runTasks(); |
| 3457 LibraryElement library = resolve2(source); | 3457 LibraryElement library = resolve2(source); |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5135 @override | 5135 @override |
| 5136 void logException(Object exception, [Object stackTrace]) { | 5136 void logException(Object exception, [Object stackTrace]) { |
| 5137 hasError = true; | 5137 hasError = true; |
| 5138 } | 5138 } |
| 5139 | 5139 |
| 5140 @override | 5140 @override |
| 5141 logging.LoggingTimer startTimer() { | 5141 logging.LoggingTimer startTimer() { |
| 5142 return new logging.LoggingTimer(this); | 5142 return new logging.LoggingTimer(this); |
| 5143 } | 5143 } |
| 5144 } | 5144 } |
| OLD | NEW |