Add support for metadata on enum cases. (#690)
Fix #688.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea510df..69f420d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 1.0.14
+
+* Support metadata on enum cases (#688).
+
# 1.0.13
* Support the latest release of `package:analyzer`.
diff --git a/bin/format.dart b/bin/format.dart
index 951524f..4863218 100644
--- a/bin/format.dart
+++ b/bin/format.dart
@@ -14,7 +14,7 @@
import 'package:dart_style/src/source_code.dart';
// Note: The following line of code is modified by tool/grind.dart.
-const version = "1.0.13";
+const version = "1.0.14";
void main(List<String> args) {
var parser = new ArgParser(allowTrailingOptions: true);
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index 277ad00..4103c72 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -886,6 +886,7 @@
}
visitEnumConstantDeclaration(EnumConstantDeclaration node) {
+ visitMetadata(node.metadata);
visit(node.name);
}
diff --git a/pubspec.lock b/pubspec.lock
index fd1be30..431e302 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -366,4 +366,4 @@
source: hosted
version: "2.1.13"
sdks:
- dart: ">=2.0.0-dev.54.0 <=2.0.0-dev.55.0"
+ dart: ">=2.0.0-dev.54.0 <=2.0.0-edge.ba342a94ecd08c183b6ea0b4dab33e47bb8dadd5"
diff --git a/pubspec.yaml b/pubspec.yaml
index b5c7fb3..6e403d7 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: dart_style
# Note: See tool/grind.dart for how to bump the version.
-version: 1.0.13
+version: 1.0.14
author: Dart Team <misc@dartlang.org>
description: Opinionated, automatic Dart source code formatter.
homepage: https://github.com/dart-lang/dart_style
diff --git a/test/whitespace/metadata.unit b/test/whitespace/metadata.unit
index e98b36b..52101ad 100644
--- a/test/whitespace/metadata.unit
+++ b/test/whitespace/metadata.unit
@@ -291,4 +291,26 @@
expression) {
;
}
+}
+>>> metadata on enum cases
+enum Foo { a, @meta b, @meta1 @meta2 c}
+<<<
+enum Foo {
+ a,
+ @meta
+ b,
+ @meta1
+ @meta2
+ c
+}
+>>> preserve blank line before enum case with metadata
+enum Foo { a,
+
+@meta b}
+<<<
+enum Foo {
+ a,
+
+ @meta
+ b
}
\ No newline at end of file