Skip to content

Commit f210011

Browse files
authored
Add support for metadata on enum cases. (flutter#690)
Fix flutter#688.
1 parent fab102b commit f210011

File tree

6 files changed

+30
-3
lines changed

6 files changed

+30
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.14
2+
3+
* Support metadata on enum cases (#688).
4+
15
# 1.0.13
26

37
* Support the latest release of `package:analyzer`.

bin/format.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:dart_style/src/io.dart';
1414
import 'package:dart_style/src/source_code.dart';
1515

1616
// Note: The following line of code is modified by tool/grind.dart.
17-
const version = "1.0.13";
17+
const version = "1.0.14";
1818

1919
void main(List<String> args) {
2020
var parser = new ArgParser(allowTrailingOptions: true);

lib/src/source_visitor.dart

+1
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ class SourceVisitor extends ThrowingAstVisitor {
886886
}
887887

888888
visitEnumConstantDeclaration(EnumConstantDeclaration node) {
889+
visitMetadata(node.metadata);
889890
visit(node.name);
890891
}
891892

pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,4 +366,4 @@ packages:
366366
source: hosted
367367
version: "2.1.13"
368368
sdks:
369-
dart: ">=2.0.0-dev.54.0 <=2.0.0-dev.55.0"
369+
dart: ">=2.0.0-dev.54.0 <=2.0.0-edge.ba342a94ecd08c183b6ea0b4dab33e47bb8dadd5"

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dart_style
22
# Note: See tool/grind.dart for how to bump the version.
3-
version: 1.0.13
3+
version: 1.0.14
44
author: Dart Team <[email protected]>
55
description: Opinionated, automatic Dart source code formatter.
66
homepage: https://github.com/dart-lang/dart_style

test/whitespace/metadata.unit

+22
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,26 @@ main() {
291291
expression) {
292292
;
293293
}
294+
}
295+
>>> metadata on enum cases
296+
enum Foo { a, @meta b, @meta1 @meta2 c}
297+
<<<
298+
enum Foo {
299+
a,
300+
@meta
301+
b,
302+
@meta1
303+
@meta2
304+
c
305+
}
306+
>>> preserve blank line before enum case with metadata
307+
enum Foo { a,
308+
309+
@meta b}
310+
<<<
311+
enum Foo {
312+
a,
313+
314+
@meta
315+
b
294316
}

0 commit comments

Comments
 (0)