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_test; | 5 library engine.incremental_resolver_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
(...skipping 3360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3371 if (!expectedSuccess) { | 3371 if (!expectedSuccess) { |
3372 expect(newUnit.element, isNot(same(oldUnitElement))); | 3372 expect(newUnit.element, isNot(same(oldUnitElement))); |
3373 return; | 3373 return; |
3374 } | 3374 } |
3375 // The existing CompilationUnitElement should be updated. | 3375 // The existing CompilationUnitElement should be updated. |
3376 expect(newUnit.element, same(oldUnitElement)); | 3376 expect(newUnit.element, same(oldUnitElement)); |
3377 // The only expected pending task should return the same resolved | 3377 // The only expected pending task should return the same resolved |
3378 // "newUnit", so all clients will get it using the usual way. | 3378 // "newUnit", so all clients will get it using the usual way. |
3379 AnalysisResult analysisResult = analysisContext.performAnalysisTask(); | 3379 AnalysisResult analysisResult = analysisContext.performAnalysisTask(); |
3380 ChangeNotice notice = analysisResult.changeNotices[0]; | 3380 ChangeNotice notice = analysisResult.changeNotices[0]; |
3381 expect(notice.compilationUnit, same(newUnit)); | 3381 expect(notice.resolvedDartUnit, same(newUnit)); |
3382 // Resolve "newCode" from scratch. | 3382 // Resolve "newCode" from scratch. |
3383 if (compareWithFull) { | 3383 if (compareWithFull) { |
3384 _resetWithIncremental(false); | 3384 _resetWithIncremental(false); |
3385 source = addSource(newCode + ' '); | 3385 source = addSource(newCode + ' '); |
3386 source = addSource(newCode); | 3386 source = addSource(newCode); |
3387 _runTasks(); | 3387 _runTasks(); |
3388 LibraryElement library = resolve(source); | 3388 LibraryElement library = resolve(source); |
3389 CompilationUnit fullNewUnit = resolveCompilationUnit(source, library); | 3389 CompilationUnit fullNewUnit = resolveCompilationUnit(source, library); |
3390 // Validate tokens. | 3390 // Validate tokens. |
3391 _assertEqualTokens(newUnit, fullNewUnit); | 3391 _assertEqualTokens(newUnit, fullNewUnit); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3678 } | 3678 } |
3679 } | 3679 } |
3680 | 3680 |
3681 | 3681 |
3682 class _Edit { | 3682 class _Edit { |
3683 final int offset; | 3683 final int offset; |
3684 final int length; | 3684 final int length; |
3685 final String replacement; | 3685 final String replacement; |
3686 _Edit(this.offset, this.length, this.replacement); | 3686 _Edit(this.offset, this.length, this.replacement); |
3687 } | 3687 } |
OLD | NEW |