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

Unified Diff: pkg/analysis_server/test/services/refactoring/extract_method_test.dart

Issue 2907213002: [Extract Method] When no selection, check for implicitly selected closure. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_method.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/refactoring/extract_method_test.dart
diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
index 841a83ebf2b6e81e78c020bb118f71868031d2bf..09b0081bf3a8fcbe6fde1879471068eb95f0fbe3 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
@@ -859,6 +859,52 @@ class A {
''');
}
+ test_closure_atArgumentName() async {
+ await indexTestUnit('''
+void process({int fff(int x)}) {}
+class C {
+ main() {
+ process(fff: (int x) => x * 2);
+ }
+}
+''');
+ _createRefactoring(findOffset('ff: (int x)'), 0);
+ // apply refactoring
+ return _assertSuccessfulRefactoring('''
+void process({int fff(int x)}) {}
+class C {
+ main() {
+ process(fff: res);
+ }
+
+ int res(int x) => x * 2;
+}
+''');
+ }
+
+ test_closure_atParameters() async {
+ await indexTestUnit('''
+void process(num f(int x)) {}
+class C {
+ main() {
+ process((int x) => x * 2);
+ }
+}
+''');
+ _createRefactoring(findOffset('x) =>'), 0);
+ // apply refactoring
+ return _assertSuccessfulRefactoring('''
+void process(num f(int x)) {}
+class C {
+ main() {
+ process(res);
+ }
+
+ num res(int x) => x * 2;
+}
+''');
+ }
+
test_closure_bad_referencesLocalVariable() async {
await indexTestUnit('''
process(f(x)) {}
« 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