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

Side by Side Diff: pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart

Issue 913903002: Use async/await in refactorings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 services.src.refactoring; 5 library services.src.refactoring;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/protocol_server.dart' hide Element; 10 import 'package:analysis_server/src/protocol_server.dart' hide Element;
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 40
41 /** 41 /**
42 * Abstract implementation of [Refactoring]. 42 * Abstract implementation of [Refactoring].
43 */ 43 */
44 abstract class RefactoringImpl implements Refactoring { 44 abstract class RefactoringImpl implements Refactoring {
45 final List<String> potentialEditIds = <String>[]; 45 final List<String> potentialEditIds = <String>[];
46 46
47 @override 47 @override
48 Future<RefactoringStatus> checkAllConditions() { 48 Future<RefactoringStatus> checkAllConditions() async {
49 RefactoringStatus result = new RefactoringStatus(); 49 RefactoringStatus result = new RefactoringStatus();
50 return checkInitialConditions().then((status) { 50 result.addStatus(await checkInitialConditions());
51 result.addStatus(status); 51 if (result.hasFatalError) {
52 if (result.hasFatalError) { 52 return result;
53 return result; 53 }
54 } 54 result.addStatus(await checkFinalConditions());
55 return checkFinalConditions().then((status) { 55 return result;
56 result.addStatus(status);
57 return result;
58 });
59 });
60 } 56 }
61 } 57 }
62 58
63 59
64 /** 60 /**
65 * The [SourceRange] in some [Source]. 61 * The [SourceRange] in some [Source].
66 */ 62 */
67 class SourceReference { 63 class SourceReference {
68 final String file; 64 final String file;
69 final SourceRange range; 65 final SourceRange range;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 /** 99 /**
104 * Returns the [SourceEdit] to replace this reference. 100 * Returns the [SourceEdit] to replace this reference.
105 */ 101 */
106 SourceEdit createEdit(String newText, {String id}) { 102 SourceEdit createEdit(String newText, {String id}) {
107 return newSourceEdit_range(range, newText, id: id); 103 return newSourceEdit_range(range, newText, id: id);
108 } 104 }
109 105
110 @override 106 @override
111 String toString() => '${file}@${range}'; 107 String toString() => '${file}@${range}';
112 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698