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

Unified Diff: pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart

Issue 2910683002: Update some of the fixes to use ChangeBuilder (Closed)
Patch Set: Adjusted after API change, and bug fix Created 3 years, 7 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
« no previous file with comments | « pkg/analysis_server/test/services/correction/fix_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
index c94b60ba28b6076486f2d4def024b813176ddd99..7100c76c47292de336d81ffcf4effb1eb0e8ab7d 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
@@ -1031,7 +1031,11 @@ class DartFileEditBuilderImpl extends FileEditBuilderImpl
type is InterfaceType && type.element == futureType.element) {
return;
}
- futureType = futureType.instantiate(<DartType>[type]);
+ // TODO(brianwilkerson) Unconditionally execute the body of the 'if' when
+ // Future<void> is fully supported.
+ if (!type.isVoid) {
+ futureType = futureType.instantiate(<DartType>[type]);
+ }
// prepare code for the types
addReplacement(range.node(typeAnnotation), (EditBuilder builder) {
if (!(builder as DartEditBuilder).writeType(futureType)) {
@@ -1142,8 +1146,8 @@ class DartFileEditBuilderImpl extends FileEditBuilderImpl
}
/**
- * Returns a [InsertDesc] describing where to insert a new directive or a
- * top-level declaration at the top of the file.
+ * Returns an insertion description describing where to insert a new directive
+ * or a top-level declaration at the top of the file.
*/
_InsertionDescription _getInsertDescTop() {
// skip leading line comments
@@ -1187,7 +1191,7 @@ class DartFileEditBuilderImpl extends FileEditBuilderImpl
}
// determine if empty line is required after
int currentLine = lineInfo.getLocation(offset).lineNumber;
- if (currentLine < lineInfo.lineCount) {
+ if (currentLine + 1 < lineInfo.lineCount) {
int nextLineOffset = lineInfo.getOffsetOfLine(currentLine + 1);
String insertLine = source.substring(offset, nextLineOffset);
if (!insertLine.trim().isEmpty) {
« no previous file with comments | « pkg/analysis_server/test/services/correction/fix_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698