From 99b1f617dcad173b3795e0d7f3a3057e40bdd829 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Wed, 1 Mar 2017 11:43:55 -0800 Subject: [PATCH] Mark not-optional-parameters methods of AstFactory as deprecated. ...and use non-deprecated versions in AstTestFactory. R=brianwilkerson@google.com, paulberry@google.com BUG= Review-Url: https://codereview.chromium.org/2726943002 . --- pkg/analyzer/lib/dart/ast/ast_factory.dart | 13 +++++++ .../generated/testing/ast_test_factory.dart | 35 +++++++++---------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart index a713a92ed2a..40a58307624 100644 --- a/pkg/analyzer/lib/dart/ast/ast_factory.dart +++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart @@ -83,6 +83,7 @@ abstract class AstFactory { */ BinaryExpression binaryExpression( Expression leftOperand, Token operator, Expression rightOperand); + /** * Returns a newly created block of code. */ @@ -407,7 +408,10 @@ abstract class AstFactory { * [comment] and [metadata] can be `null` if the declaration does not have the * corresponding attribute. The [staticKeyword] can be `null` if the field is * not a static field. + * + * Use [fieldDeclaration2] instead. */ + @deprecated FieldDeclaration fieldDeclaration(Comment comment, List metadata, Token staticKeyword, VariableDeclarationList fieldList, Token semicolon); @@ -433,7 +437,10 @@ abstract class AstFactory { * [period] can be `null` if the keyword 'this' was not provided. The * [parameters] can be `null` if this is not a function-typed field formal * parameter. + * + * Use [fieldFormalParameter2] instead. */ + @deprecated FieldFormalParameter fieldFormalParameter( Comment comment, List metadata, @@ -583,7 +590,10 @@ abstract class AstFactory { * [comment] and [metadata] can be `null` if the parameter does not have the * corresponding attribute. The [returnType] can be `null` if no return type * was specified. + * + * Use [functionTypedFormalParameter2] instead. */ + @deprecated FunctionTypedFormalParameter functionTypedFormalParameter( Comment comment, List metadata, @@ -921,7 +931,10 @@ abstract class AstFactory { * [comment] and [metadata] can be `null` if the parameter does not have the * corresponding attribute. The [keyword] can be `null` if a type was * specified. The [type] must be `null` if the keyword is 'var'. + * + * Use [simpleFormalParameter2] instead. */ + @deprecated SimpleFormalParameter simpleFormalParameter( Comment comment, List metadata, diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart index 9a5a4589a70..115bad594a6 100644 --- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart +++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart @@ -484,16 +484,14 @@ class AstTestFactory { static FieldFormalParameter fieldFormalParameter( Keyword keyword, TypeAnnotation type, String identifier, [FormalParameterList parameterList]) => - astFactory.fieldFormalParameter( - null, - null, - keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), - type, - TokenFactory.tokenFromKeyword(Keyword.THIS), - TokenFactory.tokenFromType(TokenType.PERIOD), - identifier3(identifier), - null, - parameterList); + astFactory.fieldFormalParameter2( + keyword: + keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), + type: type, + thisKeyword: TokenFactory.tokenFromKeyword(Keyword.THIS), + period: TokenFactory.tokenFromType(TokenType.PERIOD), + identifier: identifier3(identifier), + parameters: parameterList); static FieldFormalParameter fieldFormalParameter2(String identifier) => fieldFormalParameter(null, null, identifier); @@ -609,8 +607,10 @@ class AstTestFactory { static FunctionTypedFormalParameter functionTypedFormalParameter( TypeAnnotation returnType, String identifier, [List parameters]) => - astFactory.functionTypedFormalParameter(null, null, returnType, - identifier3(identifier), null, formalParameterList(parameters)); + astFactory.functionTypedFormalParameter2( + returnType: returnType, + identifier: identifier3(identifier), + parameters: formalParameterList(parameters)); static HideCombinator hideCombinator(List identifiers) => astFactory.hideCombinator( @@ -1065,12 +1065,11 @@ class AstTestFactory { static SimpleFormalParameter simpleFormalParameter2( Keyword keyword, TypeAnnotation type, String parameterName) => - astFactory.simpleFormalParameter( - null, - null, - keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), - type, - identifier3(parameterName)); + astFactory.simpleFormalParameter2( + keyword: + keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), + type: type, + identifier: identifier3(parameterName)); static SimpleFormalParameter simpleFormalParameter3(String parameterName) => simpleFormalParameter2(null, null, parameterName);