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

Side by Side Diff: pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart

Issue 2722033002: Add an AST factory method for fieldDeclaration with all optional named parameters. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.testing.ast_test_factory; 5 library analyzer.src.generated.testing.ast_test_factory;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 464
465 static ExpressionStatement expressionStatement(Expression expression) => 465 static ExpressionStatement expressionStatement(Expression expression) =>
466 astFactory.expressionStatement( 466 astFactory.expressionStatement(
467 expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); 467 expression, TokenFactory.tokenFromType(TokenType.SEMICOLON));
468 468
469 static ExtendsClause extendsClause(TypeName type) => astFactory.extendsClause( 469 static ExtendsClause extendsClause(TypeName type) => astFactory.extendsClause(
470 TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type); 470 TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type);
471 471
472 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, 472 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword,
473 TypeAnnotation type, List<VariableDeclaration> variables) => 473 TypeAnnotation type, List<VariableDeclaration> variables) =>
474 astFactory.fieldDeclaration( 474 astFactory.fieldDeclaration2(
475 null, 475 staticKeyword:
476 null, 476 isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null,
477 isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null, 477 fieldList: variableDeclarationList(keyword, type, variables),
478 variableDeclarationList(keyword, type, variables), 478 semicolon: TokenFactory.tokenFromType(TokenType.SEMICOLON));
479 TokenFactory.tokenFromType(TokenType.SEMICOLON));
480 479
481 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, 480 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword,
482 List<VariableDeclaration> variables) => 481 List<VariableDeclaration> variables) =>
483 fieldDeclaration(isStatic, keyword, null, variables); 482 fieldDeclaration(isStatic, keyword, null, variables);
484 483
485 static FieldFormalParameter fieldFormalParameter( 484 static FieldFormalParameter fieldFormalParameter(
486 Keyword keyword, TypeAnnotation type, String identifier, 485 Keyword keyword, TypeAnnotation type, String identifier,
487 [FormalParameterList parameterList]) => 486 [FormalParameterList parameterList]) =>
488 astFactory.fieldFormalParameter( 487 astFactory.fieldFormalParameter(
489 null, 488 null,
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 expression, 1315 expression,
1317 TokenFactory.tokenFromType(TokenType.SEMICOLON)); 1316 TokenFactory.tokenFromType(TokenType.SEMICOLON));
1318 1317
1319 static YieldStatement yieldStatement(Expression expression) => 1318 static YieldStatement yieldStatement(Expression expression) =>
1320 astFactory.yieldStatement( 1319 astFactory.yieldStatement(
1321 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), 1320 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"),
1322 null, 1321 null,
1323 expression, 1322 expression,
1324 TokenFactory.tokenFromType(TokenType.SEMICOLON)); 1323 TokenFactory.tokenFromType(TokenType.SEMICOLON));
1325 } 1324 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698