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 2490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2501 '''); | 2501 '''); |
2502 await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' | 2502 await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
2503 main() { | 2503 main() { |
2504 var test; | 2504 var test; |
2505 test.add('hello'); | 2505 test.add('hello'); |
2506 } | 2506 } |
2507 '''); | 2507 '''); |
2508 _assertLinkedGroup(change.linkedEditGroups[0], ['test;', 'test.add(']); | 2508 _assertLinkedGroup(change.linkedEditGroups[0], ['test;', 'test.add(']); |
2509 } | 2509 } |
2510 | 2510 |
2511 test_createLocalVariable_withImport() async { | |
2512 addPackageSource('analyzer', 'file_system/physical_file_system.dart', ''' | |
scheglov
2017/08/12 22:28:32
I would prefer to use sanitized test with syntheti
Brian Wilkerson
2017/08/13 15:33:34
Done
| |
2513 class PhysicalResourceProvider { | |
2514 static final INSTANCE = null; | |
2515 } | |
2516 '''); | |
2517 addPackageSource('analyzer', 'src/generated/sdk.dart', ''' | |
2518 class DartSdkManager {} | |
2519 '''); | |
2520 addPackageSource('analyzer', 'src/context/builder.dart', ''' | |
2521 import 'package:analyzer/file_system/physical_file_system.dart'; | |
2522 import 'package:analyzer/src/generated/sdk.dart'; | |
2523 | |
2524 class ContextBuilder { | |
2525 ContextBuilder(PhysicalResourceProvider p, DartSdkManager m, i); | |
2526 } | |
2527 '''); | |
2528 | |
2529 await resolveTestUnit(''' | |
2530 import 'package:analyzer/file_system/physical_file_system.dart'; | |
2531 import 'package:analyzer/src/context/builder.dart'; | |
2532 | |
2533 main() { | |
2534 String path = '/dart/issue30424/flutter/packages/flutter'; | |
2535 | |
2536 var resourceProvider = PhysicalResourceProvider.INSTANCE; | |
2537 | |
2538 new ContextBuilder(resourceProvider, sdkManager, null); | |
2539 } | |
2540 '''); | |
2541 await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' | |
2542 import 'package:analyzer/file_system/physical_file_system.dart'; | |
2543 import 'package:analyzer/src/context/builder.dart'; | |
2544 import 'package:analyzer/src/generated/sdk.dart'; | |
2545 | |
2546 main() { | |
2547 String path = '/dart/issue30424/flutter/packages/flutter'; | |
2548 | |
2549 var resourceProvider = PhysicalResourceProvider.INSTANCE; | |
2550 | |
2551 DartSdkManager sdkManager; | |
2552 new ContextBuilder(resourceProvider, sdkManager, null); | |
2553 } | |
2554 '''); | |
2555 } | |
2556 | |
2511 test_createLocalVariable_write_assignment() async { | 2557 test_createLocalVariable_write_assignment() async { |
2512 await resolveTestUnit(''' | 2558 await resolveTestUnit(''' |
2513 main() { | 2559 main() { |
2514 test = 42; | 2560 test = 42; |
2515 } | 2561 } |
2516 '''); | 2562 '''); |
2517 await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' | 2563 await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
2518 main() { | 2564 main() { |
2519 var test = 42; | 2565 var test = 42; |
2520 } | 2566 } |
(...skipping 3960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6481 @override | 6527 @override |
6482 final AnalysisError error; | 6528 final AnalysisError error; |
6483 | 6529 |
6484 _DartFixContextImpl(this.resourceProvider, this.analysisDriver, | 6530 _DartFixContextImpl(this.resourceProvider, this.analysisDriver, |
6485 this.astProvider, this.unit, this.error); | 6531 this.astProvider, this.unit, this.error); |
6486 | 6532 |
6487 @override | 6533 @override |
6488 GetTopLevelDeclarations get getTopLevelDeclarations => | 6534 GetTopLevelDeclarations get getTopLevelDeclarations => |
6489 analysisDriver.getTopLevelNameDeclarations; | 6535 analysisDriver.getTopLevelNameDeclarations; |
6490 } | 6536 } |
OLD | NEW |