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/context/cache.dart' as task; | 7 import 'package:analyzer/src/context/cache.dart' as task; |
8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
(...skipping 4460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4471 // The existing CompilationUnitElement should be updated. | 4471 // The existing CompilationUnitElement should be updated. |
4472 expect(newUnit.element, same(oldUnitElement)); | 4472 expect(newUnit.element, same(oldUnitElement)); |
4473 // The only expected pending task should return the same resolved | 4473 // The only expected pending task should return the same resolved |
4474 // "newUnit", so all clients will get it using the usual way. | 4474 // "newUnit", so all clients will get it using the usual way. |
4475 AnalysisResult analysisResult = analysisContext.performAnalysisTask(); | 4475 AnalysisResult analysisResult = analysisContext.performAnalysisTask(); |
4476 ChangeNotice notice = analysisResult.changeNotices[0]; | 4476 ChangeNotice notice = analysisResult.changeNotices[0]; |
4477 expect(notice.resolvedDartUnit, same(newUnit)); | 4477 expect(notice.resolvedDartUnit, same(newUnit)); |
4478 // Resolve "newCode" from scratch. | 4478 // Resolve "newCode" from scratch. |
4479 if (compareWithFull) { | 4479 if (compareWithFull) { |
4480 _resetWithIncremental(false); | 4480 _resetWithIncremental(false); |
4481 source = addSource(newCode + ' '); | 4481 changeSource(source, newCode); |
4482 source = addSource(newCode); | |
4483 _runTasks(); | 4482 _runTasks(); |
4484 LibraryElement library = resolve2(source); | 4483 LibraryElement library = resolve2(source); |
4485 CompilationUnit fullNewUnit = resolveCompilationUnit(source, library); | 4484 CompilationUnit fullNewUnit = resolveCompilationUnit(source, library); |
4486 // Validate tokens. | 4485 // Validate tokens. |
4487 _assertEqualTokens(newUnit, fullNewUnit); | 4486 _assertEqualTokens(newUnit, fullNewUnit); |
4488 // Validate LineInfo | 4487 // Validate LineInfo |
4489 _assertEqualLineInfo(newLineInfo, analysisContext.getLineInfo(source)); | 4488 _assertEqualLineInfo(newLineInfo, analysisContext.getLineInfo(source)); |
4490 // Validate that "incremental" and "full" units have the same resolution. | 4489 // Validate that "incremental" and "full" units have the same resolution. |
4491 try { | 4490 try { |
4492 assertSameResolution(newUnit, fullNewUnit, validateTypes: true); | 4491 assertSameResolution(newUnit, fullNewUnit, validateTypes: true); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4743 return ResolutionContextBuilder.contextFor(node, listener).scope; | 4742 return ResolutionContextBuilder.contextFor(node, listener).scope; |
4744 } | 4743 } |
4745 } | 4744 } |
4746 | 4745 |
4747 class _Edit { | 4746 class _Edit { |
4748 final int offset; | 4747 final int offset; |
4749 final int length; | 4748 final int length; |
4750 final String replacement; | 4749 final String replacement; |
4751 _Edit(this.offset, this.length, this.replacement); | 4750 _Edit(this.offset, this.length, this.replacement); |
4752 } | 4751 } |
OLD | NEW |