| 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 4480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4491 _resetWithIncremental(true); | 4491 _resetWithIncremental(true); |
| 4492 analysisContext2.setContents(source, newCode); | 4492 analysisContext2.setContents(source, newCode); |
| 4493 CompilationUnit newUnit = resolveCompilationUnit(source, oldLibrary); | 4493 CompilationUnit newUnit = resolveCompilationUnit(source, oldLibrary); |
| 4494 List<AnalysisError> newErrors = analysisContext.computeErrors(source); | 4494 List<AnalysisError> newErrors = analysisContext.computeErrors(source); |
| 4495 LineInfo newLineInfo = analysisContext.getLineInfo(source); | 4495 LineInfo newLineInfo = analysisContext.getLineInfo(source); |
| 4496 // check for expected failure | 4496 // check for expected failure |
| 4497 if (!expectedSuccess) { | 4497 if (!expectedSuccess) { |
| 4498 expect(newUnit.element, isNot(same(oldUnitElement))); | 4498 expect(newUnit.element, isNot(same(oldUnitElement))); |
| 4499 return; | 4499 return; |
| 4500 } | 4500 } |
| 4501 // The existing CompilationUnitElement should be updated. | 4501 // The existing CompilationUnit[Element] should be updated. |
| 4502 expect(newUnit, same(oldUnit)); |
| 4502 expect(newUnit.element, same(oldUnitElement)); | 4503 expect(newUnit.element, same(oldUnitElement)); |
| 4504 expect(analysisContext.parseCompilationUnit(source), same(oldUnit)); |
| 4503 // The only expected pending task should return the same resolved | 4505 // The only expected pending task should return the same resolved |
| 4504 // "newUnit", so all clients will get it using the usual way. | 4506 // "newUnit", so all clients will get it using the usual way. |
| 4505 AnalysisResult analysisResult = analysisContext.performAnalysisTask(); | 4507 AnalysisResult analysisResult = analysisContext.performAnalysisTask(); |
| 4506 ChangeNotice notice = analysisResult.changeNotices[0]; | 4508 ChangeNotice notice = analysisResult.changeNotices[0]; |
| 4507 expect(notice.resolvedDartUnit, same(newUnit)); | 4509 expect(notice.resolvedDartUnit, same(newUnit)); |
| 4508 // Resolve "newCode" from scratch. | 4510 // Resolve "newCode" from scratch. |
| 4509 if (compareWithFull) { | 4511 if (compareWithFull) { |
| 4510 _resetWithIncremental(false); | 4512 _resetWithIncremental(false); |
| 4511 changeSource(source, newCode); | 4513 changeSource(source, newCode); |
| 4512 _runTasks(); | 4514 _runTasks(); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4772 return ResolutionContextBuilder.contextFor(node, listener).scope; | 4774 return ResolutionContextBuilder.contextFor(node, listener).scope; |
| 4773 } | 4775 } |
| 4774 } | 4776 } |
| 4775 | 4777 |
| 4776 class _Edit { | 4778 class _Edit { |
| 4777 final int offset; | 4779 final int offset; |
| 4778 final int length; | 4780 final int length; |
| 4779 final String replacement; | 4781 final String replacement; |
| 4780 _Edit(this.offset, this.length, this.replacement); | 4782 _Edit(this.offset, this.length, this.replacement); |
| 4781 } | 4783 } |
| OLD | NEW |