File tree Expand file tree Collapse file tree 6 files changed +28
-7
lines changed Expand file tree Collapse file tree 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
22
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.
54
65## 2.3.5
76
Original file line number Diff line number Diff line change @@ -409,3 +409,25 @@ extension PatternExtensions on DartPattern {
409409 _ => false ,
410410 };
411411}
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';
1111import 'summary.dart' ;
1212
1313// Note: The following line of code is modified by tool/grind.dart.
14- const dartStyleVersion = '2.3.5 ' ;
14+ const dartStyleVersion = '2.3.6 ' ;
1515
1616/// Global options that affect how the formatter produces and uses its outputs.
1717class FormatterOptions {
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ class AstNodeVisitor extends ThrowingAstVisitor<Piece> with PieceFactory {
248248 node.interfaceKeyword,
249249 node.finalKeyword,
250250 node.sealedKeyword,
251- node.macroKeyword ,
251+ node.hackMacroKeywordForOlderAnalyzer ,
252252 node.mixinKeyword,
253253 node.classKeyword,
254254 ],
Original file line number Diff line number Diff line change @@ -592,7 +592,7 @@ class SourceVisitor extends ThrowingAstVisitor {
592592 modifier (node.finalKeyword);
593593 modifier (node.sealedKeyword);
594594 modifier (node.mixinKeyword);
595- modifier (node.macroKeyword );
595+ modifier (node.hackMacroKeywordForOlderAnalyzer );
596596 token (node.classKeyword);
597597 space ();
598598 token (node.name);
Original file line number Diff line number Diff line change 11name : dart_style
22# Note: See tool/grind.dart for how to bump the version.
3- version : 2.3.6-wip
3+ version : 2.3.6
44description : >-
55 Opinionated, automatic Dart source code formatter.
66 Provides an API and a CLI tool.
You can’t perform that action at this time.
0 commit comments