OLD | NEW |
1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
3 | 3 |
4 library engine.parser_test; | 4 library engine.parser_test; |
5 | 5 |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'package:analyzer-experimental/src/generated/java_core.dart'; | 7 import 'package:analyzer-experimental/src/generated/java_core.dart'; |
8 import 'package:analyzer-experimental/src/generated/java_engine.dart'; | 8 import 'package:analyzer-experimental/src/generated/java_engine.dart'; |
9 import 'package:analyzer-experimental/src/generated/java_junit.dart'; | 9 import 'package:analyzer-experimental/src/generated/java_junit.dart'; |
10 import 'package:analyzer-experimental/src/generated/source.dart'; | 10 import 'package:analyzer-experimental/src/generated/source.dart'; |
11 import 'package:analyzer-experimental/src/generated/error.dart'; | 11 import 'package:analyzer-experimental/src/generated/error.dart'; |
12 import 'package:analyzer-experimental/src/generated/scanner.dart'; | 12 import 'package:analyzer-experimental/src/generated/scanner.dart'; |
13 import 'package:analyzer-experimental/src/generated/ast.dart'; | 13 import 'package:analyzer-experimental/src/generated/ast.dart'; |
14 import 'package:analyzer-experimental/src/generated/parser.dart'; | 14 import 'package:analyzer-experimental/src/generated/parser.dart'; |
15 import 'package:analyzer-experimental/src/generated/utilities_dart.dart'; | 15 import 'package:analyzer-experimental/src/generated/utilities_dart.dart'; |
16 import 'package:unittest/unittest.dart' as _ut; | 16 import 'package:unittest/unittest.dart' as _ut; |
17 import 'test_support.dart'; | 17 import 'test_support.dart'; |
18 import 'scanner_test.dart' show TokenFactory; | 18 import 'scanner_test.dart' show TokenFactory; |
19 | 19 |
20 class ParserTestCase extends EngineTestCase { | 20 class ParserTestCase extends EngineTestCase { |
21 /** | 21 /** |
22 * An empty array of objects used as arguments to zero-argument methods. | 22 * An empty array of objects used as arguments to zero-argument methods. |
23 */ | 23 */ |
24 static List<Object> _EMPTY_ARGUMENTS = new List<Object>.fixedLength(0); | 24 static List<Object> _EMPTY_ARGUMENTS = new List<Object>(0); |
25 /** | 25 /** |
26 * Invoke a parse method in {@link Parser}. The method is assumed to have the
given number and | 26 * Invoke a parse method in {@link Parser}. The method is assumed to have the
given number and |
27 * type of parameters and will be invoked with the given arguments. | 27 * type of parameters and will be invoked with the given arguments. |
28 * <p> | 28 * <p> |
29 * The given source is scanned and the parser is initialized to start with the
first token in the | 29 * The given source is scanned and the parser is initialized to start with the
first token in the |
30 * source before the parse method is invoked. | 30 * source before the parse method is invoked. |
31 * @param methodName the name of the parse method that should be invoked to pa
rse the source | 31 * @param methodName the name of the parse method that should be invoked to pa
rse the source |
32 * @param objects the values of the arguments to the method | 32 * @param objects the values of the arguments to the method |
33 * @param source the source to be parsed by the parse method | 33 * @param source the source to be parsed by the parse method |
34 * @return the result of invoking the method | 34 * @return the result of invoking the method |
35 * @throws Exception if the method could not be invoked or throws an exception | 35 * @throws Exception if the method could not be invoked or throws an exception |
36 * @throws AssertionFailedError if the result is {@code null} or if any errors
are produced | 36 * @throws AssertionFailedError if the result is {@code null} or if any errors
are produced |
37 */ | 37 */ |
38 static Object parse(String methodName, List<Object> objects, String source) =>
parse3(methodName, objects, source, new List<AnalysisError>.fixedLength(0)); | 38 static Object parse(String methodName, List<Object> objects, String source) =>
parse3(methodName, objects, source, new List<AnalysisError>(0)); |
39 /** | 39 /** |
40 * Invoke a parse method in {@link Parser}. The method is assumed to have the
given number and | 40 * Invoke a parse method in {@link Parser}. The method is assumed to have the
given number and |
41 * type of parameters and will be invoked with the given arguments. | 41 * type of parameters and will be invoked with the given arguments. |
42 * <p> | 42 * <p> |
43 * The given source is scanned and the parser is initialized to start with the
first token in the | 43 * The given source is scanned and the parser is initialized to start with the
first token in the |
44 * source before the parse method is invoked. | 44 * source before the parse method is invoked. |
45 * @param methodName the name of the parse method that should be invoked to pa
rse the source | 45 * @param methodName the name of the parse method that should be invoked to pa
rse the source |
46 * @param objects the values of the arguments to the method | 46 * @param objects the values of the arguments to the method |
47 * @param source the source to be parsed by the parse method | 47 * @param source the source to be parsed by the parse method |
48 * @param errorCodes the error codes of the errors that should be generated | 48 * @param errorCodes the error codes of the errors that should be generated |
(...skipping 2832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2881 EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <
Object> [true, false], ";"); | 2881 EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <
Object> [true, false], ";"); |
2882 JUnitTestCase.assertNotNull(functionBody.semicolon); | 2882 JUnitTestCase.assertNotNull(functionBody.semicolon); |
2883 } | 2883 } |
2884 void test_parseFunctionBody_expression() { | 2884 void test_parseFunctionBody_expression() { |
2885 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod
y", <Object> [false, false], "=> y;"); | 2885 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod
y", <Object> [false, false], "=> y;"); |
2886 JUnitTestCase.assertNotNull(functionBody.functionDefinition); | 2886 JUnitTestCase.assertNotNull(functionBody.functionDefinition); |
2887 JUnitTestCase.assertNotNull(functionBody.expression); | 2887 JUnitTestCase.assertNotNull(functionBody.expression); |
2888 JUnitTestCase.assertNotNull(functionBody.semicolon); | 2888 JUnitTestCase.assertNotNull(functionBody.semicolon); |
2889 } | 2889 } |
2890 void test_parseFunctionDeclaration_function() { | 2890 void test_parseFunctionDeclaration_function() { |
2891 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 2891 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
2892 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 2892 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
2893 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara
tion", <Object> [commentAndMetadata(comment, []), null, returnType, false], "f()
{}"); | 2893 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara
tion", <Object> [commentAndMetadata(comment, []), null, returnType, false], "f()
{}"); |
2894 JUnitTestCase.assertEquals(comment, declaration.documentationComment); | 2894 JUnitTestCase.assertEquals(comment, declaration.documentationComment); |
2895 JUnitTestCase.assertEquals(returnType, declaration.returnType); | 2895 JUnitTestCase.assertEquals(returnType, declaration.returnType); |
2896 JUnitTestCase.assertNotNull(declaration.name); | 2896 JUnitTestCase.assertNotNull(declaration.name); |
2897 FunctionExpression expression = declaration.functionExpression; | 2897 FunctionExpression expression = declaration.functionExpression; |
2898 JUnitTestCase.assertNotNull(expression); | 2898 JUnitTestCase.assertNotNull(expression); |
2899 JUnitTestCase.assertNotNull(expression.body); | 2899 JUnitTestCase.assertNotNull(expression.body); |
2900 JUnitTestCase.assertNotNull(expression.parameters); | 2900 JUnitTestCase.assertNotNull(expression.parameters); |
2901 JUnitTestCase.assertNull(declaration.propertyKeyword); | 2901 JUnitTestCase.assertNull(declaration.propertyKeyword); |
2902 } | 2902 } |
2903 void test_parseFunctionDeclaration_function_inStatement() { | 2903 void test_parseFunctionDeclaration_function_inStatement() { |
2904 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 2904 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
2905 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 2905 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
2906 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara
tion", <Object> [commentAndMetadata(comment, []), null, returnType, true], "f()
{};"); | 2906 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara
tion", <Object> [commentAndMetadata(comment, []), null, returnType, true], "f()
{};"); |
2907 JUnitTestCase.assertEquals(comment, declaration.documentationComment); | 2907 JUnitTestCase.assertEquals(comment, declaration.documentationComment); |
2908 JUnitTestCase.assertEquals(returnType, declaration.returnType); | 2908 JUnitTestCase.assertEquals(returnType, declaration.returnType); |
2909 JUnitTestCase.assertNotNull(declaration.name); | 2909 JUnitTestCase.assertNotNull(declaration.name); |
2910 FunctionExpression expression = declaration.functionExpression; | 2910 FunctionExpression expression = declaration.functionExpression; |
2911 JUnitTestCase.assertNotNull(expression); | 2911 JUnitTestCase.assertNotNull(expression); |
2912 JUnitTestCase.assertNotNull(expression.body); | 2912 JUnitTestCase.assertNotNull(expression.body); |
2913 JUnitTestCase.assertNotNull(expression.parameters); | 2913 JUnitTestCase.assertNotNull(expression.parameters); |
2914 JUnitTestCase.assertNull(declaration.propertyKeyword); | 2914 JUnitTestCase.assertNull(declaration.propertyKeyword); |
2915 } | 2915 } |
2916 void test_parseFunctionDeclaration_getter() { | 2916 void test_parseFunctionDeclaration_getter() { |
2917 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 2917 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
2918 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 2918 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
2919 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara
tion", <Object> [commentAndMetadata(comment, []), null, returnType, false], "get
p => 0;"); | 2919 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara
tion", <Object> [commentAndMetadata(comment, []), null, returnType, false], "get
p => 0;"); |
2920 JUnitTestCase.assertEquals(comment, declaration.documentationComment); | 2920 JUnitTestCase.assertEquals(comment, declaration.documentationComment); |
2921 JUnitTestCase.assertEquals(returnType, declaration.returnType); | 2921 JUnitTestCase.assertEquals(returnType, declaration.returnType); |
2922 JUnitTestCase.assertNotNull(declaration.name); | 2922 JUnitTestCase.assertNotNull(declaration.name); |
2923 FunctionExpression expression = declaration.functionExpression; | 2923 FunctionExpression expression = declaration.functionExpression; |
2924 JUnitTestCase.assertNotNull(expression); | 2924 JUnitTestCase.assertNotNull(expression); |
2925 JUnitTestCase.assertNotNull(expression.body); | 2925 JUnitTestCase.assertNotNull(expression.body); |
2926 JUnitTestCase.assertNull(expression.parameters); | 2926 JUnitTestCase.assertNull(expression.parameters); |
2927 JUnitTestCase.assertNotNull(declaration.propertyKeyword); | 2927 JUnitTestCase.assertNotNull(declaration.propertyKeyword); |
2928 } | 2928 } |
2929 void test_parseFunctionDeclaration_setter() { | 2929 void test_parseFunctionDeclaration_setter() { |
2930 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 2930 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
2931 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 2931 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
2932 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara
tion", <Object> [commentAndMetadata(comment, []), null, returnType, false], "set
p(v) {}"); | 2932 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara
tion", <Object> [commentAndMetadata(comment, []), null, returnType, false], "set
p(v) {}"); |
2933 JUnitTestCase.assertEquals(comment, declaration.documentationComment); | 2933 JUnitTestCase.assertEquals(comment, declaration.documentationComment); |
2934 JUnitTestCase.assertEquals(returnType, declaration.returnType); | 2934 JUnitTestCase.assertEquals(returnType, declaration.returnType); |
2935 JUnitTestCase.assertNotNull(declaration.name); | 2935 JUnitTestCase.assertNotNull(declaration.name); |
2936 FunctionExpression expression = declaration.functionExpression; | 2936 FunctionExpression expression = declaration.functionExpression; |
2937 JUnitTestCase.assertNotNull(expression); | 2937 JUnitTestCase.assertNotNull(expression); |
2938 JUnitTestCase.assertNotNull(expression.body); | 2938 JUnitTestCase.assertNotNull(expression.body); |
2939 JUnitTestCase.assertNotNull(expression.parameters); | 2939 JUnitTestCase.assertNotNull(expression.parameters); |
2940 JUnitTestCase.assertNotNull(declaration.propertyKeyword); | 2940 JUnitTestCase.assertNotNull(declaration.propertyKeyword); |
2941 } | 2941 } |
2942 void test_parseFunctionDeclarationStatement() { | 2942 void test_parseFunctionDeclarationStatement() { |
2943 FunctionDeclarationStatement statement = ParserTestCase.parse5("parseFunctio
nDeclarationStatement", "void f(int p) => p * 2;", []); | 2943 FunctionDeclarationStatement statement = ParserTestCase.parse5("parseFunctio
nDeclarationStatement", "void f(int p) => p * 2;", []); |
2944 JUnitTestCase.assertNotNull(statement.functionDeclaration); | 2944 JUnitTestCase.assertNotNull(statement.functionDeclaration); |
2945 } | 2945 } |
2946 void test_parseFunctionExpression_body_inExpression() { | 2946 void test_parseFunctionExpression_body_inExpression() { |
2947 FunctionExpression expression = ParserTestCase.parse5("parseFunctionExpressi
on", "(int i) => i++", []); | 2947 FunctionExpression expression = ParserTestCase.parse5("parseFunctionExpressi
on", "(int i) => i++", []); |
2948 JUnitTestCase.assertNotNull(expression.body); | 2948 JUnitTestCase.assertNotNull(expression.body); |
2949 JUnitTestCase.assertNotNull(expression.parameters); | 2949 JUnitTestCase.assertNotNull(expression.parameters); |
2950 JUnitTestCase.assertNull(((expression.body as ExpressionFunctionBody)).semic
olon); | 2950 JUnitTestCase.assertNull(((expression.body as ExpressionFunctionBody)).semic
olon); |
2951 } | 2951 } |
2952 void test_parseFunctionExpression_minimal() { | 2952 void test_parseFunctionExpression_minimal() { |
2953 FunctionExpression expression = ParserTestCase.parse5("parseFunctionExpressi
on", "() {}", []); | 2953 FunctionExpression expression = ParserTestCase.parse5("parseFunctionExpressi
on", "() {}", []); |
2954 JUnitTestCase.assertNotNull(expression.body); | 2954 JUnitTestCase.assertNotNull(expression.body); |
2955 JUnitTestCase.assertNotNull(expression.parameters); | 2955 JUnitTestCase.assertNotNull(expression.parameters); |
2956 } | 2956 } |
2957 void test_parseGetter_nonStatic() { | 2957 void test_parseGetter_nonStatic() { |
2958 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 2958 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
2959 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 2959 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
2960 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com
mentAndMetadata(comment, []), null, null, returnType], "get a;"); | 2960 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com
mentAndMetadata(comment, []), null, null, returnType], "get a;"); |
2961 JUnitTestCase.assertNotNull(method.body); | 2961 JUnitTestCase.assertNotNull(method.body); |
2962 JUnitTestCase.assertEquals(comment, method.documentationComment); | 2962 JUnitTestCase.assertEquals(comment, method.documentationComment); |
2963 JUnitTestCase.assertNull(method.externalKeyword); | 2963 JUnitTestCase.assertNull(method.externalKeyword); |
2964 JUnitTestCase.assertNull(method.modifierKeyword); | 2964 JUnitTestCase.assertNull(method.modifierKeyword); |
2965 JUnitTestCase.assertNotNull(method.name); | 2965 JUnitTestCase.assertNotNull(method.name); |
2966 JUnitTestCase.assertNull(method.operatorKeyword); | 2966 JUnitTestCase.assertNull(method.operatorKeyword); |
2967 JUnitTestCase.assertNull(method.parameters); | 2967 JUnitTestCase.assertNull(method.parameters); |
2968 JUnitTestCase.assertNotNull(method.propertyKeyword); | 2968 JUnitTestCase.assertNotNull(method.propertyKeyword); |
2969 JUnitTestCase.assertEquals(returnType, method.returnType); | 2969 JUnitTestCase.assertEquals(returnType, method.returnType); |
2970 } | 2970 } |
2971 void test_parseGetter_static() { | 2971 void test_parseGetter_static() { |
2972 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 2972 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
2973 Token staticKeyword = TokenFactory.token(Keyword.STATIC); | 2973 Token staticKeyword = TokenFactory.token(Keyword.STATIC); |
2974 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 2974 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
2975 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com
mentAndMetadata(comment, []), null, staticKeyword, returnType], "get a;"); | 2975 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com
mentAndMetadata(comment, []), null, staticKeyword, returnType], "get a;"); |
2976 JUnitTestCase.assertNotNull(method.body); | 2976 JUnitTestCase.assertNotNull(method.body); |
2977 JUnitTestCase.assertEquals(comment, method.documentationComment); | 2977 JUnitTestCase.assertEquals(comment, method.documentationComment); |
2978 JUnitTestCase.assertNull(method.externalKeyword); | 2978 JUnitTestCase.assertNull(method.externalKeyword); |
2979 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); | 2979 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); |
2980 JUnitTestCase.assertNotNull(method.name); | 2980 JUnitTestCase.assertNotNull(method.name); |
2981 JUnitTestCase.assertNull(method.operatorKeyword); | 2981 JUnitTestCase.assertNull(method.operatorKeyword); |
2982 JUnitTestCase.assertNull(method.parameters); | 2982 JUnitTestCase.assertNull(method.parameters); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3089 void test_parseImportDirective_show() { | 3089 void test_parseImportDirective_show() { |
3090 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob
ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' show A, B;"); | 3090 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob
ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' show A, B;"); |
3091 JUnitTestCase.assertNotNull(directive.keyword); | 3091 JUnitTestCase.assertNotNull(directive.keyword); |
3092 JUnitTestCase.assertNotNull(directive.uri); | 3092 JUnitTestCase.assertNotNull(directive.uri); |
3093 JUnitTestCase.assertNull(directive.asToken); | 3093 JUnitTestCase.assertNull(directive.asToken); |
3094 JUnitTestCase.assertNull(directive.prefix); | 3094 JUnitTestCase.assertNull(directive.prefix); |
3095 EngineTestCase.assertSize(1, directive.combinators); | 3095 EngineTestCase.assertSize(1, directive.combinators); |
3096 JUnitTestCase.assertNotNull(directive.semicolon); | 3096 JUnitTestCase.assertNotNull(directive.semicolon); |
3097 } | 3097 } |
3098 void test_parseInitializedIdentifierList_type() { | 3098 void test_parseInitializedIdentifierList_type() { |
3099 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 3099 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
3100 Token staticKeyword = TokenFactory.token(Keyword.STATIC); | 3100 Token staticKeyword = TokenFactory.token(Keyword.STATIC); |
3101 TypeName type = new TypeName.full(new SimpleIdentifier.full(null), null); | 3101 TypeName type = new TypeName.full(new SimpleIdentifier.full(null), null); |
3102 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif
ierList", <Object> [commentAndMetadata(comment, []), staticKeyword, null, type],
"a = 1, b, c = 3;"); | 3102 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif
ierList", <Object> [commentAndMetadata(comment, []), staticKeyword, null, type],
"a = 1, b, c = 3;"); |
3103 JUnitTestCase.assertEquals(comment, declaration.documentationComment); | 3103 JUnitTestCase.assertEquals(comment, declaration.documentationComment); |
3104 VariableDeclarationList fields3 = declaration.fields; | 3104 VariableDeclarationList fields3 = declaration.fields; |
3105 JUnitTestCase.assertNotNull(fields3); | 3105 JUnitTestCase.assertNotNull(fields3); |
3106 JUnitTestCase.assertNull(fields3.keyword); | 3106 JUnitTestCase.assertNull(fields3.keyword); |
3107 JUnitTestCase.assertEquals(type, fields3.type); | 3107 JUnitTestCase.assertEquals(type, fields3.type); |
3108 EngineTestCase.assertSize(3, fields3.variables); | 3108 EngineTestCase.assertSize(3, fields3.variables); |
3109 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword); | 3109 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword); |
3110 JUnitTestCase.assertNotNull(declaration.semicolon); | 3110 JUnitTestCase.assertNotNull(declaration.semicolon); |
3111 } | 3111 } |
3112 void test_parseInitializedIdentifierList_var() { | 3112 void test_parseInitializedIdentifierList_var() { |
3113 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 3113 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
3114 Token staticKeyword = TokenFactory.token(Keyword.STATIC); | 3114 Token staticKeyword = TokenFactory.token(Keyword.STATIC); |
3115 Token varKeyword = TokenFactory.token(Keyword.VAR); | 3115 Token varKeyword = TokenFactory.token(Keyword.VAR); |
3116 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif
ierList", <Object> [commentAndMetadata(comment, []), staticKeyword, varKeyword,
null], "a = 1, b, c = 3;"); | 3116 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif
ierList", <Object> [commentAndMetadata(comment, []), staticKeyword, varKeyword,
null], "a = 1, b, c = 3;"); |
3117 JUnitTestCase.assertEquals(comment, declaration.documentationComment); | 3117 JUnitTestCase.assertEquals(comment, declaration.documentationComment); |
3118 VariableDeclarationList fields4 = declaration.fields; | 3118 VariableDeclarationList fields4 = declaration.fields; |
3119 JUnitTestCase.assertNotNull(fields4); | 3119 JUnitTestCase.assertNotNull(fields4); |
3120 JUnitTestCase.assertEquals(varKeyword, fields4.keyword); | 3120 JUnitTestCase.assertEquals(varKeyword, fields4.keyword); |
3121 JUnitTestCase.assertNull(fields4.type); | 3121 JUnitTestCase.assertNull(fields4.type); |
3122 EngineTestCase.assertSize(3, fields4.variables); | 3122 EngineTestCase.assertSize(3, fields4.variables); |
3123 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword); | 3123 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3508 JUnitTestCase.assertNull(parameter.type); | 3508 JUnitTestCase.assertNull(parameter.type); |
3509 JUnitTestCase.assertNotNull(parameter.identifier); | 3509 JUnitTestCase.assertNotNull(parameter.identifier); |
3510 } | 3510 } |
3511 void test_parseNormalFormalParameter_simple_type() { | 3511 void test_parseNormalFormalParameter_simple_type() { |
3512 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa
rameter", "A a)", []); | 3512 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa
rameter", "A a)", []); |
3513 JUnitTestCase.assertNull(parameter.keyword); | 3513 JUnitTestCase.assertNull(parameter.keyword); |
3514 JUnitTestCase.assertNotNull(parameter.type); | 3514 JUnitTestCase.assertNotNull(parameter.type); |
3515 JUnitTestCase.assertNotNull(parameter.identifier); | 3515 JUnitTestCase.assertNotNull(parameter.identifier); |
3516 } | 3516 } |
3517 void test_parseOperator() { | 3517 void test_parseOperator() { |
3518 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 3518 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
3519 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 3519 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
3520 MethodDeclaration method = ParserTestCase.parse("parseOperator", <Object> [c
ommentAndMetadata(comment, []), null, returnType], "operator +(A a);"); | 3520 MethodDeclaration method = ParserTestCase.parse("parseOperator", <Object> [c
ommentAndMetadata(comment, []), null, returnType], "operator +(A a);"); |
3521 JUnitTestCase.assertNotNull(method.body); | 3521 JUnitTestCase.assertNotNull(method.body); |
3522 JUnitTestCase.assertEquals(comment, method.documentationComment); | 3522 JUnitTestCase.assertEquals(comment, method.documentationComment); |
3523 JUnitTestCase.assertNull(method.externalKeyword); | 3523 JUnitTestCase.assertNull(method.externalKeyword); |
3524 JUnitTestCase.assertNull(method.modifierKeyword); | 3524 JUnitTestCase.assertNull(method.modifierKeyword); |
3525 JUnitTestCase.assertNotNull(method.name); | 3525 JUnitTestCase.assertNotNull(method.name); |
3526 JUnitTestCase.assertNotNull(method.operatorKeyword); | 3526 JUnitTestCase.assertNotNull(method.operatorKeyword); |
3527 JUnitTestCase.assertNotNull(method.parameters); | 3527 JUnitTestCase.assertNotNull(method.parameters); |
3528 JUnitTestCase.assertNull(method.propertyKeyword); | 3528 JUnitTestCase.assertNull(method.propertyKeyword); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3752 TypeName typeName = ParserTestCase.parse5("parseReturnType", "A<B>", []); | 3752 TypeName typeName = ParserTestCase.parse5("parseReturnType", "A<B>", []); |
3753 JUnitTestCase.assertNotNull(typeName.name); | 3753 JUnitTestCase.assertNotNull(typeName.name); |
3754 JUnitTestCase.assertNotNull(typeName.typeArguments); | 3754 JUnitTestCase.assertNotNull(typeName.typeArguments); |
3755 } | 3755 } |
3756 void test_parseReturnType_void() { | 3756 void test_parseReturnType_void() { |
3757 TypeName typeName = ParserTestCase.parse5("parseReturnType", "void", []); | 3757 TypeName typeName = ParserTestCase.parse5("parseReturnType", "void", []); |
3758 JUnitTestCase.assertNotNull(typeName.name); | 3758 JUnitTestCase.assertNotNull(typeName.name); |
3759 JUnitTestCase.assertNull(typeName.typeArguments); | 3759 JUnitTestCase.assertNull(typeName.typeArguments); |
3760 } | 3760 } |
3761 void test_parseSetter_nonStatic() { | 3761 void test_parseSetter_nonStatic() { |
3762 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 3762 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
3763 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 3763 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
3764 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com
mentAndMetadata(comment, []), null, null, returnType], "set a(var x);"); | 3764 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com
mentAndMetadata(comment, []), null, null, returnType], "set a(var x);"); |
3765 JUnitTestCase.assertNotNull(method.body); | 3765 JUnitTestCase.assertNotNull(method.body); |
3766 JUnitTestCase.assertEquals(comment, method.documentationComment); | 3766 JUnitTestCase.assertEquals(comment, method.documentationComment); |
3767 JUnitTestCase.assertNull(method.externalKeyword); | 3767 JUnitTestCase.assertNull(method.externalKeyword); |
3768 JUnitTestCase.assertNull(method.modifierKeyword); | 3768 JUnitTestCase.assertNull(method.modifierKeyword); |
3769 JUnitTestCase.assertNotNull(method.name); | 3769 JUnitTestCase.assertNotNull(method.name); |
3770 JUnitTestCase.assertNull(method.operatorKeyword); | 3770 JUnitTestCase.assertNull(method.operatorKeyword); |
3771 JUnitTestCase.assertNotNull(method.parameters); | 3771 JUnitTestCase.assertNotNull(method.parameters); |
3772 JUnitTestCase.assertNotNull(method.propertyKeyword); | 3772 JUnitTestCase.assertNotNull(method.propertyKeyword); |
3773 JUnitTestCase.assertEquals(returnType, method.returnType); | 3773 JUnitTestCase.assertEquals(returnType, method.returnType); |
3774 } | 3774 } |
3775 void test_parseSetter_static() { | 3775 void test_parseSetter_static() { |
3776 Comment comment = Comment.createDocumentationComment(new List<Token>.fixedLe
ngth(0)); | 3776 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
3777 Token staticKeyword = TokenFactory.token(Keyword.STATIC); | 3777 Token staticKeyword = TokenFactory.token(Keyword.STATIC); |
3778 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); | 3778 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul
l); |
3779 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com
mentAndMetadata(comment, []), null, staticKeyword, returnType], "set a(var x) {}
"); | 3779 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com
mentAndMetadata(comment, []), null, staticKeyword, returnType], "set a(var x) {}
"); |
3780 JUnitTestCase.assertNotNull(method.body); | 3780 JUnitTestCase.assertNotNull(method.body); |
3781 JUnitTestCase.assertEquals(comment, method.documentationComment); | 3781 JUnitTestCase.assertEquals(comment, method.documentationComment); |
3782 JUnitTestCase.assertNull(method.externalKeyword); | 3782 JUnitTestCase.assertNull(method.externalKeyword); |
3783 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); | 3783 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); |
3784 JUnitTestCase.assertNotNull(method.name); | 3784 JUnitTestCase.assertNotNull(method.name); |
3785 JUnitTestCase.assertNull(method.operatorKeyword); | 3785 JUnitTestCase.assertNull(method.operatorKeyword); |
3786 JUnitTestCase.assertNotNull(method.parameters); | 3786 JUnitTestCase.assertNotNull(method.parameters); |
(...skipping 4422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8209 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), | 8209 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), |
8210 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), | 8210 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), |
8211 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; | 8211 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; |
8212 | 8212 |
8213 | 8213 |
8214 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { | 8214 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { |
8215 parser.currentToken = tokenStream; | 8215 parser.currentToken = tokenStream; |
8216 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; | 8216 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; |
8217 return method.invoke(parser, objects); | 8217 return method.invoke(parser, objects); |
8218 } | 8218 } |
OLD | NEW |