Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: pkg/analysis_server/test/services/refactoring/extract_method_test.dart

Issue 971203002: Don't allow to extract a closure as a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_method.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 { 616 {
617 } 617 }
618 // end 618 // end
619 } 619 }
620 '''); 620 ''');
621 _createRefactoringForStartEndComments(); 621 _createRefactoringForStartEndComments();
622 return _assertConditionsFatal( 622 return _assertConditionsFatal(
623 "Operation not applicable to a while statement's expression and body."); 623 "Operation not applicable to a while statement's expression and body.");
624 } 624 }
625 625
626 test_canExtractGetter_false_closure() async {
627 indexTestUnit('''
628 main() {
629 useFunction((_) => true);
630 }
631 useFunction(filter(String p)) {}
632 ''');
633 _createRefactoringForString('(_) => true');
634 // apply refactoring
635 await assertRefactoringConditionsOK();
636 expect(refactoring.canCreateGetter, false);
637 expect(refactoring.createGetter, false);
638 }
639
626 test_canExtractGetter_false_fieldAssignment() async { 640 test_canExtractGetter_false_fieldAssignment() async {
627 indexTestUnit(''' 641 indexTestUnit('''
628 class A { 642 class A {
629 var f; 643 var f;
630 main() { 644 main() {
631 // start 645 // start
632 f = 1; 646 f = 1;
633 // end 647 // end
634 } 648 }
635 } 649 }
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 * Returns a deep copy of [refactoring] parameters. 2539 * Returns a deep copy of [refactoring] parameters.
2526 * There was a bug masked by updating parameter instances shared between the 2540 * There was a bug masked by updating parameter instances shared between the
2527 * refactoring and the test. 2541 * refactoring and the test.
2528 */ 2542 */
2529 List<RefactoringMethodParameter> _getParametersCopy() { 2543 List<RefactoringMethodParameter> _getParametersCopy() {
2530 return refactoring.parameters.map((p) { 2544 return refactoring.parameters.map((p) {
2531 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id); 2545 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id);
2532 }).toList(); 2546 }).toList();
2533 } 2547 }
2534 } 2548 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_method.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698