| 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 edit.domain; | 5 library edit.domain; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/collections.dart'; |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 11 import 'package:analysis_server/src/constants.dart'; |
| 11 import 'package:analysis_server/src/protocol.dart' hide Element; | 12 import 'package:analysis_server/src/protocol.dart' hide Element; |
| 12 import 'package:analysis_server/src/services/correction/assist.dart'; | 13 import 'package:analysis_server/src/services/correction/assist.dart'; |
| 13 import 'package:analysis_server/src/services/correction/fix.dart'; | 14 import 'package:analysis_server/src/services/correction/fix.dart'; |
| 14 import 'package:analysis_server/src/services/correction/sort_members.dart'; | 15 import 'package:analysis_server/src/services/correction/sort_members.dart'; |
| 15 import 'package:analysis_server/src/services/correction/status.dart'; | 16 import 'package:analysis_server/src/services/correction/status.dart'; |
| 16 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 17 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 17 import 'package:analysis_server/src/services/search/search_engine.dart'; | 18 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 18 import 'package:analyzer/src/generated/ast.dart'; | 19 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 274 } |
| 274 // validation and create change | 275 // validation and create change |
| 275 refactoring.checkFinalConditions().then((_finalStatus) { | 276 refactoring.checkFinalConditions().then((_finalStatus) { |
| 276 finalStatus = _finalStatus; | 277 finalStatus = _finalStatus; |
| 277 if (_hasFatalError) { | 278 if (_hasFatalError) { |
| 278 return _sendResultResponse(); | 279 return _sendResultResponse(); |
| 279 } | 280 } |
| 280 // create change | 281 // create change |
| 281 return refactoring.createChange().then((change) { | 282 return refactoring.createChange().then((change) { |
| 282 result.change = change; | 283 result.change = change; |
| 283 if (!refactoring.potentialEditIds.isEmpty) { | 284 result.potentialEdits = nullIfEmpty(refactoring.potentialEditIds); |
| 284 result.potentialEdits = refactoring.potentialEditIds; | |
| 285 } | |
| 286 return _sendResultResponse(); | 285 return _sendResultResponse(); |
| 287 }); | 286 }); |
| 288 }); | 287 }); |
| 289 }); | 288 }); |
| 290 } | 289 } |
| 291 | 290 |
| 292 /** | 291 /** |
| 293 * Initializes this context to perform a refactoring with the specified | 292 * Initializes this context to perform a refactoring with the specified |
| 294 * parameters. The existing [Refactoring] is reused or created as needed. | 293 * parameters. The existing [Refactoring] is reused or created as needed. |
| 295 */ | 294 */ |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 } | 491 } |
| 493 if (refactoring is RenameRefactoring) { | 492 if (refactoring is RenameRefactoring) { |
| 494 RenameRefactoring renameRefactoring = refactoring; | 493 RenameRefactoring renameRefactoring = refactoring; |
| 495 RenameOptions renameOptions = params.options; | 494 RenameOptions renameOptions = params.options; |
| 496 renameRefactoring.newName = renameOptions.newName; | 495 renameRefactoring.newName = renameOptions.newName; |
| 497 return renameRefactoring.checkNewName(); | 496 return renameRefactoring.checkNewName(); |
| 498 } | 497 } |
| 499 return new RefactoringStatus(); | 498 return new RefactoringStatus(); |
| 500 } | 499 } |
| 501 } | 500 } |
| OLD | NEW |