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

Unified Diff: pkg/analysis_server/lib/src/services/refactoring/inline_local.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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/services/refactoring/inline_local.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/inline_local.dart b/pkg/analysis_server/lib/src/services/refactoring/inline_local.dart
index 2c4e11525fad771a3ea62a9c8d88765fda0ff705..064021a3094852b7728d8f11521b57c32a427d8a 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/inline_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/inline_local.dart
@@ -66,7 +66,7 @@ class InlineLocalRefactoringImpl extends RefactoringImpl implements
}
@override
- Future<RefactoringStatus> checkInitialConditions() {
+ Future<RefactoringStatus> checkInitialConditions() async {
RefactoringStatus result = new RefactoringStatus();
// prepare variable
{
@@ -96,22 +96,20 @@ class InlineLocalRefactoringImpl extends RefactoringImpl implements
return new Future.value(result);
}
// prepare references
- return searchEngine.searchReferences(_variableElement).then((references) {
- this._references = references;
- // should not have assignments
- for (SearchMatch reference in _references) {
- if (reference.kind != MatchKind.READ) {
- String message = format(
- "Local variable '{0}' is assigned more than once.",
- [_variableElement.displayName]);
- return new RefactoringStatus.fatal(
- message,
- newLocation_fromMatch(reference));
- }
+ _references = await searchEngine.searchReferences(_variableElement);
+ // should not have assignments
+ for (SearchMatch reference in _references) {
+ if (reference.kind != MatchKind.READ) {
+ String message = format(
+ "Local variable '{0}' is assigned more than once.",
+ [_variableElement.displayName]);
+ return new RefactoringStatus.fatal(
+ message,
+ newLocation_fromMatch(reference));
}
- // done
- return result;
- });
+ }
+ // done
+ return result;
}
@override

Powered by Google App Engine
This is Rietveld 408576698