From 489da26a8ffd40c05599fefc4908491d79834206 Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Tue, 3 Oct 2023 12:21:13 +0200 Subject: [PATCH] Address comments by removing comments. --- lib/src/source_visitor.dart | 7 --- test/whitespace/extension_types.unit | 64 ++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart index 69b9ff0b..9d1b10b0 100644 --- a/lib/src/source_visitor.dart +++ b/lib/src/source_visitor.dart @@ -2631,8 +2631,6 @@ class SourceVisitor extends ThrowingAstVisitor { @override void visitRepresentationDeclaration(RepresentationDeclaration node) { - // Consider having `node.asFormalParameterList()`, and format based on that. - visit(node.constructorName); token(node.leftParenthesis); @@ -2646,11 +2644,7 @@ class SourceVisitor extends ThrowingAstVisitor { builder.startBlockArgumentNesting(); builder.startSpan(); - // Inline `visitFormalParameterList`, remove all that doesn't apply - // to a required positional parameter with no modifiers - // and no trailing comma. visitParameterMetadata(node.fieldMetadata, () { - // Inline `_beginFormalParameter` builder.startLazyRule(Rule(Cost.parameterType)); builder.nestExpression(); @@ -2658,7 +2652,6 @@ class SourceVisitor extends ThrowingAstVisitor { _separatorBetweenTypeAndVariable(node.fieldType); token(node.fieldName); - // Inline `_endFormalParameter` builder.unnest(); builder.endRule(); }); diff --git a/test/whitespace/extension_types.unit b/test/whitespace/extension_types.unit index 421da6f2..dd93fbbb 100644 --- a/test/whitespace/extension_types.unit +++ b/test/whitespace/extension_types.unit @@ -32,7 +32,7 @@ extension type A(int a) { } <<< extension type A(int a) {} ->>> leading space before "class" +>>> leading space before "extension type" extension type A(int a) { } <<< @@ -110,8 +110,66 @@ extension type +const +A -A(int a){} +< + +T + +> + +. + +name + +( + +int + +a + +) + +{ + +} <<< -extension type A(int a) {} +extension type const A.name(int a) {} +>>> Supports all members except instance fields +extension type const A.name(int a) { + static const int c = 1; + static final int f = 1; + static late final int l; + static var v; + static int get g => c; + static set g(int i) {} + static int m(X x) => c; + const A(int a) : this.a = a; + const A.r(int a) : this(a); + const factory A.rf(int a) = A; + factory A.f(int a) => A(a); + int get pr => 0; + set pr(int x) {} + int me(int x) => x; + int operator+(int x) => x; +} +<<< +extension type const A.name(int a) { + static const int c = 1; + static final int f = 1; + static late final int l; + static var v; + static int get g => c; + static set g(int i) {} + static int m(X x) => c; + const A(int a) : this.a = a; + const A.r(int a) : this(a); + const factory A.rf(int a) = A; + factory A.f(int a) => A(a); + int get pr => 0; + set pr(int x) {} + int me(int x) => x; + int operator +(int x) => x; +} \ No newline at end of file