diff --git a/CHANGELOG.md b/CHANGELOG.md index ec6d955f..84a0e4b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Format patterns and related features. * Format record expressions and record type annotations. * Format class modifiers `base`, `final`, `interface`, `mixin`, and `sealed`. +* Format `inline class` declarations. * Format unnamed libraries. ## Bug fixes and style changes @@ -20,7 +21,7 @@ * Fix metadata test to not fail when record syntax makes whitespace between metadata annotation names and `(` significant ([sdk#50769][]). * Require Dart 2.19. -* Require `package:analyzer` `^5.1.0`. +* Require `package:analyzer` `^5.7.0`. [sdk#50769]: https://github.com/dart-lang/sdk/issues/50769 @@ -47,7 +48,7 @@ * Don't allow a line comment in an argument list to cause preceding arguments to be misformatted. * Remove blank lines after a line comment at the end of a body. -* Require `package:analyzer` `>=4.4.0 <6.0.0`. +* Require `package:analyzer` `>=4.4.0 <6.0.0`. # 2.2.3 diff --git a/lib/src/dart_formatter.dart b/lib/src/dart_formatter.dart index 3290a684..30ea1064 100644 --- a/lib/src/dart_formatter.dart +++ b/lib/src/dart_formatter.dart @@ -206,6 +206,7 @@ class DartFormatter { var featureSet = FeatureSet.fromEnableFlags2( sdkLanguageVersion: Version(2, 19, 0), flags: [ + 'inline-class', 'class-modifiers', if (patterns) 'patterns', 'records', diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart index 43c691b5..0a026baa 100644 --- a/lib/src/source_visitor.dart +++ b/lib/src/source_visitor.dart @@ -588,6 +588,7 @@ class SourceVisitor extends ThrowingAstVisitor { modifier(node.finalKeyword); modifier(node.sealedKeyword); modifier(node.mixinKeyword); + modifier(node.inlineKeyword); token(node.classKeyword); space(); token(node.name); diff --git a/pubspec.yaml b/pubspec.yaml index f63e106b..8b4fc886 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,7 +9,7 @@ environment: sdk: ">=2.19.0 <3.0.0" dependencies: - analyzer: ^5.6.0 + analyzer: ^5.7.0 args: ">=1.0.0 <3.0.0" path: ^1.0.0 pub_semver: ">=1.4.4 <3.0.0" diff --git a/test/whitespace/classes.unit b/test/whitespace/classes.unit index 8702c189..d1b6d44c 100644 --- a/test/whitespace/classes.unit +++ b/test/whitespace/classes.unit @@ -243,4 +243,8 @@ base mixin class C11 = Object abstract mixin class C12 = Object with Mixin; abstract base mixin class C13 = Object - with Mixin; \ No newline at end of file + with Mixin; +>>> inline classes +inline class C {} +<<< +inline class C {} \ No newline at end of file