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 engine.incremental_resolver_test; | 5 library engine.incremental_resolver_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 } | 1257 } |
1258 } | 1258 } |
1259 ''', r''' | 1259 ''', r''' |
1260 class A { | 1260 class A { |
1261 m(String p) { | 1261 m(String p) { |
1262 } | 1262 } |
1263 } | 1263 } |
1264 '''); | 1264 '''); |
1265 } | 1265 } |
1266 | 1266 |
| 1267 void test_false_method_parameters_type_edit_insertImportPrefix() { |
| 1268 _assertDoesNotMatchOK(r''' |
| 1269 import 'dart:async' as a; |
| 1270 |
| 1271 class C { |
| 1272 void foo(Future f) {} |
| 1273 } |
| 1274 |
| 1275 class Future {} |
| 1276 |
| 1277 bar(C c, a.Future f) { |
| 1278 c.foo(f); |
| 1279 } |
| 1280 ''', r''' |
| 1281 import 'dart:async' as a; |
| 1282 |
| 1283 class C { |
| 1284 void foo(a.Future f) {} |
| 1285 } |
| 1286 |
| 1287 class Future {} |
| 1288 |
| 1289 bar(C c, a.Future f) { |
| 1290 c.foo(f); |
| 1291 } |
| 1292 '''); |
| 1293 } |
| 1294 |
1267 void test_false_method_returnType_edit() { | 1295 void test_false_method_returnType_edit() { |
1268 _assertDoesNotMatchOK(r''' | 1296 _assertDoesNotMatchOK(r''' |
1269 class A { | 1297 class A { |
1270 int m() {} | 1298 int m() {} |
1271 } | 1299 } |
1272 ''', r''' | 1300 ''', r''' |
1273 class A { | 1301 class A { |
1274 String m() {} | 1302 String m() {} |
1275 } | 1303 } |
1276 '''); | 1304 '''); |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 m(F p) {} | 2223 m(F p) {} |
2196 } | 2224 } |
2197 ''', r''' | 2225 ''', r''' |
2198 typedef F(); | 2226 typedef F(); |
2199 class A { | 2227 class A { |
2200 m(F p) {} | 2228 m(F p) {} |
2201 } | 2229 } |
2202 '''); | 2230 '''); |
2203 } | 2231 } |
2204 | 2232 |
| 2233 void test_true_method_parameters_type_sameImportPrefix() { |
| 2234 _assertMatches(r''' |
| 2235 import 'dart:async' as a; |
| 2236 |
| 2237 bar(a.Future f) { |
| 2238 print(f); |
| 2239 } |
| 2240 ''', r''' |
| 2241 import 'dart:async' as a; |
| 2242 |
| 2243 bar(a.Future ff) { |
| 2244 print(ff); |
| 2245 } |
| 2246 '''); |
| 2247 } |
| 2248 |
2205 void test_true_part_list_reorder() { | 2249 void test_true_part_list_reorder() { |
2206 addNamedSource('/unitA.dart', 'part of lib; class A {}'); | 2250 addNamedSource('/unitA.dart', 'part of lib; class A {}'); |
2207 addNamedSource('/unitB.dart', 'part of lib; class B {}'); | 2251 addNamedSource('/unitB.dart', 'part of lib; class B {}'); |
2208 _assertMatches(r''' | 2252 _assertMatches(r''' |
2209 library lib; | 2253 library lib; |
2210 part 'unitA.dart'; | 2254 part 'unitA.dart'; |
2211 part 'unitB.dart'; | 2255 part 'unitB.dart'; |
2212 ''', r''' | 2256 ''', r''' |
2213 library lib; | 2257 library lib; |
2214 part 'unitB.dart'; | 2258 part 'unitB.dart'; |
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 return ResolutionContextBuilder.contextFor(node, listener).scope; | 4144 return ResolutionContextBuilder.contextFor(node, listener).scope; |
4101 } | 4145 } |
4102 } | 4146 } |
4103 | 4147 |
4104 class _Edit { | 4148 class _Edit { |
4105 final int offset; | 4149 final int offset; |
4106 final int length; | 4150 final int length; |
4107 final String replacement; | 4151 final String replacement; |
4108 _Edit(this.offset, this.length, this.replacement); | 4152 _Edit(this.offset, this.length, this.replacement); |
4109 } | 4153 } |
OLD | NEW |