File tree 6 files changed +28
-7
lines changed 6 files changed +28
-7
lines changed Original file line number Diff line number Diff line change 1
- ## 2.3.6-wip
1
+ ## 2.3.6
2
2
3
- There are no user-visible changes in this release. The only changes are behind
4
- the ` tall-style ` experiment flag.
3
+ * Fix compile error when using dart_style with analyzer 6.2.0.
5
4
6
5
## 2.3.5
7
6
Original file line number Diff line number Diff line change @@ -409,3 +409,25 @@ extension PatternExtensions on DartPattern {
409
409
_ => false ,
410
410
};
411
411
}
412
+
413
+ // TODO(rnystrom): This is a gross hack because dart_style 2.3.5 has a bad
414
+ // analyzer constraint which allows dart_style to be used with a version of
415
+ // analyzer that doesn't publicly expose the `.macroKeyword` getter.
416
+ // Fortunately, the oldest analyzer that dart_style allows *does* have the
417
+ // getter on the ClassDeclarationImpl class.
418
+ //
419
+ // To get users off that bad version, we're publishing a new version of
420
+ // dart_style that has the same constraint and gracefully handles that getter
421
+ // not statically being visible.
422
+ //
423
+ // This hack will be removed immediately after publishing a version with that
424
+ // fix.
425
+ extension ClassDeclarationExtensions on ClassDeclaration {
426
+ /// If the [ClassDeclaration] is from a version of analyzer that has the
427
+ /// `macroKeyword` getter and the class has a `macro` keyword, returns that
428
+ /// token.
429
+ ///
430
+ /// Otherwise, returns `null` .
431
+ Token ? get hackMacroKeywordForOlderAnalyzer =>
432
+ (this as dynamic ).macroKeyword as Token ? ;
433
+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import 'show.dart';
11
11
import 'summary.dart' ;
12
12
13
13
// Note: The following line of code is modified by tool/grind.dart.
14
- const dartStyleVersion = '2.3.5 ' ;
14
+ const dartStyleVersion = '2.3.6 ' ;
15
15
16
16
/// Global options that affect how the formatter produces and uses its outputs.
17
17
class FormatterOptions {
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ class AstNodeVisitor extends ThrowingAstVisitor<Piece> with PieceFactory {
248
248
node.interfaceKeyword,
249
249
node.finalKeyword,
250
250
node.sealedKeyword,
251
- node.macroKeyword ,
251
+ node.hackMacroKeywordForOlderAnalyzer ,
252
252
node.mixinKeyword,
253
253
node.classKeyword,
254
254
],
Original file line number Diff line number Diff line change @@ -592,7 +592,7 @@ class SourceVisitor extends ThrowingAstVisitor {
592
592
modifier (node.finalKeyword);
593
593
modifier (node.sealedKeyword);
594
594
modifier (node.mixinKeyword);
595
- modifier (node.macroKeyword );
595
+ modifier (node.hackMacroKeywordForOlderAnalyzer );
596
596
token (node.classKeyword);
597
597
space ();
598
598
token (node.name);
Original file line number Diff line number Diff line change 1
1
name : dart_style
2
2
# Note: See tool/grind.dart for how to bump the version.
3
- version : 2.3.6-wip
3
+ version : 2.3.6
4
4
description : >-
5
5
Opinionated, automatic Dart source code formatter.
6
6
Provides an API and a CLI tool.
You can’t perform that action at this time.
0 commit comments