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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 7 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
8 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; | 8 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; |
9 import 'package:analysis_server/src/services/correction/fix.dart'; | 9 import 'package:analysis_server/src/services/correction/fix.dart'; |
10 import 'package:analysis_server/src/services/correction/fix_internal.dart'; | 10 import 'package:analysis_server/src/services/correction/fix_internal.dart'; |
(...skipping 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2537 import 'package:pkg/a/a.dart'; | 2537 import 'package:pkg/a/a.dart'; |
2538 import 'package:pkg/b/b.dart'; | 2538 import 'package:pkg/b/b.dart'; |
2539 import 'package:pkg/c/c.dart'; | 2539 import 'package:pkg/c/c.dart'; |
2540 | 2540 |
2541 main() { | 2541 main() { |
2542 A a; | 2542 A a; |
2543 B b; | 2543 B b; |
2544 new C(a, b); | 2544 new C(a, b); |
2545 } | 2545 } |
2546 '''); | 2546 '''); |
| 2547 |
| 2548 List<LinkedEditGroup> groups = change.linkedEditGroups; |
| 2549 expect(groups, hasLength(2)); |
| 2550 LinkedEditGroup typeGroup = groups[0]; |
| 2551 List<Position> typePositions = typeGroup.positions; |
| 2552 expect(typePositions, hasLength(1)); |
| 2553 expect(typePositions[0].offset, 112); |
| 2554 LinkedEditGroup nameGroup = groups[1]; |
| 2555 List<Position> groupPositions = nameGroup.positions; |
| 2556 expect(groupPositions, hasLength(2)); |
| 2557 expect(groupPositions[0].offset, 114); |
| 2558 expect(groupPositions[1].offset, 128); |
2547 } | 2559 } |
2548 | 2560 |
2549 test_createLocalVariable_write_assignment() async { | 2561 test_createLocalVariable_write_assignment() async { |
2550 await resolveTestUnit(''' | 2562 await resolveTestUnit(''' |
2551 main() { | 2563 main() { |
2552 test = 42; | 2564 test = 42; |
2553 } | 2565 } |
2554 '''); | 2566 '''); |
2555 await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' | 2567 await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
2556 main() { | 2568 main() { |
(...skipping 3962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6519 @override | 6531 @override |
6520 final AnalysisError error; | 6532 final AnalysisError error; |
6521 | 6533 |
6522 _DartFixContextImpl(this.resourceProvider, this.analysisDriver, | 6534 _DartFixContextImpl(this.resourceProvider, this.analysisDriver, |
6523 this.astProvider, this.unit, this.error); | 6535 this.astProvider, this.unit, this.error); |
6524 | 6536 |
6525 @override | 6537 @override |
6526 GetTopLevelDeclarations get getTopLevelDeclarations => | 6538 GetTopLevelDeclarations get getTopLevelDeclarations => |
6527 analysisDriver.getTopLevelNameDeclarations; | 6539 analysisDriver.getTopLevelNameDeclarations; |
6528 } | 6540 } |
OLD | NEW |