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

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

Issue 970063002: When a closure is extracted as a method, it does not have any return type. (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
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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 // end 1051 // end
1052 print(v); 1052 print(v);
1053 } 1053 }
1054 '''); 1054 ''');
1055 _createRefactoringForStartEndComments(); 1055 _createRefactoringForStartEndComments();
1056 // do check 1056 // do check
1057 await refactoring.checkInitialConditions(); 1057 await refactoring.checkInitialConditions();
1058 expect(refactoring.returnType, 'double'); 1058 expect(refactoring.returnType, 'double');
1059 } 1059 }
1060 1060
1061 test_returnType_closure() async {
1062 indexTestUnit('''
1063 process(f(x)) {}
1064 main() {
1065 process((x) => x * 2);
1066 }
1067 ''');
1068 _createRefactoringForString('(x) => x * 2');
1069 // do check
1070 await refactoring.checkInitialConditions();
1071 expect(refactoring.returnType, '');
1072 }
1073
1061 test_returnType_statements_nullMix() async { 1074 test_returnType_statements_nullMix() async {
1062 indexTestUnit(''' 1075 indexTestUnit('''
1063 main(bool p) { 1076 main(bool p) {
1064 // start 1077 // start
1065 if (p) { 1078 if (p) {
1066 return 42; 1079 return 42;
1067 } 1080 }
1068 return null; 1081 return null;
1069 // end 1082 // end
1070 } 1083 }
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 * Returns a deep copy of [refactoring] parameters. 2538 * Returns a deep copy of [refactoring] parameters.
2526 * There was a bug masked by updating parameter instances shared between the 2539 * There was a bug masked by updating parameter instances shared between the
2527 * refactoring and the test. 2540 * refactoring and the test.
2528 */ 2541 */
2529 List<RefactoringMethodParameter> _getParametersCopy() { 2542 List<RefactoringMethodParameter> _getParametersCopy() {
2530 return refactoring.parameters.map((p) { 2543 return refactoring.parameters.map((p) {
2531 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id); 2544 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id);
2532 }).toList(); 2545 }).toList();
2533 } 2546 }
2534 } 2547 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_method.dart ('k') | pkg/analysis_server/tool/spec/spec_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698