| 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.inline_method; | 5 library test.services.refactoring.inline_method; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' hide Element; | 9 import 'package:analysis_server/src/protocol.dart' hide Element; |
| 10 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; | 10 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 // validate change | 926 // validate change |
| 927 return _assertSuccessfulRefactoring(r''' | 927 return _assertSuccessfulRefactoring(r''' |
| 928 class A { | 928 class A { |
| 929 foo() { | 929 foo() { |
| 930 print(0); | 930 print(0); |
| 931 } | 931 } |
| 932 } | 932 } |
| 933 '''); | 933 '''); |
| 934 } | 934 } |
| 935 | 935 |
| 936 test_method_this() { |
| 937 // TODO |
| 938 indexTestUnit(r''' |
| 939 class A { |
| 940 accept(B b) {} |
| 941 } |
| 942 class B { |
| 943 test(A a) { |
| 944 print(this); |
| 945 a.accept(this); |
| 946 } |
| 947 } |
| 948 main() { |
| 949 B b = new B(); |
| 950 A a = new A(); |
| 951 b.test(a); |
| 952 } |
| 953 '''); |
| 954 _createRefactoring('test(A a) {'); |
| 955 // validate change |
| 956 return _assertSuccessfulRefactoring(r''' |
| 957 class A { |
| 958 accept(B b) {} |
| 959 } |
| 960 class B { |
| 961 } |
| 962 main() { |
| 963 B b = new B(); |
| 964 A a = new A(); |
| 965 print(b); |
| 966 a.accept(b); |
| 967 } |
| 968 '''); |
| 969 } |
| 970 |
| 936 test_method_unqualifiedUnvocation() { | 971 test_method_unqualifiedUnvocation() { |
| 937 indexTestUnit(r''' | 972 indexTestUnit(r''' |
| 938 class A { | 973 class A { |
| 939 test(a, b) { | 974 test(a, b) { |
| 940 print(a); | 975 print(a); |
| 941 print(b); | 976 print(b); |
| 942 return a + b; | 977 return a + b; |
| 943 } | 978 } |
| 944 foo() { | 979 foo() { |
| 945 var v = test(1, 2); | 980 var v = test(1, 2); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 }); | 1419 }); |
| 1385 }); | 1420 }); |
| 1386 }); | 1421 }); |
| 1387 } | 1422 } |
| 1388 | 1423 |
| 1389 void _createRefactoring(String search) { | 1424 void _createRefactoring(String search) { |
| 1390 int offset = findOffset(search); | 1425 int offset = findOffset(search); |
| 1391 refactoring = new InlineMethodRefactoring(searchEngine, testUnit, offset); | 1426 refactoring = new InlineMethodRefactoring(searchEngine, testUnit, offset); |
| 1392 } | 1427 } |
| 1393 } | 1428 } |
| OLD | NEW |