Chromium Code Reviews| 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 6ce511f8ff170230ee601b8cdabf224badcdec4c..b1a48551789547ba77284b44c9edaa42a7a1c770 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 |
| @@ -1012,7 +1012,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) { |
|
scheglov
2017/05/26 16:30:04
Use Future<Null> instead of Future<void> for now?
Brian Wilkerson
2017/05/30 13:15:12
If this is important, I can fix it in a follow-up
|
| + futureType = futureType.instantiate(<DartType>[type]); |
| + } |
| // prepare code for the types |
| addReplacement(range.node(typeAnnotation), (EditBuilder builder) { |
| if (!(builder as DartEditBuilder).writeType(futureType)) { |
| @@ -1123,8 +1127,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 |
| @@ -1168,7 +1172,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) { |