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 library engine.parser_test; | 3 library engine.parser_test; |
4 import 'dart:collection'; | 4 import 'dart:collection'; |
5 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
8 import 'package:analyzer_experimental/src/generated/source.dart'; | 8 import 'package:analyzer_experimental/src/generated/source.dart'; |
9 import 'package:analyzer_experimental/src/generated/error.dart'; | 9 import 'package:analyzer_experimental/src/generated/error.dart'; |
10 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 JUnitTestCase.assertNull(constructor.name); | 669 JUnitTestCase.assertNull(constructor.name); |
670 JUnitTestCase.assertNotNull(constructor.parameters); | 670 JUnitTestCase.assertNotNull(constructor.parameters); |
671 JUnitTestCase.assertNull(constructor.period); | 671 JUnitTestCase.assertNull(constructor.period); |
672 JUnitTestCase.assertNotNull(constructor.returnType); | 672 JUnitTestCase.assertNotNull(constructor.returnType); |
673 EngineTestCase.assertSize(1, constructor.initializers); | 673 EngineTestCase.assertSize(1, constructor.initializers); |
674 } | 674 } |
675 void test_parseClassMember_field_instance_prefixedType() { | 675 void test_parseClassMember_field_instance_prefixedType() { |
676 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [
"C"], "p.A f;"); | 676 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [
"C"], "p.A f;"); |
677 JUnitTestCase.assertNull(field.documentationComment); | 677 JUnitTestCase.assertNull(field.documentationComment); |
678 EngineTestCase.assertSize(0, field.metadata); | 678 EngineTestCase.assertSize(0, field.metadata); |
679 JUnitTestCase.assertNull(field.keyword); | 679 JUnitTestCase.assertNull(field.staticKeyword); |
680 VariableDeclarationList list = field.fields; | 680 VariableDeclarationList list = field.fields; |
681 JUnitTestCase.assertNotNull(list); | 681 JUnitTestCase.assertNotNull(list); |
682 NodeList<VariableDeclaration> variables = list.variables; | 682 NodeList<VariableDeclaration> variables = list.variables; |
683 EngineTestCase.assertSize(1, variables); | 683 EngineTestCase.assertSize(1, variables); |
684 VariableDeclaration variable = variables[0]; | 684 VariableDeclaration variable = variables[0]; |
685 JUnitTestCase.assertNotNull(variable.name); | 685 JUnitTestCase.assertNotNull(variable.name); |
686 } | 686 } |
687 void test_parseClassMember_field_namedGet() { | 687 void test_parseClassMember_field_namedGet() { |
688 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [
"C"], "var get;"); | 688 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [
"C"], "var get;"); |
689 JUnitTestCase.assertNull(field.documentationComment); | 689 JUnitTestCase.assertNull(field.documentationComment); |
690 EngineTestCase.assertSize(0, field.metadata); | 690 EngineTestCase.assertSize(0, field.metadata); |
691 JUnitTestCase.assertNull(field.keyword); | 691 JUnitTestCase.assertNull(field.staticKeyword); |
692 VariableDeclarationList list = field.fields; | 692 VariableDeclarationList list = field.fields; |
693 JUnitTestCase.assertNotNull(list); | 693 JUnitTestCase.assertNotNull(list); |
694 NodeList<VariableDeclaration> variables = list.variables; | 694 NodeList<VariableDeclaration> variables = list.variables; |
695 EngineTestCase.assertSize(1, variables); | 695 EngineTestCase.assertSize(1, variables); |
696 VariableDeclaration variable = variables[0]; | 696 VariableDeclaration variable = variables[0]; |
697 JUnitTestCase.assertNotNull(variable.name); | 697 JUnitTestCase.assertNotNull(variable.name); |
698 } | 698 } |
699 void test_parseClassMember_field_namedOperator() { | 699 void test_parseClassMember_field_namedOperator() { |
700 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [
"C"], "var operator;"); | 700 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [
"C"], "var operator;"); |
701 JUnitTestCase.assertNull(field.documentationComment); | 701 JUnitTestCase.assertNull(field.documentationComment); |
702 EngineTestCase.assertSize(0, field.metadata); | 702 EngineTestCase.assertSize(0, field.metadata); |
703 JUnitTestCase.assertNull(field.keyword); | 703 JUnitTestCase.assertNull(field.staticKeyword); |
704 VariableDeclarationList list = field.fields; | 704 VariableDeclarationList list = field.fields; |
705 JUnitTestCase.assertNotNull(list); | 705 JUnitTestCase.assertNotNull(list); |
706 NodeList<VariableDeclaration> variables = list.variables; | 706 NodeList<VariableDeclaration> variables = list.variables; |
707 EngineTestCase.assertSize(1, variables); | 707 EngineTestCase.assertSize(1, variables); |
708 VariableDeclaration variable = variables[0]; | 708 VariableDeclaration variable = variables[0]; |
709 JUnitTestCase.assertNotNull(variable.name); | 709 JUnitTestCase.assertNotNull(variable.name); |
710 } | 710 } |
711 void test_parseClassMember_field_namedSet() { | 711 void test_parseClassMember_field_namedSet() { |
712 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [
"C"], "var set;"); | 712 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [
"C"], "var set;"); |
713 JUnitTestCase.assertNull(field.documentationComment); | 713 JUnitTestCase.assertNull(field.documentationComment); |
714 EngineTestCase.assertSize(0, field.metadata); | 714 EngineTestCase.assertSize(0, field.metadata); |
715 JUnitTestCase.assertNull(field.keyword); | 715 JUnitTestCase.assertNull(field.staticKeyword); |
716 VariableDeclarationList list = field.fields; | 716 VariableDeclarationList list = field.fields; |
717 JUnitTestCase.assertNotNull(list); | 717 JUnitTestCase.assertNotNull(list); |
718 NodeList<VariableDeclaration> variables = list.variables; | 718 NodeList<VariableDeclaration> variables = list.variables; |
719 EngineTestCase.assertSize(1, variables); | 719 EngineTestCase.assertSize(1, variables); |
720 VariableDeclaration variable = variables[0]; | 720 VariableDeclaration variable = variables[0]; |
721 JUnitTestCase.assertNotNull(variable.name); | 721 JUnitTestCase.assertNotNull(variable.name); |
722 } | 722 } |
723 void test_parseClassMember_getter_void() { | 723 void test_parseClassMember_getter_void() { |
724 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object>
["C"], "void get g {}"); | 724 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object>
["C"], "void get g {}"); |
725 JUnitTestCase.assertNull(method.documentationComment); | 725 JUnitTestCase.assertNull(method.documentationComment); |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 JUnitTestCase.assertNotNull(expression.keyword); | 1417 JUnitTestCase.assertNotNull(expression.keyword); |
1418 ConstructorName name = expression.constructorName; | 1418 ConstructorName name = expression.constructorName; |
1419 JUnitTestCase.assertNotNull(name); | 1419 JUnitTestCase.assertNotNull(name); |
1420 JUnitTestCase.assertNotNull(name.type); | 1420 JUnitTestCase.assertNotNull(name.type); |
1421 JUnitTestCase.assertNull(name.period); | 1421 JUnitTestCase.assertNull(name.period); |
1422 JUnitTestCase.assertNull(name.name); | 1422 JUnitTestCase.assertNull(name.name); |
1423 JUnitTestCase.assertNotNull(expression.argumentList); | 1423 JUnitTestCase.assertNotNull(expression.argumentList); |
1424 } | 1424 } |
1425 void test_parseConstExpression_listLiteral_typed() { | 1425 void test_parseConstExpression_listLiteral_typed() { |
1426 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <
A> []", []); | 1426 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <
A> []", []); |
1427 JUnitTestCase.assertNotNull(literal.modifier); | 1427 JUnitTestCase.assertNotNull(literal.constKeyword); |
1428 JUnitTestCase.assertNotNull(literal.typeArguments); | 1428 JUnitTestCase.assertNotNull(literal.typeArguments); |
1429 JUnitTestCase.assertNotNull(literal.leftBracket); | 1429 JUnitTestCase.assertNotNull(literal.leftBracket); |
1430 EngineTestCase.assertSize(0, literal.elements); | 1430 EngineTestCase.assertSize(0, literal.elements); |
1431 JUnitTestCase.assertNotNull(literal.rightBracket); | 1431 JUnitTestCase.assertNotNull(literal.rightBracket); |
1432 } | 1432 } |
1433 void test_parseConstExpression_listLiteral_untyped() { | 1433 void test_parseConstExpression_listLiteral_untyped() { |
1434 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const [
]", []); | 1434 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const [
]", []); |
1435 JUnitTestCase.assertNotNull(literal.modifier); | 1435 JUnitTestCase.assertNotNull(literal.constKeyword); |
1436 JUnitTestCase.assertNull(literal.typeArguments); | 1436 JUnitTestCase.assertNull(literal.typeArguments); |
1437 JUnitTestCase.assertNotNull(literal.leftBracket); | 1437 JUnitTestCase.assertNotNull(literal.leftBracket); |
1438 EngineTestCase.assertSize(0, literal.elements); | 1438 EngineTestCase.assertSize(0, literal.elements); |
1439 JUnitTestCase.assertNotNull(literal.rightBracket); | 1439 JUnitTestCase.assertNotNull(literal.rightBracket); |
1440 } | 1440 } |
1441 void test_parseConstExpression_mapLiteral_typed() { | 1441 void test_parseConstExpression_mapLiteral_typed() { |
1442 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <A
, B> {}", []); | 1442 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <A
, B> {}", []); |
1443 JUnitTestCase.assertNotNull(literal.leftBracket); | 1443 JUnitTestCase.assertNotNull(literal.leftBracket); |
1444 EngineTestCase.assertSize(0, literal.entries); | 1444 EngineTestCase.assertSize(0, literal.entries); |
1445 JUnitTestCase.assertNotNull(literal.rightBracket); | 1445 JUnitTestCase.assertNotNull(literal.rightBracket); |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2339 commentAndMetadata(comment, []), | 2339 commentAndMetadata(comment, []), |
2340 staticKeyword, | 2340 staticKeyword, |
2341 null, | 2341 null, |
2342 type], "a = 1, b, c = 3;"); | 2342 type], "a = 1, b, c = 3;"); |
2343 JUnitTestCase.assertEquals(comment, declaration.documentationComment); | 2343 JUnitTestCase.assertEquals(comment, declaration.documentationComment); |
2344 VariableDeclarationList fields = declaration.fields; | 2344 VariableDeclarationList fields = declaration.fields; |
2345 JUnitTestCase.assertNotNull(fields); | 2345 JUnitTestCase.assertNotNull(fields); |
2346 JUnitTestCase.assertNull(fields.keyword); | 2346 JUnitTestCase.assertNull(fields.keyword); |
2347 JUnitTestCase.assertEquals(type, fields.type); | 2347 JUnitTestCase.assertEquals(type, fields.type); |
2348 EngineTestCase.assertSize(3, fields.variables); | 2348 EngineTestCase.assertSize(3, fields.variables); |
2349 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword); | 2349 JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword); |
2350 JUnitTestCase.assertNotNull(declaration.semicolon); | 2350 JUnitTestCase.assertNotNull(declaration.semicolon); |
2351 } | 2351 } |
2352 void test_parseInitializedIdentifierList_var() { | 2352 void test_parseInitializedIdentifierList_var() { |
2353 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); | 2353 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
2354 Token staticKeyword = TokenFactory.token(Keyword.STATIC); | 2354 Token staticKeyword = TokenFactory.token(Keyword.STATIC); |
2355 Token varKeyword = TokenFactory.token(Keyword.VAR); | 2355 Token varKeyword = TokenFactory.token(Keyword.VAR); |
2356 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif
ierList", <Object> [ | 2356 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif
ierList", <Object> [ |
2357 commentAndMetadata(comment, []), | 2357 commentAndMetadata(comment, []), |
2358 staticKeyword, | 2358 staticKeyword, |
2359 varKeyword, | 2359 varKeyword, |
2360 null], "a = 1, b, c = 3;"); | 2360 null], "a = 1, b, c = 3;"); |
2361 JUnitTestCase.assertEquals(comment, declaration.documentationComment); | 2361 JUnitTestCase.assertEquals(comment, declaration.documentationComment); |
2362 VariableDeclarationList fields = declaration.fields; | 2362 VariableDeclarationList fields = declaration.fields; |
2363 JUnitTestCase.assertNotNull(fields); | 2363 JUnitTestCase.assertNotNull(fields); |
2364 JUnitTestCase.assertEquals(varKeyword, fields.keyword); | 2364 JUnitTestCase.assertEquals(varKeyword, fields.keyword); |
2365 JUnitTestCase.assertNull(fields.type); | 2365 JUnitTestCase.assertNull(fields.type); |
2366 EngineTestCase.assertSize(3, fields.variables); | 2366 EngineTestCase.assertSize(3, fields.variables); |
2367 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword); | 2367 JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword); |
2368 JUnitTestCase.assertNotNull(declaration.semicolon); | 2368 JUnitTestCase.assertNotNull(declaration.semicolon); |
2369 } | 2369 } |
2370 void test_parseInstanceCreationExpression_qualifiedType() { | 2370 void test_parseInstanceCreationExpression_qualifiedType() { |
2371 Token token = TokenFactory.token(Keyword.NEW); | 2371 Token token = TokenFactory.token(Keyword.NEW); |
2372 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC
reationExpression", <Object> [token], "A.B()"); | 2372 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC
reationExpression", <Object> [token], "A.B()"); |
2373 JUnitTestCase.assertEquals(token, expression.keyword); | 2373 JUnitTestCase.assertEquals(token, expression.keyword); |
2374 ConstructorName name = expression.constructorName; | 2374 ConstructorName name = expression.constructorName; |
2375 JUnitTestCase.assertNotNull(name); | 2375 JUnitTestCase.assertNotNull(name); |
2376 JUnitTestCase.assertNotNull(name.type); | 2376 JUnitTestCase.assertNotNull(name.type); |
2377 JUnitTestCase.assertNull(name.period); | 2377 JUnitTestCase.assertNull(name.period); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2424 } | 2424 } |
2425 void test_parseLibraryIdentifier_single() { | 2425 void test_parseLibraryIdentifier_single() { |
2426 String name = "a"; | 2426 String name = "a"; |
2427 LibraryIdentifier identifier = ParserTestCase.parse5("parseLibraryIdentifier
", name, []); | 2427 LibraryIdentifier identifier = ParserTestCase.parse5("parseLibraryIdentifier
", name, []); |
2428 JUnitTestCase.assertEquals(name, identifier.name); | 2428 JUnitTestCase.assertEquals(name, identifier.name); |
2429 } | 2429 } |
2430 void test_parseListLiteral_empty_oneToken() { | 2430 void test_parseListLiteral_empty_oneToken() { |
2431 Token token = TokenFactory.token(Keyword.CONST); | 2431 Token token = TokenFactory.token(Keyword.CONST); |
2432 TypeArgumentList typeArguments = null; | 2432 TypeArgumentList typeArguments = null; |
2433 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok
en, typeArguments], "[]"); | 2433 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok
en, typeArguments], "[]"); |
2434 JUnitTestCase.assertEquals(token, literal.modifier); | 2434 JUnitTestCase.assertEquals(token, literal.constKeyword); |
2435 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); | 2435 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); |
2436 JUnitTestCase.assertNotNull(literal.leftBracket); | 2436 JUnitTestCase.assertNotNull(literal.leftBracket); |
2437 EngineTestCase.assertSize(0, literal.elements); | 2437 EngineTestCase.assertSize(0, literal.elements); |
2438 JUnitTestCase.assertNotNull(literal.rightBracket); | 2438 JUnitTestCase.assertNotNull(literal.rightBracket); |
2439 } | 2439 } |
2440 void test_parseListLiteral_empty_twoTokens() { | 2440 void test_parseListLiteral_empty_twoTokens() { |
2441 Token token = TokenFactory.token(Keyword.CONST); | 2441 Token token = TokenFactory.token(Keyword.CONST); |
2442 TypeArgumentList typeArguments = null; | 2442 TypeArgumentList typeArguments = null; |
2443 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok
en, typeArguments], "[ ]"); | 2443 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok
en, typeArguments], "[ ]"); |
2444 JUnitTestCase.assertEquals(token, literal.modifier); | 2444 JUnitTestCase.assertEquals(token, literal.constKeyword); |
2445 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); | 2445 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); |
2446 JUnitTestCase.assertNotNull(literal.leftBracket); | 2446 JUnitTestCase.assertNotNull(literal.leftBracket); |
2447 EngineTestCase.assertSize(0, literal.elements); | 2447 EngineTestCase.assertSize(0, literal.elements); |
2448 JUnitTestCase.assertNotNull(literal.rightBracket); | 2448 JUnitTestCase.assertNotNull(literal.rightBracket); |
2449 } | 2449 } |
2450 void test_parseListLiteral_multiple() { | 2450 void test_parseListLiteral_multiple() { |
2451 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul
l, null], "[1, 2, 3]"); | 2451 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul
l, null], "[1, 2, 3]"); |
2452 JUnitTestCase.assertNull(literal.modifier); | 2452 JUnitTestCase.assertNull(literal.constKeyword); |
2453 JUnitTestCase.assertNull(literal.typeArguments); | 2453 JUnitTestCase.assertNull(literal.typeArguments); |
2454 JUnitTestCase.assertNotNull(literal.leftBracket); | 2454 JUnitTestCase.assertNotNull(literal.leftBracket); |
2455 EngineTestCase.assertSize(3, literal.elements); | 2455 EngineTestCase.assertSize(3, literal.elements); |
2456 JUnitTestCase.assertNotNull(literal.rightBracket); | 2456 JUnitTestCase.assertNotNull(literal.rightBracket); |
2457 } | 2457 } |
2458 void test_parseListLiteral_single() { | 2458 void test_parseListLiteral_single() { |
2459 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul
l, null], "[1]"); | 2459 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul
l, null], "[1]"); |
2460 JUnitTestCase.assertNull(literal.modifier); | 2460 JUnitTestCase.assertNull(literal.constKeyword); |
2461 JUnitTestCase.assertNull(literal.typeArguments); | 2461 JUnitTestCase.assertNull(literal.typeArguments); |
2462 JUnitTestCase.assertNotNull(literal.leftBracket); | 2462 JUnitTestCase.assertNotNull(literal.leftBracket); |
2463 EngineTestCase.assertSize(1, literal.elements); | 2463 EngineTestCase.assertSize(1, literal.elements); |
2464 JUnitTestCase.assertNotNull(literal.rightBracket); | 2464 JUnitTestCase.assertNotNull(literal.rightBracket); |
2465 } | 2465 } |
2466 void test_parseListOrMapLiteral_list_noType() { | 2466 void test_parseListOrMapLiteral_list_noType() { |
2467 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object>
[null], "[1]"); | 2467 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object>
[null], "[1]"); |
2468 JUnitTestCase.assertNull(literal.modifier); | 2468 JUnitTestCase.assertNull(literal.constKeyword); |
2469 JUnitTestCase.assertNull(literal.typeArguments); | 2469 JUnitTestCase.assertNull(literal.typeArguments); |
2470 JUnitTestCase.assertNotNull(literal.leftBracket); | 2470 JUnitTestCase.assertNotNull(literal.leftBracket); |
2471 EngineTestCase.assertSize(1, literal.elements); | 2471 EngineTestCase.assertSize(1, literal.elements); |
2472 JUnitTestCase.assertNotNull(literal.rightBracket); | 2472 JUnitTestCase.assertNotNull(literal.rightBracket); |
2473 } | 2473 } |
2474 void test_parseListOrMapLiteral_list_type() { | 2474 void test_parseListOrMapLiteral_list_type() { |
2475 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object>
[null], "<int> [1]"); | 2475 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object>
[null], "<int> [1]"); |
2476 JUnitTestCase.assertNull(literal.modifier); | 2476 JUnitTestCase.assertNull(literal.constKeyword); |
2477 JUnitTestCase.assertNotNull(literal.typeArguments); | 2477 JUnitTestCase.assertNotNull(literal.typeArguments); |
2478 JUnitTestCase.assertNotNull(literal.leftBracket); | 2478 JUnitTestCase.assertNotNull(literal.leftBracket); |
2479 EngineTestCase.assertSize(1, literal.elements); | 2479 EngineTestCase.assertSize(1, literal.elements); |
2480 JUnitTestCase.assertNotNull(literal.rightBracket); | 2480 JUnitTestCase.assertNotNull(literal.rightBracket); |
2481 } | 2481 } |
2482 void test_parseListOrMapLiteral_map_noType() { | 2482 void test_parseListOrMapLiteral_map_noType() { |
2483 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object>
[null], "{'1' : 1}"); | 2483 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object>
[null], "{'1' : 1}"); |
2484 JUnitTestCase.assertNull(literal.modifier); | 2484 JUnitTestCase.assertNull(literal.constKeyword); |
2485 JUnitTestCase.assertNull(literal.typeArguments); | 2485 JUnitTestCase.assertNull(literal.typeArguments); |
2486 JUnitTestCase.assertNotNull(literal.leftBracket); | 2486 JUnitTestCase.assertNotNull(literal.leftBracket); |
2487 EngineTestCase.assertSize(1, literal.entries); | 2487 EngineTestCase.assertSize(1, literal.entries); |
2488 JUnitTestCase.assertNotNull(literal.rightBracket); | 2488 JUnitTestCase.assertNotNull(literal.rightBracket); |
2489 } | 2489 } |
2490 void test_parseListOrMapLiteral_map_type() { | 2490 void test_parseListOrMapLiteral_map_type() { |
2491 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object>
[null], "<String, int> {'1' : 1}"); | 2491 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object>
[null], "<String, int> {'1' : 1}"); |
2492 JUnitTestCase.assertNull(literal.modifier); | 2492 JUnitTestCase.assertNull(literal.constKeyword); |
2493 JUnitTestCase.assertNotNull(literal.typeArguments); | 2493 JUnitTestCase.assertNotNull(literal.typeArguments); |
2494 JUnitTestCase.assertNotNull(literal.leftBracket); | 2494 JUnitTestCase.assertNotNull(literal.leftBracket); |
2495 EngineTestCase.assertSize(1, literal.entries); | 2495 EngineTestCase.assertSize(1, literal.entries); |
2496 JUnitTestCase.assertNotNull(literal.rightBracket); | 2496 JUnitTestCase.assertNotNull(literal.rightBracket); |
2497 } | 2497 } |
2498 void test_parseLogicalAndExpression() { | 2498 void test_parseLogicalAndExpression() { |
2499 BinaryExpression expression = ParserTestCase.parse5("parseLogicalAndExpressi
on", "x && y", []); | 2499 BinaryExpression expression = ParserTestCase.parse5("parseLogicalAndExpressi
on", "x && y", []); |
2500 JUnitTestCase.assertNotNull(expression.leftOperand); | 2500 JUnitTestCase.assertNotNull(expression.leftOperand); |
2501 JUnitTestCase.assertNotNull(expression.operator); | 2501 JUnitTestCase.assertNotNull(expression.operator); |
2502 JUnitTestCase.assertEquals(TokenType.AMPERSAND_AMPERSAND, expression.operato
r.type); | 2502 JUnitTestCase.assertEquals(TokenType.AMPERSAND_AMPERSAND, expression.operato
r.type); |
2503 JUnitTestCase.assertNotNull(expression.rightOperand); | 2503 JUnitTestCase.assertNotNull(expression.rightOperand); |
2504 } | 2504 } |
2505 void test_parseLogicalOrExpression() { | 2505 void test_parseLogicalOrExpression() { |
2506 BinaryExpression expression = ParserTestCase.parse5("parseLogicalOrExpressio
n", "x || y", []); | 2506 BinaryExpression expression = ParserTestCase.parse5("parseLogicalOrExpressio
n", "x || y", []); |
2507 JUnitTestCase.assertNotNull(expression.leftOperand); | 2507 JUnitTestCase.assertNotNull(expression.leftOperand); |
2508 JUnitTestCase.assertNotNull(expression.operator); | 2508 JUnitTestCase.assertNotNull(expression.operator); |
2509 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type); | 2509 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type); |
2510 JUnitTestCase.assertNotNull(expression.rightOperand); | 2510 JUnitTestCase.assertNotNull(expression.rightOperand); |
2511 } | 2511 } |
2512 void test_parseMapLiteral_empty() { | 2512 void test_parseMapLiteral_empty() { |
2513 Token token = TokenFactory.token(Keyword.CONST); | 2513 Token token = TokenFactory.token(Keyword.CONST); |
2514 TypeArgumentList typeArguments = ASTFactory.typeArgumentList([ | 2514 TypeArgumentList typeArguments = ASTFactory.typeArgumentList([ |
2515 ASTFactory.typeName4("String", []), | 2515 ASTFactory.typeName4("String", []), |
2516 ASTFactory.typeName4("int", [])]); | 2516 ASTFactory.typeName4("int", [])]); |
2517 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token
, typeArguments], "{}"); | 2517 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token
, typeArguments], "{}"); |
2518 JUnitTestCase.assertEquals(token, literal.modifier); | 2518 JUnitTestCase.assertEquals(token, literal.constKeyword); |
2519 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); | 2519 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); |
2520 JUnitTestCase.assertNotNull(literal.leftBracket); | 2520 JUnitTestCase.assertNotNull(literal.leftBracket); |
2521 EngineTestCase.assertSize(0, literal.entries); | 2521 EngineTestCase.assertSize(0, literal.entries); |
2522 JUnitTestCase.assertNotNull(literal.rightBracket); | 2522 JUnitTestCase.assertNotNull(literal.rightBracket); |
2523 } | 2523 } |
2524 void test_parseMapLiteral_multiple() { | 2524 void test_parseMapLiteral_multiple() { |
2525 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null,
null], "{'a' : b, 'x' : y}"); | 2525 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null,
null], "{'a' : b, 'x' : y}"); |
2526 JUnitTestCase.assertNotNull(literal.leftBracket); | 2526 JUnitTestCase.assertNotNull(literal.leftBracket); |
2527 EngineTestCase.assertSize(2, literal.entries); | 2527 EngineTestCase.assertSize(2, literal.entries); |
2528 JUnitTestCase.assertNotNull(literal.rightBracket); | 2528 JUnitTestCase.assertNotNull(literal.rightBracket); |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3247 EngineTestCase.assertSize(1, catchClauses); | 3247 EngineTestCase.assertSize(1, catchClauses); |
3248 CatchClause clause = catchClauses[0]; | 3248 CatchClause clause = catchClauses[0]; |
3249 JUnitTestCase.assertNull(clause.onKeyword); | 3249 JUnitTestCase.assertNull(clause.onKeyword); |
3250 JUnitTestCase.assertNull(clause.exceptionType); | 3250 JUnitTestCase.assertNull(clause.exceptionType); |
3251 JUnitTestCase.assertNotNull(clause.catchKeyword); | 3251 JUnitTestCase.assertNotNull(clause.catchKeyword); |
3252 JUnitTestCase.assertNotNull(clause.exceptionParameter); | 3252 JUnitTestCase.assertNotNull(clause.exceptionParameter); |
3253 JUnitTestCase.assertNull(clause.comma); | 3253 JUnitTestCase.assertNull(clause.comma); |
3254 JUnitTestCase.assertNull(clause.stackTraceParameter); | 3254 JUnitTestCase.assertNull(clause.stackTraceParameter); |
3255 JUnitTestCase.assertNotNull(clause.body); | 3255 JUnitTestCase.assertNotNull(clause.body); |
3256 JUnitTestCase.assertNull(statement.finallyKeyword); | 3256 JUnitTestCase.assertNull(statement.finallyKeyword); |
3257 JUnitTestCase.assertNull(statement.finallyClause); | 3257 JUnitTestCase.assertNull(statement.finallyBlock); |
3258 } | 3258 } |
3259 void test_parseTryStatement_catch_finally() { | 3259 void test_parseTryStatement_catch_finally() { |
3260 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
catch (e, s) {} finally {}", []); | 3260 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
catch (e, s) {} finally {}", []); |
3261 JUnitTestCase.assertNotNull(statement.tryKeyword); | 3261 JUnitTestCase.assertNotNull(statement.tryKeyword); |
3262 JUnitTestCase.assertNotNull(statement.body); | 3262 JUnitTestCase.assertNotNull(statement.body); |
3263 NodeList<CatchClause> catchClauses = statement.catchClauses; | 3263 NodeList<CatchClause> catchClauses = statement.catchClauses; |
3264 EngineTestCase.assertSize(1, catchClauses); | 3264 EngineTestCase.assertSize(1, catchClauses); |
3265 CatchClause clause = catchClauses[0]; | 3265 CatchClause clause = catchClauses[0]; |
3266 JUnitTestCase.assertNull(clause.onKeyword); | 3266 JUnitTestCase.assertNull(clause.onKeyword); |
3267 JUnitTestCase.assertNull(clause.exceptionType); | 3267 JUnitTestCase.assertNull(clause.exceptionType); |
3268 JUnitTestCase.assertNotNull(clause.catchKeyword); | 3268 JUnitTestCase.assertNotNull(clause.catchKeyword); |
3269 JUnitTestCase.assertNotNull(clause.exceptionParameter); | 3269 JUnitTestCase.assertNotNull(clause.exceptionParameter); |
3270 JUnitTestCase.assertNotNull(clause.comma); | 3270 JUnitTestCase.assertNotNull(clause.comma); |
3271 JUnitTestCase.assertNotNull(clause.stackTraceParameter); | 3271 JUnitTestCase.assertNotNull(clause.stackTraceParameter); |
3272 JUnitTestCase.assertNotNull(clause.body); | 3272 JUnitTestCase.assertNotNull(clause.body); |
3273 JUnitTestCase.assertNotNull(statement.finallyKeyword); | 3273 JUnitTestCase.assertNotNull(statement.finallyKeyword); |
3274 JUnitTestCase.assertNotNull(statement.finallyClause); | 3274 JUnitTestCase.assertNotNull(statement.finallyBlock); |
3275 } | 3275 } |
3276 void test_parseTryStatement_finally() { | 3276 void test_parseTryStatement_finally() { |
3277 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
finally {}", []); | 3277 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
finally {}", []); |
3278 JUnitTestCase.assertNotNull(statement.tryKeyword); | 3278 JUnitTestCase.assertNotNull(statement.tryKeyword); |
3279 JUnitTestCase.assertNotNull(statement.body); | 3279 JUnitTestCase.assertNotNull(statement.body); |
3280 EngineTestCase.assertSize(0, statement.catchClauses); | 3280 EngineTestCase.assertSize(0, statement.catchClauses); |
3281 JUnitTestCase.assertNotNull(statement.finallyKeyword); | 3281 JUnitTestCase.assertNotNull(statement.finallyKeyword); |
3282 JUnitTestCase.assertNotNull(statement.finallyClause); | 3282 JUnitTestCase.assertNotNull(statement.finallyBlock); |
3283 } | 3283 } |
3284 void test_parseTryStatement_multiple() { | 3284 void test_parseTryStatement_multiple() { |
3285 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
on NPE catch (e) {} on Error {} catch (e) {}", []); | 3285 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
on NPE catch (e) {} on Error {} catch (e) {}", []); |
3286 JUnitTestCase.assertNotNull(statement.tryKeyword); | 3286 JUnitTestCase.assertNotNull(statement.tryKeyword); |
3287 JUnitTestCase.assertNotNull(statement.body); | 3287 JUnitTestCase.assertNotNull(statement.body); |
3288 EngineTestCase.assertSize(3, statement.catchClauses); | 3288 EngineTestCase.assertSize(3, statement.catchClauses); |
3289 JUnitTestCase.assertNull(statement.finallyKeyword); | 3289 JUnitTestCase.assertNull(statement.finallyKeyword); |
3290 JUnitTestCase.assertNull(statement.finallyClause); | 3290 JUnitTestCase.assertNull(statement.finallyBlock); |
3291 } | 3291 } |
3292 void test_parseTryStatement_on() { | 3292 void test_parseTryStatement_on() { |
3293 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
on Error {}", []); | 3293 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
on Error {}", []); |
3294 JUnitTestCase.assertNotNull(statement.tryKeyword); | 3294 JUnitTestCase.assertNotNull(statement.tryKeyword); |
3295 JUnitTestCase.assertNotNull(statement.body); | 3295 JUnitTestCase.assertNotNull(statement.body); |
3296 NodeList<CatchClause> catchClauses = statement.catchClauses; | 3296 NodeList<CatchClause> catchClauses = statement.catchClauses; |
3297 EngineTestCase.assertSize(1, catchClauses); | 3297 EngineTestCase.assertSize(1, catchClauses); |
3298 CatchClause clause = catchClauses[0]; | 3298 CatchClause clause = catchClauses[0]; |
3299 JUnitTestCase.assertNotNull(clause.onKeyword); | 3299 JUnitTestCase.assertNotNull(clause.onKeyword); |
3300 JUnitTestCase.assertNotNull(clause.exceptionType); | 3300 JUnitTestCase.assertNotNull(clause.exceptionType); |
3301 JUnitTestCase.assertNull(clause.catchKeyword); | 3301 JUnitTestCase.assertNull(clause.catchKeyword); |
3302 JUnitTestCase.assertNull(clause.exceptionParameter); | 3302 JUnitTestCase.assertNull(clause.exceptionParameter); |
3303 JUnitTestCase.assertNull(clause.comma); | 3303 JUnitTestCase.assertNull(clause.comma); |
3304 JUnitTestCase.assertNull(clause.stackTraceParameter); | 3304 JUnitTestCase.assertNull(clause.stackTraceParameter); |
3305 JUnitTestCase.assertNotNull(clause.body); | 3305 JUnitTestCase.assertNotNull(clause.body); |
3306 JUnitTestCase.assertNull(statement.finallyKeyword); | 3306 JUnitTestCase.assertNull(statement.finallyKeyword); |
3307 JUnitTestCase.assertNull(statement.finallyClause); | 3307 JUnitTestCase.assertNull(statement.finallyBlock); |
3308 } | 3308 } |
3309 void test_parseTryStatement_on_catch() { | 3309 void test_parseTryStatement_on_catch() { |
3310 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
on Error catch (e, s) {}", []); | 3310 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
on Error catch (e, s) {}", []); |
3311 JUnitTestCase.assertNotNull(statement.tryKeyword); | 3311 JUnitTestCase.assertNotNull(statement.tryKeyword); |
3312 JUnitTestCase.assertNotNull(statement.body); | 3312 JUnitTestCase.assertNotNull(statement.body); |
3313 NodeList<CatchClause> catchClauses = statement.catchClauses; | 3313 NodeList<CatchClause> catchClauses = statement.catchClauses; |
3314 EngineTestCase.assertSize(1, catchClauses); | 3314 EngineTestCase.assertSize(1, catchClauses); |
3315 CatchClause clause = catchClauses[0]; | 3315 CatchClause clause = catchClauses[0]; |
3316 JUnitTestCase.assertNotNull(clause.onKeyword); | 3316 JUnitTestCase.assertNotNull(clause.onKeyword); |
3317 JUnitTestCase.assertNotNull(clause.exceptionType); | 3317 JUnitTestCase.assertNotNull(clause.exceptionType); |
3318 JUnitTestCase.assertNotNull(clause.catchKeyword); | 3318 JUnitTestCase.assertNotNull(clause.catchKeyword); |
3319 JUnitTestCase.assertNotNull(clause.exceptionParameter); | 3319 JUnitTestCase.assertNotNull(clause.exceptionParameter); |
3320 JUnitTestCase.assertNotNull(clause.comma); | 3320 JUnitTestCase.assertNotNull(clause.comma); |
3321 JUnitTestCase.assertNotNull(clause.stackTraceParameter); | 3321 JUnitTestCase.assertNotNull(clause.stackTraceParameter); |
3322 JUnitTestCase.assertNotNull(clause.body); | 3322 JUnitTestCase.assertNotNull(clause.body); |
3323 JUnitTestCase.assertNull(statement.finallyKeyword); | 3323 JUnitTestCase.assertNull(statement.finallyKeyword); |
3324 JUnitTestCase.assertNull(statement.finallyClause); | 3324 JUnitTestCase.assertNull(statement.finallyBlock); |
3325 } | 3325 } |
3326 void test_parseTryStatement_on_catch_finally() { | 3326 void test_parseTryStatement_on_catch_finally() { |
3327 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
on Error catch (e, s) {} finally {}", []); | 3327 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}
on Error catch (e, s) {} finally {}", []); |
3328 JUnitTestCase.assertNotNull(statement.tryKeyword); | 3328 JUnitTestCase.assertNotNull(statement.tryKeyword); |
3329 JUnitTestCase.assertNotNull(statement.body); | 3329 JUnitTestCase.assertNotNull(statement.body); |
3330 NodeList<CatchClause> catchClauses = statement.catchClauses; | 3330 NodeList<CatchClause> catchClauses = statement.catchClauses; |
3331 EngineTestCase.assertSize(1, catchClauses); | 3331 EngineTestCase.assertSize(1, catchClauses); |
3332 CatchClause clause = catchClauses[0]; | 3332 CatchClause clause = catchClauses[0]; |
3333 JUnitTestCase.assertNotNull(clause.onKeyword); | 3333 JUnitTestCase.assertNotNull(clause.onKeyword); |
3334 JUnitTestCase.assertNotNull(clause.exceptionType); | 3334 JUnitTestCase.assertNotNull(clause.exceptionType); |
3335 JUnitTestCase.assertNotNull(clause.catchKeyword); | 3335 JUnitTestCase.assertNotNull(clause.catchKeyword); |
3336 JUnitTestCase.assertNotNull(clause.exceptionParameter); | 3336 JUnitTestCase.assertNotNull(clause.exceptionParameter); |
3337 JUnitTestCase.assertNotNull(clause.comma); | 3337 JUnitTestCase.assertNotNull(clause.comma); |
3338 JUnitTestCase.assertNotNull(clause.stackTraceParameter); | 3338 JUnitTestCase.assertNotNull(clause.stackTraceParameter); |
3339 JUnitTestCase.assertNotNull(clause.body); | 3339 JUnitTestCase.assertNotNull(clause.body); |
3340 JUnitTestCase.assertNotNull(statement.finallyKeyword); | 3340 JUnitTestCase.assertNotNull(statement.finallyKeyword); |
3341 JUnitTestCase.assertNotNull(statement.finallyClause); | 3341 JUnitTestCase.assertNotNull(statement.finallyBlock); |
3342 } | 3342 } |
3343 void test_parseTypeAlias_class_implementsC() { | 3343 void test_parseTypeAlias_class_implementsC() { |
3344 ClassTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [
emptyCommentAndMetadata()], "typedef A = Object with B implements C;"); | 3344 ClassTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [
emptyCommentAndMetadata()], "typedef A = Object with B implements C;"); |
3345 JUnitTestCase.assertNotNull(typeAlias.keyword); | 3345 JUnitTestCase.assertNotNull(typeAlias.keyword); |
3346 JUnitTestCase.assertNotNull(typeAlias.name); | 3346 JUnitTestCase.assertNotNull(typeAlias.name); |
3347 JUnitTestCase.assertNull(typeAlias.typeParameters); | 3347 JUnitTestCase.assertNull(typeAlias.typeParameters); |
3348 JUnitTestCase.assertNotNull(typeAlias.withClause); | 3348 JUnitTestCase.assertNotNull(typeAlias.withClause); |
3349 JUnitTestCase.assertNotNull(typeAlias.implementsClause); | 3349 JUnitTestCase.assertNotNull(typeAlias.implementsClause); |
3350 JUnitTestCase.assertNotNull(typeAlias.implementsClause.keyword); | 3350 JUnitTestCase.assertNotNull(typeAlias.implementsClause.keyword); |
3351 JUnitTestCase.assertEquals(1, typeAlias.implementsClause.interfaces.length); | 3351 JUnitTestCase.assertEquals(1, typeAlias.implementsClause.interfaces.length); |
(...skipping 6110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9462 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), | 9462 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), |
9463 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), | 9463 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), |
9464 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; | 9464 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; |
9465 | 9465 |
9466 | 9466 |
9467 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { | 9467 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { |
9468 parser.currentToken = tokenStream; | 9468 parser.currentToken = tokenStream; |
9469 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; | 9469 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; |
9470 return method.invoke(parser, objects); | 9470 return method.invoke(parser, objects); |
9471 } | 9471 } |
OLD | NEW |