| 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/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/context/cache.dart'; | 10 import 'package:analyzer/src/context/cache.dart'; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 analysisContext2 = AnalysisContextFactory.contextWithCore(); | 147 analysisContext2 = AnalysisContextFactory.contextWithCore(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 @override | 150 @override |
| 151 void resetWithOptions(AnalysisOptions options) { | 151 void resetWithOptions(AnalysisOptions options) { |
| 152 AnalysisContextFactory.contextWithCoreAndOptions(options); | 152 AnalysisContextFactory.contextWithCoreAndOptions(options); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void setUp() { | 155 void setUp() { |
| 156 super.setUp(); | 156 super.setUp(); |
| 157 test_resolveApiChanges = true; | |
| 158 logging.logger = logging.NULL_LOGGER; | 157 logging.logger = logging.NULL_LOGGER; |
| 159 } | 158 } |
| 160 | 159 |
| 161 void test_classMemberAccessor_body() { | 160 void test_classMemberAccessor_body() { |
| 162 _resolveUnit(r''' | 161 _resolveUnit(r''' |
| 163 class A { | 162 class A { |
| 164 int get test { | 163 int get test { |
| 165 return 1 + 2; | 164 return 1 + 2; |
| 166 } | 165 } |
| 167 }'''); | 166 }'''); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 int updateEndOld = updateOffset + edit.length; | 425 int updateEndOld = updateOffset + edit.length; |
| 427 int updateOldNew = updateOffset + edit.replacement.length; | 426 int updateOldNew = updateOffset + edit.replacement.length; |
| 428 IncrementalResolver resolver; | 427 IncrementalResolver resolver; |
| 429 LibrarySpecificUnit lsu = new LibrarySpecificUnit(source, source); | 428 LibrarySpecificUnit lsu = new LibrarySpecificUnit(source, source); |
| 430 resolver = new IncrementalResolver(cache, cache.get(source), cache.get(lsu), | 429 resolver = new IncrementalResolver(cache, cache.get(source), cache.get(lsu), |
| 431 unit.element, updateOffset, updateEndOld, updateOldNew); | 430 unit.element, updateOffset, updateEndOld, updateOldNew); |
| 432 | 431 |
| 433 BlockFunctionBody body = newNode.getAncestor((n) => n is BlockFunctionBody); | 432 BlockFunctionBody body = newNode.getAncestor((n) => n is BlockFunctionBody); |
| 434 expect(body, isNotNull); | 433 expect(body, isNotNull); |
| 435 | 434 |
| 436 bool success = resolver.resolve(body); | 435 resolver.resolve(body); |
| 437 expect(success, isTrue); | |
| 438 _checkCacheEntries(cache); | 436 _checkCacheEntries(cache); |
| 439 | 437 |
| 440 List<AnalysisError> newErrors = analysisContext.computeErrors(source); | 438 List<AnalysisError> newErrors = analysisContext.computeErrors(source); |
| 441 // resolve "newCode" from scratch | 439 // resolve "newCode" from scratch |
| 442 CompilationUnit fullNewUnit; | 440 CompilationUnit fullNewUnit; |
| 443 { | 441 { |
| 444 source = addSource(newCode); | 442 source = addSource(newCode); |
| 445 _runTasks(); | 443 _runTasks(); |
| 446 LibraryElement library = resolve2(source); | 444 LibraryElement library = resolve2(source); |
| 447 fullNewUnit = resolveCompilationUnit(source, library); | 445 fullNewUnit = resolveCompilationUnit(source, library); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 @reflectiveTest | 513 @reflectiveTest |
| 516 class PoorMansIncrementalResolutionTest extends ResolverTestCase { | 514 class PoorMansIncrementalResolutionTest extends ResolverTestCase { |
| 517 final _TestLogger logger = new _TestLogger(); | 515 final _TestLogger logger = new _TestLogger(); |
| 518 | 516 |
| 519 Source source; | 517 Source source; |
| 520 String code; | 518 String code; |
| 521 LibraryElement oldLibrary; | 519 LibraryElement oldLibrary; |
| 522 CompilationUnit oldUnit; | 520 CompilationUnit oldUnit; |
| 523 CompilationUnitElement oldUnitElement; | 521 CompilationUnitElement oldUnitElement; |
| 524 | 522 |
| 525 void fail_updateErrors_removeExisting_duplicateMethodDeclaration() { | |
| 526 // TODO(scheglov) We fail to remove the second "foo" declaration. | |
| 527 // So, we still have the same duplicate declaration problem. | |
| 528 _resolveUnit(r''' | |
| 529 class A { | |
| 530 void foo() {} | |
| 531 void foo() {} | |
| 532 } | |
| 533 '''); | |
| 534 _updateAndValidate(r''' | |
| 535 class A { | |
| 536 void foo() {} | |
| 537 void foo2() {} | |
| 538 } | |
| 539 '''); | |
| 540 } | |
| 541 | |
| 542 @override | 523 @override |
| 543 void setUp() { | 524 void setUp() { |
| 544 super.setUp(); | 525 super.setUp(); |
| 545 _resetWithIncremental(true); | 526 _resetWithIncremental(true); |
| 546 } | 527 } |
| 547 | 528 |
| 548 void test_computeConstants() { | 529 void test_computeConstants() { |
| 549 _resolveUnit(r''' | 530 _resolveUnit(r''' |
| 550 int f() => 0; | 531 int f() => 0; |
| 551 main() { | 532 main() { |
| (...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 void logException(Object exception, [Object stackTrace]) { | 2229 void logException(Object exception, [Object stackTrace]) { |
| 2249 lastException = exception; | 2230 lastException = exception; |
| 2250 lastStackTrace = stackTrace; | 2231 lastStackTrace = stackTrace; |
| 2251 } | 2232 } |
| 2252 | 2233 |
| 2253 @override | 2234 @override |
| 2254 logging.LoggingTimer startTimer() { | 2235 logging.LoggingTimer startTimer() { |
| 2255 return new logging.LoggingTimer(this); | 2236 return new logging.LoggingTimer(this); |
| 2256 } | 2237 } |
| 2257 } | 2238 } |
| OLD | NEW |