| 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 test.services.correction.fix; | 5 library test.services.correction.fix; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; | 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; |
| 8 import 'package:analysis_server/src/services/correction/fix.dart'; | 8 import 'package:analysis_server/src/services/correction/fix.dart'; |
| 9 import 'package:analysis_server/src/services/index/index.dart'; | 9 import 'package:analysis_server/src/services/index/index.dart'; |
| 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 assertHasFix(FixKind.CREATE_FIELD, ''' | 435 assertHasFix(FixKind.CREATE_FIELD, ''' |
| 436 class A { | 436 class A { |
| 437 int test; | 437 int test; |
| 438 } | 438 } |
| 439 main(A a) { | 439 main(A a) { |
| 440 int v = a.test; | 440 int v = a.test; |
| 441 } | 441 } |
| 442 '''); | 442 '''); |
| 443 } | 443 } |
| 444 | 444 |
| 445 void test_createField_getter_qualified_instance_dynamicType() { |
| 446 _indexTestUnit(''' |
| 447 class A { |
| 448 B b; |
| 449 void f(Object p) { |
| 450 p == b.test; |
| 451 } |
| 452 } |
| 453 class B { |
| 454 } |
| 455 '''); |
| 456 assertHasFix(FixKind.CREATE_FIELD, ''' |
| 457 class A { |
| 458 B b; |
| 459 void f(Object p) { |
| 460 p == b.test; |
| 461 } |
| 462 } |
| 463 class B { |
| 464 var test; |
| 465 } |
| 466 '''); |
| 467 } |
| 468 |
| 445 void test_createField_getter_unqualified_instance_asInvocationArgument() { | 469 void test_createField_getter_unqualified_instance_asInvocationArgument() { |
| 446 _indexTestUnit(''' | 470 _indexTestUnit(''' |
| 447 class A { | 471 class A { |
| 448 main() { | 472 main() { |
| 449 f(test); | 473 f(test); |
| 450 } | 474 } |
| 451 } | 475 } |
| 452 f(String s) {} | 476 f(String s) {} |
| 453 '''); | 477 '''); |
| 454 assertHasFix(FixKind.CREATE_FIELD, ''' | 478 assertHasFix(FixKind.CREATE_FIELD, ''' |
| (...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2321 positions.add(new Position(testFile, offset)); | 2345 positions.add(new Position(testFile, offset)); |
| 2322 } | 2346 } |
| 2323 return positions; | 2347 return positions; |
| 2324 } | 2348 } |
| 2325 | 2349 |
| 2326 void _indexTestUnit(String code) { | 2350 void _indexTestUnit(String code) { |
| 2327 resolveTestUnit(code); | 2351 resolveTestUnit(code); |
| 2328 index.indexUnit(context, testUnit); | 2352 index.indexUnit(context, testUnit); |
| 2329 } | 2353 } |
| 2330 } | 2354 } |
| OLD | NEW |