Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: pkg/analyzer/test/generated/ast_test.dart

Issue 1408923002: Include parameter annotations in toSource (issue 24578) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/ast_test.dart
diff --git a/pkg/analyzer/test/generated/ast_test.dart b/pkg/analyzer/test/generated/ast_test.dart
index e7c20255f53cbb876a89c0f773e0f6d578466b12..e25c2533727cf2793abef1e2b014ad112002db9c 100644
--- a/pkg/analyzer/test/generated/ast_test.dart
+++ b/pkg/analyzer/test/generated/ast_test.dart
@@ -2318,6 +2318,13 @@ class ToSourceVisitorTest extends EngineTestCase {
AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)));
}
+ void test_visitDefaultFormalParameter_annotation() {
+ DefaultFormalParameter parameter = AstFactory.positionalFormalParameter(
+ AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0));
+ parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ _assertSource('@A p = 0', parameter);
+ }
+
void test_visitDoStatement() {
_assertSource(
"do {} while (c);",
@@ -2460,6 +2467,12 @@ class ToSourceVisitorTest extends EngineTestCase {
AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a"));
}
+ void test_visitFieldFormalParameter_annotation() {
+ FieldFormalParameter parameter = AstFactory.fieldFormalParameter2('f');
+ parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ _assertSource('@A this.f', parameter);
+ }
+
void test_visitForEachStatement_declared() {
_assertSource(
"for (var a in b) {}",
@@ -2898,6 +2911,12 @@ class ToSourceVisitorTest extends EngineTestCase {
_assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f"));
}
+ void test_visitFunctionTypedFormalParameter_annotation() {
+ FunctionTypedFormalParameter parameter = AstFactory.functionTypedFormalParameter(null, "f");
+ parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ _assertSource('@A f()', parameter);
+ }
+
void test_visitFunctionTypedFormalParameter_type() {
_assertSource(
"T f()",
@@ -3521,6 +3540,12 @@ class ToSourceVisitorTest extends EngineTestCase {
AstFactory.simpleFormalParameter4(AstFactory.typeName4("A"), "a"));
}
+ void test_visitSimpleFormalParameter_annotation() {
+ SimpleFormalParameter parameter = AstFactory.simpleFormalParameter3('x');
+ parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ _assertSource('@A x', parameter);
+ }
+
void test_visitSimpleIdentifier() {
_assertSource("a", AstFactory.identifier3("a"));
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698