| OLD | NEW |
| 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 27 matching lines...) Expand all Loading... |
| 38 constructorName == null | 38 constructorName == null |
| 39 ? null | 39 ? null |
| 40 : TokenFactory.tokenFromType(TokenType.PERIOD), | 40 : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 41 constructorName, | 41 constructorName, |
| 42 arguments); | 42 arguments); |
| 43 | 43 |
| 44 static ArgumentList argumentList([List<Expression> arguments]) => | 44 static ArgumentList argumentList([List<Expression> arguments]) => |
| 45 astFactory.argumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 45 astFactory.argumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 46 arguments, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); | 46 arguments, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); |
| 47 | 47 |
| 48 static AsExpression asExpression(Expression expression, TypeName type) => | 48 static AsExpression asExpression( |
| 49 Expression expression, TypeAnnotation type) => |
| 49 astFactory.asExpression( | 50 astFactory.asExpression( |
| 50 expression, TokenFactory.tokenFromKeyword(Keyword.AS), type); | 51 expression, TokenFactory.tokenFromKeyword(Keyword.AS), type); |
| 51 | 52 |
| 52 static AssertStatement assertStatement(Expression condition, | 53 static AssertStatement assertStatement(Expression condition, |
| 53 [Expression message]) => | 54 [Expression message]) => |
| 54 astFactory.assertStatement( | 55 astFactory.assertStatement( |
| 55 TokenFactory.tokenFromKeyword(Keyword.ASSERT), | 56 TokenFactory.tokenFromKeyword(Keyword.ASSERT), |
| 56 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 57 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 57 condition, | 58 condition, |
| 58 message == null ? null : TokenFactory.tokenFromType(TokenType.COMMA), | 59 message == null ? null : TokenFactory.tokenFromType(TokenType.COMMA), |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 152 |
| 152 static CatchClause catchClause(String exceptionParameter, | 153 static CatchClause catchClause(String exceptionParameter, |
| 153 [List<Statement> statements]) => | 154 [List<Statement> statements]) => |
| 154 catchClause5(null, exceptionParameter, null, statements); | 155 catchClause5(null, exceptionParameter, null, statements); |
| 155 | 156 |
| 156 static CatchClause catchClause2( | 157 static CatchClause catchClause2( |
| 157 String exceptionParameter, String stackTraceParameter, | 158 String exceptionParameter, String stackTraceParameter, |
| 158 [List<Statement> statements]) => | 159 [List<Statement> statements]) => |
| 159 catchClause5(null, exceptionParameter, stackTraceParameter, statements); | 160 catchClause5(null, exceptionParameter, stackTraceParameter, statements); |
| 160 | 161 |
| 161 static CatchClause catchClause3(TypeName exceptionType, | 162 static CatchClause catchClause3(TypeAnnotation exceptionType, |
| 162 [List<Statement> statements]) => | 163 [List<Statement> statements]) => |
| 163 catchClause5(exceptionType, null, null, statements); | 164 catchClause5(exceptionType, null, null, statements); |
| 164 | 165 |
| 165 static CatchClause catchClause4( | 166 static CatchClause catchClause4( |
| 166 TypeName exceptionType, String exceptionParameter, | 167 TypeAnnotation exceptionType, String exceptionParameter, |
| 167 [List<Statement> statements]) => | 168 [List<Statement> statements]) => |
| 168 catchClause5(exceptionType, exceptionParameter, null, statements); | 169 catchClause5(exceptionType, exceptionParameter, null, statements); |
| 169 | 170 |
| 170 static CatchClause catchClause5(TypeName exceptionType, | 171 static CatchClause catchClause5(TypeAnnotation exceptionType, |
| 171 String exceptionParameter, String stackTraceParameter, | 172 String exceptionParameter, String stackTraceParameter, |
| 172 [List<Statement> statements]) => | 173 [List<Statement> statements]) => |
| 173 astFactory.catchClause( | 174 astFactory.catchClause( |
| 174 exceptionType == null | 175 exceptionType == null |
| 175 ? null | 176 ? null |
| 176 : TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "on"), | 177 : TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "on"), |
| 177 exceptionType, | 178 exceptionType, |
| 178 exceptionParameter == null | 179 exceptionParameter == null |
| 179 ? null | 180 ? null |
| 180 : TokenFactory.tokenFromKeyword(Keyword.CATCH), | 181 : TokenFactory.tokenFromKeyword(Keyword.CATCH), |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 astFactory.continueStatement( | 361 astFactory.continueStatement( |
| 361 TokenFactory.tokenFromKeyword(Keyword.CONTINUE), | 362 TokenFactory.tokenFromKeyword(Keyword.CONTINUE), |
| 362 label == null ? null : identifier3(label), | 363 label == null ? null : identifier3(label), |
| 363 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 364 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 364 | 365 |
| 365 static DeclaredIdentifier declaredIdentifier( | 366 static DeclaredIdentifier declaredIdentifier( |
| 366 Keyword keyword, String identifier) => | 367 Keyword keyword, String identifier) => |
| 367 declaredIdentifier2(keyword, null, identifier); | 368 declaredIdentifier2(keyword, null, identifier); |
| 368 | 369 |
| 369 static DeclaredIdentifier declaredIdentifier2( | 370 static DeclaredIdentifier declaredIdentifier2( |
| 370 Keyword keyword, TypeName type, String identifier) => | 371 Keyword keyword, TypeAnnotation type, String identifier) => |
| 371 astFactory.declaredIdentifier( | 372 astFactory.declaredIdentifier( |
| 372 null, | 373 null, |
| 373 null, | 374 null, |
| 374 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 375 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 375 type, | 376 type, |
| 376 identifier3(identifier)); | 377 identifier3(identifier)); |
| 377 | 378 |
| 378 static DeclaredIdentifier declaredIdentifier3(String identifier) => | 379 static DeclaredIdentifier declaredIdentifier3(String identifier) => |
| 379 declaredIdentifier2(Keyword.VAR, null, identifier); | 380 declaredIdentifier2(Keyword.VAR, null, identifier); |
| 380 | 381 |
| 381 static DeclaredIdentifier declaredIdentifier4( | 382 static DeclaredIdentifier declaredIdentifier4( |
| 382 TypeName type, String identifier) => | 383 TypeAnnotation type, String identifier) => |
| 383 declaredIdentifier2(null, type, identifier); | 384 declaredIdentifier2(null, type, identifier); |
| 384 | 385 |
| 385 static Comment documentationComment( | 386 static Comment documentationComment( |
| 386 List<Token> tokens, List<CommentReference> references) { | 387 List<Token> tokens, List<CommentReference> references) { |
| 387 return astFactory.documentationComment(tokens, references); | 388 return astFactory.documentationComment(tokens, references); |
| 388 } | 389 } |
| 389 | 390 |
| 390 static DoStatement doStatement(Statement body, Expression condition) => | 391 static DoStatement doStatement(Statement body, Expression condition) => |
| 391 astFactory.doStatement( | 392 astFactory.doStatement( |
| 392 TokenFactory.tokenFromKeyword(Keyword.DO), | 393 TokenFactory.tokenFromKeyword(Keyword.DO), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 453 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 453 | 454 |
| 454 static ExpressionStatement expressionStatement(Expression expression) => | 455 static ExpressionStatement expressionStatement(Expression expression) => |
| 455 astFactory.expressionStatement( | 456 astFactory.expressionStatement( |
| 456 expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 457 expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 457 | 458 |
| 458 static ExtendsClause extendsClause(TypeName type) => astFactory.extendsClause( | 459 static ExtendsClause extendsClause(TypeName type) => astFactory.extendsClause( |
| 459 TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type); | 460 TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type); |
| 460 | 461 |
| 461 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, | 462 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, |
| 462 TypeName type, List<VariableDeclaration> variables) => | 463 TypeAnnotation type, List<VariableDeclaration> variables) => |
| 463 astFactory.fieldDeclaration( | 464 astFactory.fieldDeclaration( |
| 464 null, | 465 null, |
| 465 null, | 466 null, |
| 466 isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null, | 467 isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null, |
| 467 variableDeclarationList(keyword, type, variables), | 468 variableDeclarationList(keyword, type, variables), |
| 468 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 469 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 469 | 470 |
| 470 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, | 471 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, |
| 471 List<VariableDeclaration> variables) => | 472 List<VariableDeclaration> variables) => |
| 472 fieldDeclaration(isStatic, keyword, null, variables); | 473 fieldDeclaration(isStatic, keyword, null, variables); |
| 473 | 474 |
| 474 static FieldFormalParameter fieldFormalParameter( | 475 static FieldFormalParameter fieldFormalParameter( |
| 475 Keyword keyword, TypeName type, String identifier, | 476 Keyword keyword, TypeAnnotation type, String identifier, |
| 476 [FormalParameterList parameterList]) => | 477 [FormalParameterList parameterList]) => |
| 477 astFactory.fieldFormalParameter( | 478 astFactory.fieldFormalParameter( |
| 478 null, | 479 null, |
| 479 null, | 480 null, |
| 480 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 481 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 481 type, | 482 type, |
| 482 TokenFactory.tokenFromKeyword(Keyword.THIS), | 483 TokenFactory.tokenFromKeyword(Keyword.THIS), |
| 483 TokenFactory.tokenFromType(TokenType.PERIOD), | 484 TokenFactory.tokenFromType(TokenType.PERIOD), |
| 484 identifier3(identifier), | 485 identifier3(identifier), |
| 485 null, | 486 null, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 543 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 543 variableList, | 544 variableList, |
| 544 null, | 545 null, |
| 545 TokenFactory.tokenFromType(TokenType.SEMICOLON), | 546 TokenFactory.tokenFromType(TokenType.SEMICOLON), |
| 546 condition, | 547 condition, |
| 547 TokenFactory.tokenFromType(TokenType.SEMICOLON), | 548 TokenFactory.tokenFromType(TokenType.SEMICOLON), |
| 548 updaters, | 549 updaters, |
| 549 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | 550 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), |
| 550 body); | 551 body); |
| 551 | 552 |
| 552 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword, | 553 static FunctionDeclaration functionDeclaration( |
| 553 String name, FunctionExpression functionExpression) => | 554 TypeAnnotation type, |
| 555 Keyword keyword, |
| 556 String name, |
| 557 FunctionExpression functionExpression) => |
| 554 astFactory.functionDeclaration( | 558 astFactory.functionDeclaration( |
| 555 null, | 559 null, |
| 556 null, | 560 null, |
| 557 null, | 561 null, |
| 558 type, | 562 type, |
| 559 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 563 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 560 identifier3(name), | 564 identifier3(name), |
| 561 functionExpression); | 565 functionExpression); |
| 562 | 566 |
| 563 static FunctionDeclarationStatement functionDeclarationStatement( | 567 static FunctionDeclarationStatement functionDeclarationStatement( |
| 564 TypeName type, | 568 TypeAnnotation type, |
| 565 Keyword keyword, | 569 Keyword keyword, |
| 566 String name, | 570 String name, |
| 567 FunctionExpression functionExpression) => | 571 FunctionExpression functionExpression) => |
| 568 astFactory.functionDeclarationStatement( | 572 astFactory.functionDeclarationStatement( |
| 569 functionDeclaration(type, keyword, name, functionExpression)); | 573 functionDeclaration(type, keyword, name, functionExpression)); |
| 570 | 574 |
| 571 static FunctionExpression functionExpression() => astFactory | 575 static FunctionExpression functionExpression() => astFactory |
| 572 .functionExpression(null, formalParameterList(), blockFunctionBody2()); | 576 .functionExpression(null, formalParameterList(), blockFunctionBody2()); |
| 573 | 577 |
| 574 static FunctionExpression functionExpression2( | 578 static FunctionExpression functionExpression2( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 587 functionExpressionInvocation2(function, null, arguments); | 591 functionExpressionInvocation2(function, null, arguments); |
| 588 | 592 |
| 589 static FunctionExpressionInvocation functionExpressionInvocation2( | 593 static FunctionExpressionInvocation functionExpressionInvocation2( |
| 590 Expression function, | 594 Expression function, |
| 591 [TypeArgumentList typeArguments, | 595 [TypeArgumentList typeArguments, |
| 592 List<Expression> arguments]) => | 596 List<Expression> arguments]) => |
| 593 astFactory.functionExpressionInvocation( | 597 astFactory.functionExpressionInvocation( |
| 594 function, typeArguments, argumentList(arguments)); | 598 function, typeArguments, argumentList(arguments)); |
| 595 | 599 |
| 596 static FunctionTypedFormalParameter functionTypedFormalParameter( | 600 static FunctionTypedFormalParameter functionTypedFormalParameter( |
| 597 TypeName returnType, String identifier, | 601 TypeAnnotation returnType, String identifier, |
| 598 [List<FormalParameter> parameters]) => | 602 [List<FormalParameter> parameters]) => |
| 599 astFactory.functionTypedFormalParameter(null, null, returnType, | 603 astFactory.functionTypedFormalParameter(null, null, returnType, |
| 600 identifier3(identifier), null, formalParameterList(parameters)); | 604 identifier3(identifier), null, formalParameterList(parameters)); |
| 601 | 605 |
| 602 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => | 606 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => |
| 603 astFactory.hideCombinator( | 607 astFactory.hideCombinator( |
| 604 TokenFactory.tokenFromString("hide"), identifiers); | 608 TokenFactory.tokenFromString("hide"), identifiers); |
| 605 | 609 |
| 606 static HideCombinator hideCombinator2(List<String> identifiers) => | 610 static HideCombinator hideCombinator2(List<String> identifiers) => |
| 607 astFactory.hideCombinator( | 611 astFactory.hideCombinator( |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_IDENTIFIER), | 734 TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_IDENTIFIER), |
| 731 identifier3(identifier), | 735 identifier3(identifier), |
| 732 null); | 736 null); |
| 733 | 737 |
| 734 static InterpolationString interpolationString( | 738 static InterpolationString interpolationString( |
| 735 String contents, String value) => | 739 String contents, String value) => |
| 736 astFactory.interpolationString( | 740 astFactory.interpolationString( |
| 737 TokenFactory.tokenFromString(contents), value); | 741 TokenFactory.tokenFromString(contents), value); |
| 738 | 742 |
| 739 static IsExpression isExpression( | 743 static IsExpression isExpression( |
| 740 Expression expression, bool negated, TypeName type) => | 744 Expression expression, bool negated, TypeAnnotation type) => |
| 741 astFactory.isExpression( | 745 astFactory.isExpression( |
| 742 expression, | 746 expression, |
| 743 TokenFactory.tokenFromKeyword(Keyword.IS), | 747 TokenFactory.tokenFromKeyword(Keyword.IS), |
| 744 negated ? TokenFactory.tokenFromType(TokenType.BANG) : null, | 748 negated ? TokenFactory.tokenFromType(TokenType.BANG) : null, |
| 745 type); | 749 type); |
| 746 | 750 |
| 747 static Label label(SimpleIdentifier label) => | 751 static Label label(SimpleIdentifier label) => |
| 748 astFactory.label(label, TokenFactory.tokenFromType(TokenType.COLON)); | 752 astFactory.label(label, TokenFactory.tokenFromType(TokenType.COLON)); |
| 749 | 753 |
| 750 static Label label2(String label) => AstTestFactory.label(identifier3(label)); | 754 static Label label2(String label) => AstTestFactory.label(identifier3(label)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => | 810 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => |
| 807 astFactory.mapLiteralEntry( | 811 astFactory.mapLiteralEntry( |
| 808 string2(key), TokenFactory.tokenFromType(TokenType.COLON), value); | 812 string2(key), TokenFactory.tokenFromType(TokenType.COLON), value); |
| 809 | 813 |
| 810 static MapLiteralEntry mapLiteralEntry2(Expression key, Expression value) => | 814 static MapLiteralEntry mapLiteralEntry2(Expression key, Expression value) => |
| 811 astFactory.mapLiteralEntry( | 815 astFactory.mapLiteralEntry( |
| 812 key, TokenFactory.tokenFromType(TokenType.COLON), value); | 816 key, TokenFactory.tokenFromType(TokenType.COLON), value); |
| 813 | 817 |
| 814 static MethodDeclaration methodDeclaration( | 818 static MethodDeclaration methodDeclaration( |
| 815 Keyword modifier, | 819 Keyword modifier, |
| 816 TypeName returnType, | 820 TypeAnnotation returnType, |
| 817 Keyword property, | 821 Keyword property, |
| 818 Keyword operator, | 822 Keyword operator, |
| 819 SimpleIdentifier name, | 823 SimpleIdentifier name, |
| 820 FormalParameterList parameters) => | 824 FormalParameterList parameters) => |
| 821 astFactory.methodDeclaration( | 825 astFactory.methodDeclaration( |
| 822 null, | 826 null, |
| 823 null, | 827 null, |
| 824 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL), | 828 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL), |
| 825 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), | 829 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), |
| 826 returnType, | 830 returnType, |
| 827 property == null ? null : TokenFactory.tokenFromKeyword(property), | 831 property == null ? null : TokenFactory.tokenFromKeyword(property), |
| 828 operator == null ? null : TokenFactory.tokenFromKeyword(operator), | 832 operator == null ? null : TokenFactory.tokenFromKeyword(operator), |
| 829 name, | 833 name, |
| 830 null, | 834 null, |
| 831 parameters, | 835 parameters, |
| 832 emptyFunctionBody()); | 836 emptyFunctionBody()); |
| 833 | 837 |
| 834 static MethodDeclaration methodDeclaration2( | 838 static MethodDeclaration methodDeclaration2( |
| 835 Keyword modifier, | 839 Keyword modifier, |
| 836 TypeName returnType, | 840 TypeAnnotation returnType, |
| 837 Keyword property, | 841 Keyword property, |
| 838 Keyword operator, | 842 Keyword operator, |
| 839 SimpleIdentifier name, | 843 SimpleIdentifier name, |
| 840 FormalParameterList parameters, | 844 FormalParameterList parameters, |
| 841 FunctionBody body) => | 845 FunctionBody body) => |
| 842 astFactory.methodDeclaration( | 846 astFactory.methodDeclaration( |
| 843 null, | 847 null, |
| 844 null, | 848 null, |
| 845 null, | 849 null, |
| 846 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), | 850 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), |
| 847 returnType, | 851 returnType, |
| 848 property == null ? null : TokenFactory.tokenFromKeyword(property), | 852 property == null ? null : TokenFactory.tokenFromKeyword(property), |
| 849 operator == null ? null : TokenFactory.tokenFromKeyword(operator), | 853 operator == null ? null : TokenFactory.tokenFromKeyword(operator), |
| 850 name, | 854 name, |
| 851 null, | 855 null, |
| 852 parameters, | 856 parameters, |
| 853 body); | 857 body); |
| 854 | 858 |
| 855 static MethodDeclaration methodDeclaration3( | 859 static MethodDeclaration methodDeclaration3( |
| 856 Keyword modifier, | 860 Keyword modifier, |
| 857 TypeName returnType, | 861 TypeAnnotation returnType, |
| 858 Keyword property, | 862 Keyword property, |
| 859 Keyword operator, | 863 Keyword operator, |
| 860 SimpleIdentifier name, | 864 SimpleIdentifier name, |
| 861 TypeParameterList typeParameters, | 865 TypeParameterList typeParameters, |
| 862 FormalParameterList parameters, | 866 FormalParameterList parameters, |
| 863 FunctionBody body) => | 867 FunctionBody body) => |
| 864 astFactory.methodDeclaration( | 868 astFactory.methodDeclaration( |
| 865 null, | 869 null, |
| 866 null, | 870 null, |
| 867 null, | 871 null, |
| 868 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), | 872 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), |
| 869 returnType, | 873 returnType, |
| 870 property == null ? null : TokenFactory.tokenFromKeyword(property), | 874 property == null ? null : TokenFactory.tokenFromKeyword(property), |
| 871 operator == null ? null : TokenFactory.tokenFromKeyword(operator), | 875 operator == null ? null : TokenFactory.tokenFromKeyword(operator), |
| 872 name, | 876 name, |
| 873 typeParameters, | 877 typeParameters, |
| 874 parameters, | 878 parameters, |
| 875 body); | 879 body); |
| 876 | 880 |
| 877 static MethodDeclaration methodDeclaration4( | 881 static MethodDeclaration methodDeclaration4( |
| 878 {bool external: false, | 882 {bool external: false, |
| 879 Keyword modifier, | 883 Keyword modifier, |
| 880 TypeName returnType, | 884 TypeAnnotation returnType, |
| 881 Keyword property, | 885 Keyword property, |
| 882 bool operator: false, | 886 bool operator: false, |
| 883 String name, | 887 String name, |
| 884 FormalParameterList parameters, | 888 FormalParameterList parameters, |
| 885 FunctionBody body}) => | 889 FunctionBody body}) => |
| 886 astFactory.methodDeclaration( | 890 astFactory.methodDeclaration( |
| 887 null, | 891 null, |
| 888 null, | 892 null, |
| 889 external ? TokenFactory.tokenFromKeyword(Keyword.EXTERNAL) : null, | 893 external ? TokenFactory.tokenFromKeyword(Keyword.EXTERNAL) : null, |
| 890 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), | 894 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 | 1048 |
| 1045 static ShowCombinator showCombinator2(List<String> identifiers) => | 1049 static ShowCombinator showCombinator2(List<String> identifiers) => |
| 1046 astFactory.showCombinator( | 1050 astFactory.showCombinator( |
| 1047 TokenFactory.tokenFromString("show"), identifierList(identifiers)); | 1051 TokenFactory.tokenFromString("show"), identifierList(identifiers)); |
| 1048 | 1052 |
| 1049 static SimpleFormalParameter simpleFormalParameter( | 1053 static SimpleFormalParameter simpleFormalParameter( |
| 1050 Keyword keyword, String parameterName) => | 1054 Keyword keyword, String parameterName) => |
| 1051 simpleFormalParameter2(keyword, null, parameterName); | 1055 simpleFormalParameter2(keyword, null, parameterName); |
| 1052 | 1056 |
| 1053 static SimpleFormalParameter simpleFormalParameter2( | 1057 static SimpleFormalParameter simpleFormalParameter2( |
| 1054 Keyword keyword, TypeName type, String parameterName) => | 1058 Keyword keyword, TypeAnnotation type, String parameterName) => |
| 1055 astFactory.simpleFormalParameter( | 1059 astFactory.simpleFormalParameter( |
| 1056 null, | 1060 null, |
| 1057 null, | 1061 null, |
| 1058 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 1062 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 1059 type, | 1063 type, |
| 1060 identifier3(parameterName)); | 1064 identifier3(parameterName)); |
| 1061 | 1065 |
| 1062 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => | 1066 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => |
| 1063 simpleFormalParameter2(null, null, parameterName); | 1067 simpleFormalParameter2(null, null, parameterName); |
| 1064 | 1068 |
| 1065 static SimpleFormalParameter simpleFormalParameter4( | 1069 static SimpleFormalParameter simpleFormalParameter4( |
| 1066 TypeName type, String parameterName) => | 1070 TypeAnnotation type, String parameterName) => |
| 1067 simpleFormalParameter2(null, type, parameterName); | 1071 simpleFormalParameter2(null, type, parameterName); |
| 1068 | 1072 |
| 1069 static StringInterpolation string([List<InterpolationElement> elements]) => | 1073 static StringInterpolation string([List<InterpolationElement> elements]) => |
| 1070 astFactory.stringInterpolation(elements); | 1074 astFactory.stringInterpolation(elements); |
| 1071 | 1075 |
| 1072 static SimpleStringLiteral string2(String content) => astFactory | 1076 static SimpleStringLiteral string2(String content) => astFactory |
| 1073 .simpleStringLiteral(TokenFactory.tokenFromString("'$content'"), content); | 1077 .simpleStringLiteral(TokenFactory.tokenFromString("'$content'"), content); |
| 1074 | 1078 |
| 1075 static SuperConstructorInvocation superConstructorInvocation( | 1079 static SuperConstructorInvocation superConstructorInvocation( |
| 1076 [List<Expression> arguments]) => | 1080 [List<Expression> arguments]) => |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 astFactory.thisExpression(TokenFactory.tokenFromKeyword(Keyword.THIS)); | 1150 astFactory.thisExpression(TokenFactory.tokenFromKeyword(Keyword.THIS)); |
| 1147 | 1151 |
| 1148 static ThrowExpression throwExpression() => throwExpression2(null); | 1152 static ThrowExpression throwExpression() => throwExpression2(null); |
| 1149 | 1153 |
| 1150 static ThrowExpression throwExpression2(Expression expression) => | 1154 static ThrowExpression throwExpression2(Expression expression) => |
| 1151 astFactory.throwExpression( | 1155 astFactory.throwExpression( |
| 1152 TokenFactory.tokenFromKeyword(Keyword.THROW), expression); | 1156 TokenFactory.tokenFromKeyword(Keyword.THROW), expression); |
| 1153 | 1157 |
| 1154 static TopLevelVariableDeclaration topLevelVariableDeclaration( | 1158 static TopLevelVariableDeclaration topLevelVariableDeclaration( |
| 1155 Keyword keyword, | 1159 Keyword keyword, |
| 1156 TypeName type, | 1160 TypeAnnotation type, |
| 1157 List<VariableDeclaration> variables) => | 1161 List<VariableDeclaration> variables) => |
| 1158 astFactory.topLevelVariableDeclaration( | 1162 astFactory.topLevelVariableDeclaration( |
| 1159 null, | 1163 null, |
| 1160 null, | 1164 null, |
| 1161 variableDeclarationList(keyword, type, variables), | 1165 variableDeclarationList(keyword, type, variables), |
| 1162 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 1166 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1163 | 1167 |
| 1164 static TopLevelVariableDeclaration topLevelVariableDeclaration2( | 1168 static TopLevelVariableDeclaration topLevelVariableDeclaration2( |
| 1165 Keyword keyword, List<VariableDeclaration> variables) => | 1169 Keyword keyword, List<VariableDeclaration> variables) => |
| 1166 astFactory.topLevelVariableDeclaration( | 1170 astFactory.topLevelVariableDeclaration( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1180 Block body, List<CatchClause> catchClauses, Block finallyClause) => | 1184 Block body, List<CatchClause> catchClauses, Block finallyClause) => |
| 1181 astFactory.tryStatement( | 1185 astFactory.tryStatement( |
| 1182 TokenFactory.tokenFromKeyword(Keyword.TRY), | 1186 TokenFactory.tokenFromKeyword(Keyword.TRY), |
| 1183 body, | 1187 body, |
| 1184 catchClauses, | 1188 catchClauses, |
| 1185 finallyClause == null | 1189 finallyClause == null |
| 1186 ? null | 1190 ? null |
| 1187 : TokenFactory.tokenFromKeyword(Keyword.FINALLY), | 1191 : TokenFactory.tokenFromKeyword(Keyword.FINALLY), |
| 1188 finallyClause); | 1192 finallyClause); |
| 1189 | 1193 |
| 1190 static FunctionTypeAlias typeAlias(TypeName returnType, String name, | 1194 static FunctionTypeAlias typeAlias(TypeAnnotation returnType, String name, |
| 1191 TypeParameterList typeParameters, FormalParameterList parameters) => | 1195 TypeParameterList typeParameters, FormalParameterList parameters) => |
| 1192 astFactory.functionTypeAlias( | 1196 astFactory.functionTypeAlias( |
| 1193 null, | 1197 null, |
| 1194 null, | 1198 null, |
| 1195 TokenFactory.tokenFromKeyword(Keyword.TYPEDEF), | 1199 TokenFactory.tokenFromKeyword(Keyword.TYPEDEF), |
| 1196 returnType, | 1200 returnType, |
| 1197 identifier3(name), | 1201 identifier3(name), |
| 1198 typeParameters, | 1202 typeParameters, |
| 1199 parameters, | 1203 parameters, |
| 1200 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 1204 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1201 | 1205 |
| 1202 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) { | 1206 static TypeArgumentList typeArgumentList(List<TypeAnnotation> types) { |
| 1203 if (typeNames == null || typeNames.length == 0) { | 1207 if (types == null || types.length == 0) { |
| 1204 return null; | 1208 return null; |
| 1205 } | 1209 } |
| 1206 return astFactory.typeArgumentList(TokenFactory.tokenFromType(TokenType.LT), | 1210 return astFactory.typeArgumentList(TokenFactory.tokenFromType(TokenType.LT), |
| 1207 typeNames, TokenFactory.tokenFromType(TokenType.GT)); | 1211 types, TokenFactory.tokenFromType(TokenType.GT)); |
| 1208 } | 1212 } |
| 1209 | 1213 |
| 1210 /** | 1214 /** |
| 1211 * Create a type name whose name has been resolved to the given [element] and | 1215 * Create a type name whose name has been resolved to the given [element] and |
| 1212 * whose type has been resolved to the type of the given element. | 1216 * whose type has been resolved to the type of the given element. |
| 1213 * | 1217 * |
| 1214 * <b>Note:</b> This method does not correctly handle class elements that have | 1218 * <b>Note:</b> This method does not correctly handle class elements that have |
| 1215 * type parameters. | 1219 * type parameters. |
| 1216 */ | 1220 */ |
| 1217 static TypeName typeName(ClassElement element, [List<TypeName> arguments]) { | 1221 static TypeName typeName(ClassElement element, |
| 1222 [List<TypeAnnotation> arguments]) { |
| 1218 SimpleIdentifier name = identifier3(element.name); | 1223 SimpleIdentifier name = identifier3(element.name); |
| 1219 name.staticElement = element; | 1224 name.staticElement = element; |
| 1220 TypeName typeName = typeName3(name, arguments); | 1225 TypeName typeName = typeName3(name, arguments); |
| 1221 typeName.type = element.type; | 1226 typeName.type = element.type; |
| 1222 return typeName; | 1227 return typeName; |
| 1223 } | 1228 } |
| 1224 | 1229 |
| 1225 static TypeName typeName3(Identifier name, [List<TypeName> arguments]) => | 1230 static TypeName typeName3(Identifier name, |
| 1231 [List<TypeAnnotation> arguments]) => |
| 1226 astFactory.typeName(name, typeArgumentList(arguments)); | 1232 astFactory.typeName(name, typeArgumentList(arguments)); |
| 1227 | 1233 |
| 1228 static TypeName typeName4(String name, [List<TypeName> arguments]) => | 1234 static TypeName typeName4(String name, [List<TypeAnnotation> arguments]) => |
| 1229 astFactory.typeName(identifier3(name), typeArgumentList(arguments)); | 1235 astFactory.typeName(identifier3(name), typeArgumentList(arguments)); |
| 1230 | 1236 |
| 1231 static TypeParameter typeParameter(String name) => | 1237 static TypeParameter typeParameter(String name) => |
| 1232 astFactory.typeParameter(null, null, identifier3(name), null, null); | 1238 astFactory.typeParameter(null, null, identifier3(name), null, null); |
| 1233 | 1239 |
| 1234 static TypeParameter typeParameter2(String name, TypeName bound) => | 1240 static TypeParameter typeParameter2(String name, TypeAnnotation bound) => |
| 1235 astFactory.typeParameter(null, null, identifier3(name), | 1241 astFactory.typeParameter(null, null, identifier3(name), |
| 1236 TokenFactory.tokenFromKeyword(Keyword.EXTENDS), bound); | 1242 TokenFactory.tokenFromKeyword(Keyword.EXTENDS), bound); |
| 1237 | 1243 |
| 1238 static TypeParameterList typeParameterList([List<String> typeNames]) { | 1244 static TypeParameterList typeParameterList([List<String> typeNames]) { |
| 1239 List<TypeParameter> typeParameters = null; | 1245 List<TypeParameter> typeParameters = null; |
| 1240 if (typeNames != null && !typeNames.isEmpty) { | 1246 if (typeNames != null && !typeNames.isEmpty) { |
| 1241 typeParameters = new List<TypeParameter>(); | 1247 typeParameters = new List<TypeParameter>(); |
| 1242 for (String typeName in typeNames) { | 1248 for (String typeName in typeNames) { |
| 1243 typeParameters.add(typeParameter(typeName)); | 1249 typeParameters.add(typeParameter(typeName)); |
| 1244 } | 1250 } |
| 1245 } | 1251 } |
| 1246 return astFactory.typeParameterList( | 1252 return astFactory.typeParameterList( |
| 1247 TokenFactory.tokenFromType(TokenType.LT), | 1253 TokenFactory.tokenFromType(TokenType.LT), |
| 1248 typeParameters, | 1254 typeParameters, |
| 1249 TokenFactory.tokenFromType(TokenType.GT)); | 1255 TokenFactory.tokenFromType(TokenType.GT)); |
| 1250 } | 1256 } |
| 1251 | 1257 |
| 1252 static VariableDeclaration variableDeclaration(String name) => | 1258 static VariableDeclaration variableDeclaration(String name) => |
| 1253 astFactory.variableDeclaration(identifier3(name), null, null); | 1259 astFactory.variableDeclaration(identifier3(name), null, null); |
| 1254 | 1260 |
| 1255 static VariableDeclaration variableDeclaration2( | 1261 static VariableDeclaration variableDeclaration2( |
| 1256 String name, Expression initializer) => | 1262 String name, Expression initializer) => |
| 1257 astFactory.variableDeclaration(identifier3(name), | 1263 astFactory.variableDeclaration(identifier3(name), |
| 1258 TokenFactory.tokenFromType(TokenType.EQ), initializer); | 1264 TokenFactory.tokenFromType(TokenType.EQ), initializer); |
| 1259 | 1265 |
| 1260 static VariableDeclarationList variableDeclarationList(Keyword keyword, | 1266 static VariableDeclarationList variableDeclarationList(Keyword keyword, |
| 1261 TypeName type, List<VariableDeclaration> variables) => | 1267 TypeAnnotation type, List<VariableDeclaration> variables) => |
| 1262 astFactory.variableDeclarationList( | 1268 astFactory.variableDeclarationList( |
| 1263 null, | 1269 null, |
| 1264 null, | 1270 null, |
| 1265 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 1271 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 1266 type, | 1272 type, |
| 1267 variables); | 1273 variables); |
| 1268 | 1274 |
| 1269 static VariableDeclarationList variableDeclarationList2( | 1275 static VariableDeclarationList variableDeclarationList2( |
| 1270 Keyword keyword, List<VariableDeclaration> variables) => | 1276 Keyword keyword, List<VariableDeclaration> variables) => |
| 1271 variableDeclarationList(keyword, null, variables); | 1277 variableDeclarationList(keyword, null, variables); |
| 1272 | 1278 |
| 1273 static VariableDeclarationStatement variableDeclarationStatement( | 1279 static VariableDeclarationStatement variableDeclarationStatement( |
| 1274 Keyword keyword, | 1280 Keyword keyword, |
| 1275 TypeName type, | 1281 TypeAnnotation type, |
| 1276 List<VariableDeclaration> variables) => | 1282 List<VariableDeclaration> variables) => |
| 1277 astFactory.variableDeclarationStatement( | 1283 astFactory.variableDeclarationStatement( |
| 1278 variableDeclarationList(keyword, type, variables), | 1284 variableDeclarationList(keyword, type, variables), |
| 1279 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 1285 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1280 | 1286 |
| 1281 static VariableDeclarationStatement variableDeclarationStatement2( | 1287 static VariableDeclarationStatement variableDeclarationStatement2( |
| 1282 Keyword keyword, List<VariableDeclaration> variables) => | 1288 Keyword keyword, List<VariableDeclaration> variables) => |
| 1283 variableDeclarationStatement(keyword, null, variables); | 1289 variableDeclarationStatement(keyword, null, variables); |
| 1284 | 1290 |
| 1285 static WhileStatement whileStatement(Expression condition, Statement body) => | 1291 static WhileStatement whileStatement(Expression condition, Statement body) => |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1300 expression, | 1306 expression, |
| 1301 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 1307 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1302 | 1308 |
| 1303 static YieldStatement yieldStatement(Expression expression) => | 1309 static YieldStatement yieldStatement(Expression expression) => |
| 1304 astFactory.yieldStatement( | 1310 astFactory.yieldStatement( |
| 1305 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), | 1311 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), |
| 1306 null, | 1312 null, |
| 1307 expression, | 1313 expression, |
| 1308 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 1314 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1309 } | 1315 } |
| OLD | NEW |