Skip to content

Commit 4506ac5

Browse files
authored
Remove non-working constraint between metadata and parameters. (#1159)
I believe the *intent* of these constraints is that if a parameter list splits then the metadata before each parameters split too. With these, instead of: function( @anno param, @anno param, @anno param) { Where the parameters can split while leaving the annotations alone, the annotations are forced to split too: function( @anno param, @anno param, @anno param) { But... 1. These constraints don't appear to do that. 2. There are no tests that they would do that. In fact, all the tests pass with these lines removed. 3. And when I format a large corpus with these lines removed, there are no differences versus when them included. They don't appear to do anything. 4. Most importantly, it seems that the current style is to allow a parameter list to split while keeping annotations. So even if I were to fix this code so that it does what (I think) it was supposed to, it's probably not what people want. So just removing it.
1 parent 8d8db4b commit 4506ac5

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

lib/src/source_visitor.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,6 @@ class SourceVisitor extends ThrowingAstVisitor {
13261326
PositionalRule? rule;
13271327
if (requiredParams.isNotEmpty) {
13281328
rule = PositionalRule(null, argumentCount: requiredParams.length);
1329-
_metadataRules.last.constrainWhenFullySplit(rule);
13301329

13311330
builder.startRule(rule);
13321331
if (node.isFunctionExpressionBody) {
@@ -1354,7 +1353,6 @@ class SourceVisitor extends ThrowingAstVisitor {
13541353

13551354
if (optionalParams.isNotEmpty) {
13561355
var namedRule = NamedRule(null, 0, 0);
1357-
_metadataRules.last.constrainWhenFullySplit(namedRule);
13581356
if (rule != null) rule.addNamedArgsConstraints(namedRule);
13591357

13601358
builder.startRule(namedRule);

0 commit comments

Comments
 (0)