File tree Expand file tree Collapse file tree 4 files changed +22
-18
lines changed Expand file tree Collapse file tree 4 files changed +22
-18
lines changed Original file line number Diff line number Diff line change 1+ ## 3.1.3-wip
2+
3+ * Don't force a space between ` ? ` and ` . ` if a null-aware element contains a
4+ dot shorthand.
5+
16## 3.1.2
27
38* Support dot shorthand syntax.
Original file line number Diff line number Diff line change @@ -1605,18 +1605,7 @@ final class AstNodeVisitor extends ThrowingAstVisitor<void> with PieceFactory {
16051605
16061606 @override
16071607 void visitNullAwareElement (NullAwareElement node) {
1608- // A null-aware element containing a dot shorthand means there is a `?` and
1609- // `.` next to each other. In that case, make sure we put a space between
1610- // them so that they don't incorrectly get collapsed into a `?.` null-aware
1611- // access token.
1612- var space = switch (node.value) {
1613- DotShorthandConstructorInvocation () => true ,
1614- DotShorthandInvocation () => true ,
1615- DotShorthandPropertyAccess () => true ,
1616- _ => false ,
1617- };
1618-
1619- writePrefix (node.question, space: space, node.value);
1608+ writePrefix (node.question, node.value);
16201609 }
16211610
16221611 @override
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 : 3.1.2
3+ version : 3.1.3-wip
44description : >-
55 Opinionated, automatic Dart source code formatter.
66 Provides an API and a CLI tool.
@@ -9,7 +9,7 @@ environment:
99 sdk : ^3.7.0
1010
1111dependencies :
12- analyzer : ^8.0 .0
12+ analyzer : ^8.1 .0
1313 args : ^2.0.0
1414 collection : ^1.19.0
1515 package_config : ^2.1.0
Original file line number Diff line number Diff line change @@ -31,13 +31,23 @@ var list = [
3131### If the space between `?` and `.` is removed, it would become a single `?.`
3232### token and thus a parse error.
3333var list = [
34- ? . property ,
34+ ?. property ,
3535 ? . invocation ( ) ,
3636 ? . new ( ) ,
3737];
3838<<< 3.10
3939var list = [
40- ? .property,
41- ? .invocation(),
42- ? .new(),
40+ ?.property,
41+ ?.invocation(),
42+ ?.new(),
4343];
44+ >>> (experiment dot-shorthands) Ambiguous dot shorthand versus null-aware.
45+ ### Because there is no space in "?.", it must be a null-aware access in a map.
46+ c = { e1 ?. e2 : e3 };
47+ <<< 3.10
48+ c = {e1?.e2: e3};
49+ >>> (experiment dot-shorthands) Ambiguous dot shorthand versus null-aware.
50+ ### Because there is a space in "? .", it must be a dot shorthand in a set.
51+ c = { e1 ? . e2 : e3 };
52+ <<< 3.10
53+ c = {e1 ? .e2 : e3};
You can’t perform that action at this time.
0 commit comments