| 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.refactoring.extract_method; | 5 library test.services.refactoring.extract_method; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:analysis_server/src/services/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| (...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 res(a); | 2377 res(a); |
| 2378 // end | 2378 // end |
| 2379 } | 2379 } |
| 2380 | 2380 |
| 2381 void res(int a) { | 2381 void res(int a) { |
| 2382 print(a); | 2382 print(a); |
| 2383 } | 2383 } |
| 2384 '''); | 2384 '''); |
| 2385 } | 2385 } |
| 2386 | 2386 |
| 2387 test_statements_parameters_ignoreInnerPropagatedType() async { |
| 2388 indexTestUnit(''' |
| 2389 main(Object x) { |
| 2390 // start |
| 2391 if (x is int) { |
| 2392 print('int'); |
| 2393 } |
| 2394 if (x is bool) { |
| 2395 print('bool'); |
| 2396 } |
| 2397 // end |
| 2398 } |
| 2399 '''); |
| 2400 _createRefactoringForStartEndComments(); |
| 2401 // apply refactoring |
| 2402 return _assertSuccessfulRefactoring(''' |
| 2403 main(Object x) { |
| 2404 // start |
| 2405 res(x); |
| 2406 // end |
| 2407 } |
| 2408 |
| 2409 void res(Object x) { |
| 2410 if (x is int) { |
| 2411 print('int'); |
| 2412 } |
| 2413 if (x is bool) { |
| 2414 print('bool'); |
| 2415 } |
| 2416 } |
| 2417 '''); |
| 2418 } |
| 2419 |
| 2387 test_statements_parameters_importType() { | 2420 test_statements_parameters_importType() { |
| 2388 _addLibraryReturningAsync(); | 2421 _addLibraryReturningAsync(); |
| 2389 indexTestUnit(''' | 2422 indexTestUnit(''' |
| 2390 import 'asyncLib.dart'; | 2423 import 'asyncLib.dart'; |
| 2391 main() { | 2424 main() { |
| 2392 var v = newFuture(); | 2425 var v = newFuture(); |
| 2393 // start | 2426 // start |
| 2394 print(v); | 2427 print(v); |
| 2395 // end | 2428 // end |
| 2396 } | 2429 } |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2715 * Returns a deep copy of [refactoring] parameters. | 2748 * Returns a deep copy of [refactoring] parameters. |
| 2716 * There was a bug masked by updating parameter instances shared between the | 2749 * There was a bug masked by updating parameter instances shared between the |
| 2717 * refactoring and the test. | 2750 * refactoring and the test. |
| 2718 */ | 2751 */ |
| 2719 List<RefactoringMethodParameter> _getParametersCopy() { | 2752 List<RefactoringMethodParameter> _getParametersCopy() { |
| 2720 return refactoring.parameters.map((p) { | 2753 return refactoring.parameters.map((p) { |
| 2721 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id); | 2754 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id); |
| 2722 }).toList(); | 2755 }).toList(); |
| 2723 } | 2756 } |
| 2724 } | 2757 } |
| OLD | NEW |