diff --git a/CHANGELOG.md b/CHANGELOG.md index c216a92..ce78a4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.8.1 + +* Emit empty line comments as empty lines. + ## 4.8.0 * Add `Expression.operatorSubtract` diff --git a/lib/src/emitter.dart b/lib/src/emitter.dart index 591b992..249ed0e 100644 --- a/lib/src/emitter.dart +++ b/lib/src/emitter.dart @@ -479,7 +479,9 @@ class DartEmitter extends Object output ??= StringBuffer(); if (spec.comments.isNotEmpty) { - spec.comments.map((line) => '// $line').forEach(output.writeln); + spec.comments + .map((line) => line.isEmpty ? '' : '// $line') + .forEach(output.writeln); output.writeln(); } diff --git a/pubspec.yaml b/pubspec.yaml index 0d26965..93f7da1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: code_builder -version: 4.8.0 +version: 4.8.1 description: >- A fluent, builder-based library for generating valid Dart code repository: https://github.com/dart-lang/code_builder diff --git a/test/specs/library_test.dart b/test/specs/library_test.dart index 3c5502e..822188b 100644 --- a/test/specs/library_test.dart +++ b/test/specs/library_test.dart @@ -45,7 +45,7 @@ void main() { ), equalsDart(r''' // Generated by foo! - // + // Avoid editing by hand. class Foo { }