| 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.correction.fix; | 5 library test.services.correction.fix; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
| 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; | 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; |
| (...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3271 DartFixKind.MAKE_CLASS_ABSTRACT, | 3271 DartFixKind.MAKE_CLASS_ABSTRACT, |
| 3272 ''' | 3272 ''' |
| 3273 abstract class A { | 3273 abstract class A { |
| 3274 m(); | 3274 m(); |
| 3275 } | 3275 } |
| 3276 abstract class B extends A { | 3276 abstract class B extends A { |
| 3277 } | 3277 } |
| 3278 '''); | 3278 '''); |
| 3279 } | 3279 } |
| 3280 | 3280 |
| 3281 test_makeFieldNotFinal_hasType() async { |
| 3282 resolveTestUnit(''' |
| 3283 class A { |
| 3284 final int fff = 1; |
| 3285 main() { |
| 3286 fff = 2; |
| 3287 } |
| 3288 } |
| 3289 '''); |
| 3290 await assertHasFix( |
| 3291 DartFixKind.MAKE_FIELD_NOT_FINAL, |
| 3292 ''' |
| 3293 class A { |
| 3294 int fff = 1; |
| 3295 main() { |
| 3296 fff = 2; |
| 3297 } |
| 3298 } |
| 3299 '''); |
| 3300 } |
| 3301 |
| 3302 test_makeFieldNotFinal_noType() async { |
| 3303 resolveTestUnit(''' |
| 3304 class A { |
| 3305 final fff = 1; |
| 3306 main() { |
| 3307 fff = 2; |
| 3308 } |
| 3309 } |
| 3310 '''); |
| 3311 await assertHasFix( |
| 3312 DartFixKind.MAKE_FIELD_NOT_FINAL, |
| 3313 ''' |
| 3314 class A { |
| 3315 var fff = 1; |
| 3316 main() { |
| 3317 fff = 2; |
| 3318 } |
| 3319 } |
| 3320 '''); |
| 3321 } |
| 3322 |
| 3281 test_noException_1() async { | 3323 test_noException_1() async { |
| 3282 resolveTestUnit(''' | 3324 resolveTestUnit(''' |
| 3283 main(p) { | 3325 main(p) { |
| 3284 p i s Null; | 3326 p i s Null; |
| 3285 }'''); | 3327 }'''); |
| 3286 List<AnalysisError> errors = context.computeErrors(testSource); | 3328 List<AnalysisError> errors = context.computeErrors(testSource); |
| 3287 for (var error in errors) { | 3329 for (var error in errors) { |
| 3288 await _computeFixes(error); | 3330 await _computeFixes(error); |
| 3289 } | 3331 } |
| 3290 } | 3332 } |
| (...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4772 int offset = resultCode.indexOf(search); | 4814 int offset = resultCode.indexOf(search); |
| 4773 positions.add(new Position(testFile, offset)); | 4815 positions.add(new Position(testFile, offset)); |
| 4774 } | 4816 } |
| 4775 return positions; | 4817 return positions; |
| 4776 } | 4818 } |
| 4777 | 4819 |
| 4778 void _performAnalysis() { | 4820 void _performAnalysis() { |
| 4779 while (context.performAnalysisTask().hasMoreWork); | 4821 while (context.performAnalysisTask().hasMoreWork); |
| 4780 } | 4822 } |
| 4781 } | 4823 } |
| OLD | NEW |