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 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3428 } | 3428 } |
3429 '''); | 3429 '''); |
3430 _updateAndValidate(r''' | 3430 _updateAndValidate(r''' |
3431 class A { | 3431 class A { |
3432 void foo() {} | 3432 void foo() {} |
3433 void foo2() {} | 3433 void foo2() {} |
3434 } | 3434 } |
3435 '''); | 3435 '''); |
3436 } | 3436 } |
3437 | 3437 |
| 3438 @override |
3438 void setUp() { | 3439 void setUp() { |
| 3440 AnalysisEngine.instance.useTaskModel = true; |
3439 super.setUp(); | 3441 super.setUp(); |
3440 _resetWithIncremental(true); | 3442 _resetWithIncremental(true); |
3441 } | 3443 } |
3442 | 3444 |
| 3445 @override |
| 3446 void tearDown() { |
| 3447 super.tearDown(); |
| 3448 AnalysisEngine.instance.useTaskModel = false; |
| 3449 } |
| 3450 |
3443 void test_computeConstants() { | 3451 void test_computeConstants() { |
3444 _resolveUnit(r''' | 3452 _resolveUnit(r''' |
3445 int f() => 0; | 3453 int f() => 0; |
3446 main() { | 3454 main() { |
3447 const x = f(); | 3455 const x = f(); |
3448 print(x + 1); | 3456 print(x + 1); |
3449 } | 3457 } |
3450 '''); | 3458 '''); |
3451 _updateAndValidate(r''' | 3459 _updateAndValidate(r''' |
3452 int f() => 0; | 3460 int f() => 0; |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4153 '''); | 4161 '''); |
4154 _updateAndValidate(r''' | 4162 _updateAndValidate(r''' |
4155 class A { | 4163 class A { |
4156 main(int b) { | 4164 main(int b) { |
4157 print(b); | 4165 print(b); |
4158 } | 4166 } |
4159 } | 4167 } |
4160 '''); | 4168 '''); |
4161 } | 4169 } |
4162 | 4170 |
| 4171 void test_true_todoHint() { |
| 4172 _resolveUnit(r''' |
| 4173 main() { |
| 4174 print(1); |
| 4175 } |
| 4176 foo() { |
| 4177 // TODO |
| 4178 } |
| 4179 '''); |
| 4180 List<AnalysisError> oldErrors = analysisContext.computeErrors(source); |
| 4181 _updateAndValidate(r''' |
| 4182 main() { |
| 4183 print(2); |
| 4184 } |
| 4185 foo() { |
| 4186 // TODO |
| 4187 } |
| 4188 '''); |
| 4189 List<AnalysisError> newErrors = analysisContext.computeErrors(source); |
| 4190 _assertEqualErrors(newErrors, oldErrors); |
| 4191 } |
| 4192 |
4163 void test_unusedHint_add_wasUsedOnlyInPart() { | 4193 void test_unusedHint_add_wasUsedOnlyInPart() { |
4164 Source partSource = addNamedSource( | 4194 Source partSource = addNamedSource( |
4165 '/my_unit.dart', | 4195 '/my_unit.dart', |
4166 r''' | 4196 r''' |
4167 part of lib; | 4197 part of lib; |
4168 | 4198 |
4169 f(A a) { | 4199 f(A a) { |
4170 a._foo(); | 4200 a._foo(); |
4171 } | 4201 } |
4172 '''); | 4202 '''); |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4742 return ResolutionContextBuilder.contextFor(node, listener).scope; | 4772 return ResolutionContextBuilder.contextFor(node, listener).scope; |
4743 } | 4773 } |
4744 } | 4774 } |
4745 | 4775 |
4746 class _Edit { | 4776 class _Edit { |
4747 final int offset; | 4777 final int offset; |
4748 final int length; | 4778 final int length; |
4749 final String replacement; | 4779 final String replacement; |
4750 _Edit(this.offset, this.length, this.replacement); | 4780 _Edit(this.offset, this.length, this.replacement); |
4751 } | 4781 } |
OLD | NEW |