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

Side by Side Diff: pkg/analyzer_experimental/test/generated/parser_test.dart

Issue 16337007: Version 0.5.13.1 . (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 import 'ast_test.dart' show ASTFactory;
20
19 21
20 /** 22 /**
21 * The class {@code SimpleParserTest} defines parser tests that test individual parsing method. The 23 * The class {@code SimpleParserTest} defines parser tests that test individual parsing method. The
22 * code fragments should be as minimal as possible in order to test the method, but should not test 24 * code fragments should be as minimal as possible in order to test the method, but should not test
23 * the interactions between the method under test and other methods. 25 * the interactions between the method under test and other methods.
24 * <p> 26 * <p>
25 * More complex tests should be defined in the class {@link ComplexParserTest}. 27 * More complex tests should be defined in the class {@link ComplexParserTest}.
26 */ 28 */
27 class SimpleParserTest extends ParserTestCase { 29 class SimpleParserTest extends ParserTestCase {
28 void fail_parseCommentReference_this() { 30 void fail_parseCommentReference_this() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 75 }
74 void test_computeStringValue_raw_single() { 76 void test_computeStringValue_raw_single() {
75 JUnitTestCase.assertEquals("text", computeStringValue("r'text'")); 77 JUnitTestCase.assertEquals("text", computeStringValue("r'text'"));
76 } 78 }
77 void test_computeStringValue_raw_triple() { 79 void test_computeStringValue_raw_triple() {
78 JUnitTestCase.assertEquals("text", computeStringValue("r'''text'''")); 80 JUnitTestCase.assertEquals("text", computeStringValue("r'''text'''"));
79 } 81 }
80 void test_computeStringValue_raw_withEscape() { 82 void test_computeStringValue_raw_withEscape() {
81 JUnitTestCase.assertEquals("two\\nlines", computeStringValue("r'two\\nlines' ")); 83 JUnitTestCase.assertEquals("two\\nlines", computeStringValue("r'two\\nlines' "));
82 } 84 }
85 void test_constFactory() {
86 ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;");
87 }
83 void test_createSyntheticIdentifier() { 88 void test_createSyntheticIdentifier() {
84 SimpleIdentifier identifier = createSyntheticIdentifier(); 89 SimpleIdentifier identifier = createSyntheticIdentifier();
85 JUnitTestCase.assertTrue(identifier.isSynthetic()); 90 JUnitTestCase.assertTrue(identifier.isSynthetic());
86 } 91 }
87 void test_createSyntheticStringLiteral() { 92 void test_createSyntheticStringLiteral() {
88 SimpleStringLiteral literal = createSyntheticStringLiteral(); 93 SimpleStringLiteral literal = createSyntheticStringLiteral();
89 JUnitTestCase.assertTrue(literal.isSynthetic()); 94 JUnitTestCase.assertTrue(literal.isSynthetic());
90 } 95 }
91 void test_isFunctionDeclaration_nameButNoReturn_block() { 96 void test_isFunctionDeclaration_nameButNoReturn_block() {
92 JUnitTestCase.assertTrue(isFunctionDeclaration("f() {}")); 97 JUnitTestCase.assertTrue(isFunctionDeclaration("f() {}"));
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 } 1401 }
1397 void test_parseConstExpression_listLiteral_untyped() { 1402 void test_parseConstExpression_listLiteral_untyped() {
1398 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const [ ]", []); 1403 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const [ ]", []);
1399 JUnitTestCase.assertNotNull(literal.modifier); 1404 JUnitTestCase.assertNotNull(literal.modifier);
1400 JUnitTestCase.assertNull(literal.typeArguments); 1405 JUnitTestCase.assertNull(literal.typeArguments);
1401 JUnitTestCase.assertNotNull(literal.leftBracket); 1406 JUnitTestCase.assertNotNull(literal.leftBracket);
1402 EngineTestCase.assertSize(0, literal.elements); 1407 EngineTestCase.assertSize(0, literal.elements);
1403 JUnitTestCase.assertNotNull(literal.rightBracket); 1408 JUnitTestCase.assertNotNull(literal.rightBracket);
1404 } 1409 }
1405 void test_parseConstExpression_mapLiteral_typed() { 1410 void test_parseConstExpression_mapLiteral_typed() {
1406 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <A > {}", []); 1411 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <A , B> {}", []);
1407 JUnitTestCase.assertNotNull(literal.leftBracket); 1412 JUnitTestCase.assertNotNull(literal.leftBracket);
1408 EngineTestCase.assertSize(0, literal.entries); 1413 EngineTestCase.assertSize(0, literal.entries);
1409 JUnitTestCase.assertNotNull(literal.rightBracket); 1414 JUnitTestCase.assertNotNull(literal.rightBracket);
1410 JUnitTestCase.assertNotNull(literal.typeArguments); 1415 JUnitTestCase.assertNotNull(literal.typeArguments);
1411 } 1416 }
1412 void test_parseConstExpression_mapLiteral_untyped() { 1417 void test_parseConstExpression_mapLiteral_untyped() {
1413 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const {} ", []); 1418 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const {} ", []);
1414 JUnitTestCase.assertNotNull(literal.leftBracket); 1419 JUnitTestCase.assertNotNull(literal.leftBracket);
1415 EngineTestCase.assertSize(0, literal.entries); 1420 EngineTestCase.assertSize(0, literal.entries);
1416 JUnitTestCase.assertNotNull(literal.rightBracket); 1421 JUnitTestCase.assertNotNull(literal.rightBracket);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 JUnitTestCase.assertNotNull(result.type); 1677 JUnitTestCase.assertNotNull(result.type);
1673 } 1678 }
1674 void test_parseFinalConstVarOrType_final_noType() { 1679 void test_parseFinalConstVarOrType_final_noType() {
1675 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final"); 1680 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final");
1676 Token keyword2 = result.keyword; 1681 Token keyword2 = result.keyword;
1677 JUnitTestCase.assertNotNull(keyword2); 1682 JUnitTestCase.assertNotNull(keyword2);
1678 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword2.type); 1683 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword2.type);
1679 JUnitTestCase.assertEquals(Keyword.FINAL, ((keyword2 as KeywordToken)).keywo rd); 1684 JUnitTestCase.assertEquals(Keyword.FINAL, ((keyword2 as KeywordToken)).keywo rd);
1680 JUnitTestCase.assertNull(result.type); 1685 JUnitTestCase.assertNull(result.type);
1681 } 1686 }
1687 void test_parseFinalConstVarOrType_final_prefixedType() {
1688 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final p.A a");
1689 Token keyword2 = result.keyword;
1690 JUnitTestCase.assertNotNull(keyword2);
1691 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword2.type);
1692 JUnitTestCase.assertEquals(Keyword.FINAL, ((keyword2 as KeywordToken)).keywo rd);
1693 JUnitTestCase.assertNotNull(result.type);
1694 }
1682 void test_parseFinalConstVarOrType_final_type() { 1695 void test_parseFinalConstVarOrType_final_type() {
1683 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final A a"); 1696 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final A a");
1684 Token keyword2 = result.keyword; 1697 Token keyword2 = result.keyword;
1685 JUnitTestCase.assertNotNull(keyword2); 1698 JUnitTestCase.assertNotNull(keyword2);
1686 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword2.type); 1699 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword2.type);
1687 JUnitTestCase.assertEquals(Keyword.FINAL, ((keyword2 as KeywordToken)).keywo rd); 1700 JUnitTestCase.assertEquals(Keyword.FINAL, ((keyword2 as KeywordToken)).keywo rd);
1688 JUnitTestCase.assertNotNull(result.type); 1701 JUnitTestCase.assertNotNull(result.type);
1689 } 1702 }
1690 void test_parseFinalConstVarOrType_type_parameterized() { 1703 void test_parseFinalConstVarOrType_type_parameterized() {
1691 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A<B> a"); 1704 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A<B> a");
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 JUnitTestCase.assertNull(statement.variables); 2075 JUnitTestCase.assertNull(statement.variables);
2063 JUnitTestCase.assertNull(statement.initialization); 2076 JUnitTestCase.assertNull(statement.initialization);
2064 JUnitTestCase.assertNotNull(statement.leftSeparator); 2077 JUnitTestCase.assertNotNull(statement.leftSeparator);
2065 JUnitTestCase.assertNull(statement.condition); 2078 JUnitTestCase.assertNull(statement.condition);
2066 JUnitTestCase.assertNotNull(statement.rightSeparator); 2079 JUnitTestCase.assertNotNull(statement.rightSeparator);
2067 EngineTestCase.assertSize(1, statement.updaters); 2080 EngineTestCase.assertSize(1, statement.updaters);
2068 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2081 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2069 JUnitTestCase.assertNotNull(statement.body); 2082 JUnitTestCase.assertNotNull(statement.body);
2070 } 2083 }
2071 void test_parseFunctionBody_block() { 2084 void test_parseFunctionBody_block() {
2072 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, false], "{}"); 2085 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "{}");
2073 JUnitTestCase.assertNotNull(functionBody.block); 2086 JUnitTestCase.assertNotNull(functionBody.block);
2074 } 2087 }
2075 void test_parseFunctionBody_empty() { 2088 void test_parseFunctionBody_empty() {
2076 EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [true, false], ";"); 2089 EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [true, null, false], ";");
2077 JUnitTestCase.assertNotNull(functionBody.semicolon); 2090 JUnitTestCase.assertNotNull(functionBody.semicolon);
2078 } 2091 }
2079 void test_parseFunctionBody_expression() { 2092 void test_parseFunctionBody_expression() {
2080 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod y", <Object> [false, false], "=> y;"); 2093 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod y", <Object> [false, null, false], "=> y;");
2081 JUnitTestCase.assertNotNull(functionBody.functionDefinition); 2094 JUnitTestCase.assertNotNull(functionBody.functionDefinition);
2082 JUnitTestCase.assertNotNull(functionBody.expression); 2095 JUnitTestCase.assertNotNull(functionBody.expression);
2083 JUnitTestCase.assertNotNull(functionBody.semicolon); 2096 JUnitTestCase.assertNotNull(functionBody.semicolon);
2084 } 2097 }
2085 void test_parseFunctionBody_nativeFunctionBody() { 2098 void test_parseFunctionBody_nativeFunctionBody() {
2086 NativeFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, false], "native 'str';"); 2099 NativeFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "native 'str';");
2087 JUnitTestCase.assertNotNull(functionBody.nativeToken); 2100 JUnitTestCase.assertNotNull(functionBody.nativeToken);
2088 JUnitTestCase.assertNotNull(functionBody.stringLiteral); 2101 JUnitTestCase.assertNotNull(functionBody.stringLiteral);
2089 JUnitTestCase.assertNotNull(functionBody.semicolon); 2102 JUnitTestCase.assertNotNull(functionBody.semicolon);
2090 } 2103 }
2091 void test_parseFunctionDeclaration_function() { 2104 void test_parseFunctionDeclaration_function() {
2092 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2105 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2093 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 2106 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2094 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "f() {}"); 2107 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "f() {}");
2095 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 2108 JUnitTestCase.assertEquals(comment, declaration.documentationComment);
2096 JUnitTestCase.assertEquals(returnType, declaration.returnType); 2109 JUnitTestCase.assertEquals(returnType, declaration.returnType);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 JUnitTestCase.assertNotNull(method.name); 2166 JUnitTestCase.assertNotNull(method.name);
2154 JUnitTestCase.assertNull(method.operatorKeyword); 2167 JUnitTestCase.assertNull(method.operatorKeyword);
2155 JUnitTestCase.assertNull(method.parameters); 2168 JUnitTestCase.assertNull(method.parameters);
2156 JUnitTestCase.assertNotNull(method.propertyKeyword); 2169 JUnitTestCase.assertNotNull(method.propertyKeyword);
2157 JUnitTestCase.assertEquals(returnType, method.returnType); 2170 JUnitTestCase.assertEquals(returnType, method.returnType);
2158 } 2171 }
2159 void test_parseGetter_static() { 2172 void test_parseGetter_static() {
2160 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2173 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2161 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 2174 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
2162 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 2175 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2163 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com mentAndMetadata(comment, []), null, staticKeyword, returnType], "get a;"); 2176 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com mentAndMetadata(comment, []), null, staticKeyword, returnType], "get a => 42;");
2164 JUnitTestCase.assertNotNull(method.body); 2177 JUnitTestCase.assertNotNull(method.body);
2165 JUnitTestCase.assertEquals(comment, method.documentationComment); 2178 JUnitTestCase.assertEquals(comment, method.documentationComment);
2166 JUnitTestCase.assertNull(method.externalKeyword); 2179 JUnitTestCase.assertNull(method.externalKeyword);
2167 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); 2180 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword);
2168 JUnitTestCase.assertNotNull(method.name); 2181 JUnitTestCase.assertNotNull(method.name);
2169 JUnitTestCase.assertNull(method.operatorKeyword); 2182 JUnitTestCase.assertNull(method.operatorKeyword);
2170 JUnitTestCase.assertNull(method.parameters); 2183 JUnitTestCase.assertNull(method.parameters);
2171 JUnitTestCase.assertNotNull(method.propertyKeyword); 2184 JUnitTestCase.assertNotNull(method.propertyKeyword);
2172 JUnitTestCase.assertEquals(returnType, method.returnType); 2185 JUnitTestCase.assertEquals(returnType, method.returnType);
2173 } 2186 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2425 } 2438 }
2426 void test_parseListOrMapLiteral_map_noType() { 2439 void test_parseListOrMapLiteral_map_noType() {
2427 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}"); 2440 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}");
2428 JUnitTestCase.assertNull(literal.modifier); 2441 JUnitTestCase.assertNull(literal.modifier);
2429 JUnitTestCase.assertNull(literal.typeArguments); 2442 JUnitTestCase.assertNull(literal.typeArguments);
2430 JUnitTestCase.assertNotNull(literal.leftBracket); 2443 JUnitTestCase.assertNotNull(literal.leftBracket);
2431 EngineTestCase.assertSize(1, literal.entries); 2444 EngineTestCase.assertSize(1, literal.entries);
2432 JUnitTestCase.assertNotNull(literal.rightBracket); 2445 JUnitTestCase.assertNotNull(literal.rightBracket);
2433 } 2446 }
2434 void test_parseListOrMapLiteral_map_type() { 2447 void test_parseListOrMapLiteral_map_type() {
2435 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> {'1' : 1}"); 2448 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}");
2436 JUnitTestCase.assertNull(literal.modifier); 2449 JUnitTestCase.assertNull(literal.modifier);
2437 JUnitTestCase.assertNotNull(literal.typeArguments); 2450 JUnitTestCase.assertNotNull(literal.typeArguments);
2438 JUnitTestCase.assertNotNull(literal.leftBracket); 2451 JUnitTestCase.assertNotNull(literal.leftBracket);
2439 EngineTestCase.assertSize(1, literal.entries); 2452 EngineTestCase.assertSize(1, literal.entries);
2440 JUnitTestCase.assertNotNull(literal.rightBracket); 2453 JUnitTestCase.assertNotNull(literal.rightBracket);
2441 } 2454 }
2442 void test_parseLogicalAndExpression() { 2455 void test_parseLogicalAndExpression() {
2443 BinaryExpression expression = ParserTestCase.parse5("parseLogicalAndExpressi on", "x && y", []); 2456 BinaryExpression expression = ParserTestCase.parse5("parseLogicalAndExpressi on", "x && y", []);
2444 JUnitTestCase.assertNotNull(expression.leftOperand); 2457 JUnitTestCase.assertNotNull(expression.leftOperand);
2445 JUnitTestCase.assertNotNull(expression.operator); 2458 JUnitTestCase.assertNotNull(expression.operator);
2446 JUnitTestCase.assertEquals(TokenType.AMPERSAND_AMPERSAND, expression.operato r.type); 2459 JUnitTestCase.assertEquals(TokenType.AMPERSAND_AMPERSAND, expression.operato r.type);
2447 JUnitTestCase.assertNotNull(expression.rightOperand); 2460 JUnitTestCase.assertNotNull(expression.rightOperand);
2448 } 2461 }
2449 void test_parseLogicalOrExpression() { 2462 void test_parseLogicalOrExpression() {
2450 BinaryExpression expression = ParserTestCase.parse5("parseLogicalOrExpressio n", "x || y", []); 2463 BinaryExpression expression = ParserTestCase.parse5("parseLogicalOrExpressio n", "x || y", []);
2451 JUnitTestCase.assertNotNull(expression.leftOperand); 2464 JUnitTestCase.assertNotNull(expression.leftOperand);
2452 JUnitTestCase.assertNotNull(expression.operator); 2465 JUnitTestCase.assertNotNull(expression.operator);
2453 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type); 2466 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type);
2454 JUnitTestCase.assertNotNull(expression.rightOperand); 2467 JUnitTestCase.assertNotNull(expression.rightOperand);
2455 } 2468 }
2456 void test_parseMapLiteral_empty() { 2469 void test_parseMapLiteral_empty() {
2457 Token token2 = TokenFactory.token(Keyword.CONST); 2470 Token token2 = TokenFactory.token(Keyword.CONST);
2458 TypeArgumentList typeArguments = new TypeArgumentList.full(null, null, null) ; 2471 TypeArgumentList typeArguments = ASTFactory.typeArgumentList([ASTFactory.typ eName4("String", []), ASTFactory.typeName4("int", [])]);
2459 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token 2, typeArguments], "{}"); 2472 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token 2, typeArguments], "{}");
2460 JUnitTestCase.assertEquals(token2, literal.modifier); 2473 JUnitTestCase.assertEquals(token2, literal.modifier);
2461 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); 2474 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments);
2462 JUnitTestCase.assertNotNull(literal.leftBracket); 2475 JUnitTestCase.assertNotNull(literal.leftBracket);
2463 EngineTestCase.assertSize(0, literal.entries); 2476 EngineTestCase.assertSize(0, literal.entries);
2464 JUnitTestCase.assertNotNull(literal.rightBracket); 2477 JUnitTestCase.assertNotNull(literal.rightBracket);
2465 } 2478 }
2466 void test_parseMapLiteral_multiple() { 2479 void test_parseMapLiteral_multiple() {
2467 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}"); 2480 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}");
2468 JUnitTestCase.assertNotNull(literal.leftBracket); 2481 JUnitTestCase.assertNotNull(literal.leftBracket);
2469 EngineTestCase.assertSize(2, literal.entries); 2482 EngineTestCase.assertSize(2, literal.entries);
2470 JUnitTestCase.assertNotNull(literal.rightBracket); 2483 JUnitTestCase.assertNotNull(literal.rightBracket);
2471 } 2484 }
2472 void test_parseMapLiteral_single() { 2485 void test_parseMapLiteral_single() {
2473 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'x' : y}"); 2486 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'x' : y}");
2474 JUnitTestCase.assertNotNull(literal.leftBracket); 2487 JUnitTestCase.assertNotNull(literal.leftBracket);
2475 EngineTestCase.assertSize(1, literal.entries); 2488 EngineTestCase.assertSize(1, literal.entries);
2476 JUnitTestCase.assertNotNull(literal.rightBracket); 2489 JUnitTestCase.assertNotNull(literal.rightBracket);
2477 } 2490 }
2478 void test_parseMapLiteralEntry() { 2491 void test_parseMapLiteralEntry_complex() {
2492 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "2 + 2 : y", []);
2493 JUnitTestCase.assertNotNull(entry.key);
2494 JUnitTestCase.assertNotNull(entry.separator);
2495 JUnitTestCase.assertNotNull(entry.value);
2496 }
2497 void test_parseMapLiteralEntry_int() {
2498 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "0 : y ", []);
2499 JUnitTestCase.assertNotNull(entry.key);
2500 JUnitTestCase.assertNotNull(entry.separator);
2501 JUnitTestCase.assertNotNull(entry.value);
2502 }
2503 void test_parseMapLiteralEntry_string() {
2479 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "'x' : y", []); 2504 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "'x' : y", []);
2480 JUnitTestCase.assertNotNull(entry.key); 2505 JUnitTestCase.assertNotNull(entry.key);
2481 JUnitTestCase.assertNotNull(entry.separator); 2506 JUnitTestCase.assertNotNull(entry.separator);
2482 JUnitTestCase.assertNotNull(entry.value); 2507 JUnitTestCase.assertNotNull(entry.value);
2483 } 2508 }
2484 void test_parseModifiers_abstract() { 2509 void test_parseModifiers_abstract() {
2485 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "abstract A", []); 2510 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "abstract A", []);
2486 JUnitTestCase.assertNotNull(modifiers.abstractKeyword); 2511 JUnitTestCase.assertNotNull(modifiers.abstractKeyword);
2487 } 2512 }
2488 void test_parseModifiers_const() { 2513 void test_parseModifiers_const() {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 JUnitTestCase.assertNotNull(identifier.token); 2790 JUnitTestCase.assertNotNull(identifier.token);
2766 JUnitTestCase.assertEquals(lexeme, identifier.name); 2791 JUnitTestCase.assertEquals(lexeme, identifier.name);
2767 } 2792 }
2768 void test_parsePrefixedIdentifier_prefix() { 2793 void test_parsePrefixedIdentifier_prefix() {
2769 String lexeme = "foo.bar"; 2794 String lexeme = "foo.bar";
2770 PrefixedIdentifier identifier = ParserTestCase.parse5("parsePrefixedIdentifi er", lexeme, []); 2795 PrefixedIdentifier identifier = ParserTestCase.parse5("parsePrefixedIdentifi er", lexeme, []);
2771 JUnitTestCase.assertEquals("foo", identifier.prefix.name); 2796 JUnitTestCase.assertEquals("foo", identifier.prefix.name);
2772 JUnitTestCase.assertNotNull(identifier.period); 2797 JUnitTestCase.assertNotNull(identifier.period);
2773 JUnitTestCase.assertEquals("bar", identifier.identifier.name); 2798 JUnitTestCase.assertEquals("bar", identifier.identifier.name);
2774 } 2799 }
2775 void test_parsePrimaryExpression_argumentDefinitionTest() {
2776 ArgumentDefinitionTest expression = ParserTestCase.parse5("parseArgumentDefi nitionTest", "?a", []);
2777 JUnitTestCase.assertNotNull(expression.question);
2778 JUnitTestCase.assertNotNull(expression.identifier);
2779 }
2780 void test_parsePrimaryExpression_const() { 2800 void test_parsePrimaryExpression_const() {
2781 InstanceCreationExpression expression = ParserTestCase.parse5("parsePrimaryE xpression", "const A()", []); 2801 InstanceCreationExpression expression = ParserTestCase.parse5("parsePrimaryE xpression", "const A()", []);
2782 JUnitTestCase.assertNotNull(expression); 2802 JUnitTestCase.assertNotNull(expression);
2783 } 2803 }
2784 void test_parsePrimaryExpression_double() { 2804 void test_parsePrimaryExpression_double() {
2785 String doubleLiteral = "3.2e4"; 2805 String doubleLiteral = "3.2e4";
2786 DoubleLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", doub leLiteral, []); 2806 DoubleLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", doub leLiteral, []);
2787 JUnitTestCase.assertNotNull(literal.literal); 2807 JUnitTestCase.assertNotNull(literal.literal);
2788 JUnitTestCase.assertEquals(double.parse(doubleLiteral), literal.value); 2808 JUnitTestCase.assertEquals(double.parse(doubleLiteral), literal.value);
2789 } 2809 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 void test_parsePrimaryExpression_listLiteral_typed() { 2849 void test_parsePrimaryExpression_listLiteral_typed() {
2830 ListLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "<A>[ ]", []); 2850 ListLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "<A>[ ]", []);
2831 JUnitTestCase.assertNotNull(literal.typeArguments); 2851 JUnitTestCase.assertNotNull(literal.typeArguments);
2832 EngineTestCase.assertSize(1, literal.typeArguments.arguments); 2852 EngineTestCase.assertSize(1, literal.typeArguments.arguments);
2833 } 2853 }
2834 void test_parsePrimaryExpression_mapLiteral() { 2854 void test_parsePrimaryExpression_mapLiteral() {
2835 MapLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "{}", [ ]); 2855 MapLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "{}", [ ]);
2836 JUnitTestCase.assertNotNull(literal); 2856 JUnitTestCase.assertNotNull(literal);
2837 } 2857 }
2838 void test_parsePrimaryExpression_mapLiteral_typed() { 2858 void test_parsePrimaryExpression_mapLiteral_typed() {
2839 MapLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "<A>{}" , []); 2859 MapLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "<A, B> {}", []);
2840 JUnitTestCase.assertNotNull(literal.typeArguments); 2860 JUnitTestCase.assertNotNull(literal.typeArguments);
2841 EngineTestCase.assertSize(1, literal.typeArguments.arguments); 2861 EngineTestCase.assertSize(2, literal.typeArguments.arguments);
2842 } 2862 }
2843 void test_parsePrimaryExpression_new() { 2863 void test_parsePrimaryExpression_new() {
2844 InstanceCreationExpression expression = ParserTestCase.parse5("parsePrimaryE xpression", "new A()", []); 2864 InstanceCreationExpression expression = ParserTestCase.parse5("parsePrimaryE xpression", "new A()", []);
2845 JUnitTestCase.assertNotNull(expression); 2865 JUnitTestCase.assertNotNull(expression);
2846 } 2866 }
2847 void test_parsePrimaryExpression_null() { 2867 void test_parsePrimaryExpression_null() {
2848 NullLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "null" , []); 2868 NullLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "null" , []);
2849 JUnitTestCase.assertNotNull(literal.literal); 2869 JUnitTestCase.assertNotNull(literal.literal);
2850 } 2870 }
2851 void test_parsePrimaryExpression_parenthesized() { 2871 void test_parsePrimaryExpression_parenthesized() {
2852 ParenthesizedExpression expression = ParserTestCase.parse5("parsePrimaryExpr ession", "()", []); 2872 ParenthesizedExpression expression = ParserTestCase.parse5("parsePrimaryExpr ession", "(x)", []);
2853 JUnitTestCase.assertNotNull(expression); 2873 JUnitTestCase.assertNotNull(expression);
2854 } 2874 }
2855 void test_parsePrimaryExpression_string() { 2875 void test_parsePrimaryExpression_string() {
2856 SimpleStringLiteral literal = ParserTestCase.parse5("parsePrimaryExpression" , "\"string\"", []); 2876 SimpleStringLiteral literal = ParserTestCase.parse5("parsePrimaryExpression" , "\"string\"", []);
2857 JUnitTestCase.assertFalse(literal.isMultiline()); 2877 JUnitTestCase.assertFalse(literal.isMultiline());
2858 JUnitTestCase.assertEquals("string", literal.value); 2878 JUnitTestCase.assertEquals("string", literal.value);
2859 } 2879 }
2860 void test_parsePrimaryExpression_super() { 2880 void test_parsePrimaryExpression_super() {
2861 PropertyAccess propertyAccess = ParserTestCase.parse5("parsePrimaryExpressio n", "super.x", []); 2881 PropertyAccess propertyAccess = ParserTestCase.parse5("parsePrimaryExpressio n", "super.x", []);
2862 JUnitTestCase.assertTrue(propertyAccess.target is SuperExpression); 2882 JUnitTestCase.assertTrue(propertyAccess.target is SuperExpression);
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
3643 void test_skipTypeName_parameterized() { 3663 void test_skipTypeName_parameterized() {
3644 Token following = skip("skipTypeName", "C<E<F<G>>> +"); 3664 Token following = skip("skipTypeName", "C<E<F<G>>> +");
3645 JUnitTestCase.assertNotNull(following); 3665 JUnitTestCase.assertNotNull(following);
3646 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 3666 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3647 } 3667 }
3648 void test_skipTypeName_simple() { 3668 void test_skipTypeName_simple() {
3649 Token following = skip("skipTypeName", "C +"); 3669 Token following = skip("skipTypeName", "C +");
3650 JUnitTestCase.assertNotNull(following); 3670 JUnitTestCase.assertNotNull(following);
3651 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 3671 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3652 } 3672 }
3673
3653 /** 3674 /**
3654 * Invoke the method {@link Parser#computeStringValue(String)} with the given argument. 3675 * Invoke the method {@link Parser#computeStringValue(String)} with the given argument.
3655 * @param lexeme the argument to the method 3676 * @param lexeme the argument to the method
3656 * @return the result of invoking the method 3677 * @return the result of invoking the method
3657 * @throws Exception if the method could not be invoked or throws an exception 3678 * @throws Exception if the method could not be invoked or throws an exception
3658 */ 3679 */
3659 String computeStringValue(String lexeme) { 3680 String computeStringValue(String lexeme) {
3660 AnalysisErrorListener listener = new AnalysisErrorListener_19(); 3681 AnalysisErrorListener listener = new AnalysisErrorListener_20();
3661 Parser parser = new Parser(null, listener); 3682 Parser parser = new Parser(null, listener);
3662 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme ], null) as String; 3683 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme ], null) as String;
3663 } 3684 }
3685
3664 /** 3686 /**
3665 * Invoke the method {@link Parser#createSyntheticIdentifier()} with the parse r set to the token 3687 * Invoke the method {@link Parser#createSyntheticIdentifier()} with the parse r set to the token
3666 * stream produced by scanning the given source. 3688 * stream produced by scanning the given source.
3667 * @param source the source to be scanned to produce the token stream being te sted 3689 * @param source the source to be scanned to produce the token stream being te sted
3668 * @return the result of invoking the method 3690 * @return the result of invoking the method
3669 * @throws Exception if the method could not be invoked or throws an exception 3691 * @throws Exception if the method could not be invoked or throws an exception
3670 */ 3692 */
3671 SimpleIdentifier createSyntheticIdentifier() { 3693 SimpleIdentifier createSyntheticIdentifier() {
3672 GatheringErrorListener listener = new GatheringErrorListener(); 3694 GatheringErrorListener listener = new GatheringErrorListener();
3673 return ParserTestCase.invokeParserMethod2("createSyntheticIdentifier", "", l istener); 3695 return ParserTestCase.invokeParserMethod2("createSyntheticIdentifier", "", l istener);
3674 } 3696 }
3697
3675 /** 3698 /**
3676 * Invoke the method {@link Parser#createSyntheticIdentifier()} with the parse r set to the token 3699 * Invoke the method {@link Parser#createSyntheticIdentifier()} with the parse r set to the token
3677 * stream produced by scanning the given source. 3700 * stream produced by scanning the given source.
3678 * @param source the source to be scanned to produce the token stream being te sted 3701 * @param source the source to be scanned to produce the token stream being te sted
3679 * @return the result of invoking the method 3702 * @return the result of invoking the method
3680 * @throws Exception if the method could not be invoked or throws an exception 3703 * @throws Exception if the method could not be invoked or throws an exception
3681 */ 3704 */
3682 SimpleStringLiteral createSyntheticStringLiteral() { 3705 SimpleStringLiteral createSyntheticStringLiteral() {
3683 GatheringErrorListener listener = new GatheringErrorListener(); 3706 GatheringErrorListener listener = new GatheringErrorListener();
3684 return ParserTestCase.invokeParserMethod2("createSyntheticStringLiteral", "" , listener); 3707 return ParserTestCase.invokeParserMethod2("createSyntheticStringLiteral", "" , listener);
3685 } 3708 }
3709
3686 /** 3710 /**
3687 * Invoke the method {@link Parser#isFunctionDeclaration()} with the parser se t to the token 3711 * Invoke the method {@link Parser#isFunctionDeclaration()} with the parser se t to the token
3688 * stream produced by scanning the given source. 3712 * stream produced by scanning the given source.
3689 * @param source the source to be scanned to produce the token stream being te sted 3713 * @param source the source to be scanned to produce the token stream being te sted
3690 * @return the result of invoking the method 3714 * @return the result of invoking the method
3691 * @throws Exception if the method could not be invoked or throws an exception 3715 * @throws Exception if the method could not be invoked or throws an exception
3692 */ 3716 */
3693 bool isFunctionDeclaration(String source) { 3717 bool isFunctionDeclaration(String source) {
3694 GatheringErrorListener listener = new GatheringErrorListener(); 3718 GatheringErrorListener listener = new GatheringErrorListener();
3695 return ParserTestCase.invokeParserMethod2("isFunctionDeclaration", source, l istener) as bool; 3719 return ParserTestCase.invokeParserMethod2("isFunctionDeclaration", source, l istener) as bool;
3696 } 3720 }
3721
3697 /** 3722 /**
3698 * Invoke the method {@link Parser#isFunctionExpression()} with the parser set to the token stream 3723 * Invoke the method {@link Parser#isFunctionExpression()} with the parser set to the token stream
3699 * produced by scanning the given source. 3724 * produced by scanning the given source.
3700 * @param source the source to be scanned to produce the token stream being te sted 3725 * @param source the source to be scanned to produce the token stream being te sted
3701 * @return the result of invoking the method 3726 * @return the result of invoking the method
3702 * @throws Exception if the method could not be invoked or throws an exception 3727 * @throws Exception if the method could not be invoked or throws an exception
3703 */ 3728 */
3704 bool isFunctionExpression(String source) { 3729 bool isFunctionExpression(String source) {
3705 GatheringErrorListener listener = new GatheringErrorListener(); 3730 GatheringErrorListener listener = new GatheringErrorListener();
3706 StringScanner scanner = new StringScanner(null, source, listener); 3731 StringScanner scanner = new StringScanner(null, source, listener);
3707 Token tokenStream = scanner.tokenize(); 3732 Token tokenStream = scanner.tokenize();
3708 Parser parser = new Parser(null, listener); 3733 Parser parser = new Parser(null, listener);
3709 return invokeParserMethodImpl(parser, "isFunctionExpression", <Object> [toke nStream], tokenStream) as bool; 3734 return invokeParserMethodImpl(parser, "isFunctionExpression", <Object> [toke nStream], tokenStream) as bool;
3710 } 3735 }
3736
3711 /** 3737 /**
3712 * Invoke the method {@link Parser#isInitializedVariableDeclaration()} with th e parser set to the 3738 * Invoke the method {@link Parser#isInitializedVariableDeclaration()} with th e parser set to the
3713 * token stream produced by scanning the given source. 3739 * token stream produced by scanning the given source.
3714 * @param source the source to be scanned to produce the token stream being te sted 3740 * @param source the source to be scanned to produce the token stream being te sted
3715 * @return the result of invoking the method 3741 * @return the result of invoking the method
3716 * @throws Exception if the method could not be invoked or throws an exception 3742 * @throws Exception if the method could not be invoked or throws an exception
3717 */ 3743 */
3718 bool isInitializedVariableDeclaration(String source) { 3744 bool isInitializedVariableDeclaration(String source) {
3719 GatheringErrorListener listener = new GatheringErrorListener(); 3745 GatheringErrorListener listener = new GatheringErrorListener();
3720 return ParserTestCase.invokeParserMethod2("isInitializedVariableDeclaration" , source, listener) as bool; 3746 return ParserTestCase.invokeParserMethod2("isInitializedVariableDeclaration" , source, listener) as bool;
3721 } 3747 }
3748
3722 /** 3749 /**
3723 * Invoke the method {@link Parser#isSwitchMember()} with the parser set to th e token stream 3750 * Invoke the method {@link Parser#isSwitchMember()} with the parser set to th e token stream
3724 * produced by scanning the given source. 3751 * produced by scanning the given source.
3725 * @param source the source to be scanned to produce the token stream being te sted 3752 * @param source the source to be scanned to produce the token stream being te sted
3726 * @return the result of invoking the method 3753 * @return the result of invoking the method
3727 * @throws Exception if the method could not be invoked or throws an exception 3754 * @throws Exception if the method could not be invoked or throws an exception
3728 */ 3755 */
3729 bool isSwitchMember(String source) { 3756 bool isSwitchMember(String source) {
3730 GatheringErrorListener listener = new GatheringErrorListener(); 3757 GatheringErrorListener listener = new GatheringErrorListener();
3731 return ParserTestCase.invokeParserMethod2("isSwitchMember", source, listener ) as bool; 3758 return ParserTestCase.invokeParserMethod2("isSwitchMember", source, listener ) as bool;
3732 } 3759 }
3760
3733 /** 3761 /**
3734 * Invoke a "skip" method in {@link Parser}. The method is assumed to take a t oken as it's 3762 * Invoke a "skip" method in {@link Parser}. The method is assumed to take a t oken as it's
3735 * parameter and is given the first token in the scanned source. 3763 * parameter and is given the first token in the scanned source.
3736 * @param methodName the name of the method that should be invoked 3764 * @param methodName the name of the method that should be invoked
3737 * @param source the source to be processed by the method 3765 * @param source the source to be processed by the method
3738 * @return the result of invoking the method 3766 * @return the result of invoking the method
3739 * @throws Exception if the method could not be invoked or throws an exception 3767 * @throws Exception if the method could not be invoked or throws an exception
3740 * @throws AssertionFailedError if the result is {@code null} 3768 * @throws AssertionFailedError if the result is {@code null}
3741 */ 3769 */
3742 Token skip(String methodName, String source) { 3770 Token skip(String methodName, String source) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3809 runJUnitTest(__test, __test.test_computeStringValue_raw_single); 3837 runJUnitTest(__test, __test.test_computeStringValue_raw_single);
3810 }); 3838 });
3811 _ut.test('test_computeStringValue_raw_triple', () { 3839 _ut.test('test_computeStringValue_raw_triple', () {
3812 final __test = new SimpleParserTest(); 3840 final __test = new SimpleParserTest();
3813 runJUnitTest(__test, __test.test_computeStringValue_raw_triple); 3841 runJUnitTest(__test, __test.test_computeStringValue_raw_triple);
3814 }); 3842 });
3815 _ut.test('test_computeStringValue_raw_withEscape', () { 3843 _ut.test('test_computeStringValue_raw_withEscape', () {
3816 final __test = new SimpleParserTest(); 3844 final __test = new SimpleParserTest();
3817 runJUnitTest(__test, __test.test_computeStringValue_raw_withEscape); 3845 runJUnitTest(__test, __test.test_computeStringValue_raw_withEscape);
3818 }); 3846 });
3847 _ut.test('test_constFactory', () {
3848 final __test = new SimpleParserTest();
3849 runJUnitTest(__test, __test.test_constFactory);
3850 });
3819 _ut.test('test_createSyntheticIdentifier', () { 3851 _ut.test('test_createSyntheticIdentifier', () {
3820 final __test = new SimpleParserTest(); 3852 final __test = new SimpleParserTest();
3821 runJUnitTest(__test, __test.test_createSyntheticIdentifier); 3853 runJUnitTest(__test, __test.test_createSyntheticIdentifier);
3822 }); 3854 });
3823 _ut.test('test_createSyntheticStringLiteral', () { 3855 _ut.test('test_createSyntheticStringLiteral', () {
3824 final __test = new SimpleParserTest(); 3856 final __test = new SimpleParserTest();
3825 runJUnitTest(__test, __test.test_createSyntheticStringLiteral); 3857 runJUnitTest(__test, __test.test_createSyntheticStringLiteral);
3826 }); 3858 });
3827 _ut.test('test_isFunctionDeclaration_nameButNoReturn_block', () { 3859 _ut.test('test_isFunctionDeclaration_nameButNoReturn_block', () {
3828 final __test = new SimpleParserTest(); 3860 final __test = new SimpleParserTest();
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
4713 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_const_noType); 4745 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_const_noType);
4714 }); 4746 });
4715 _ut.test('test_parseFinalConstVarOrType_const_type', () { 4747 _ut.test('test_parseFinalConstVarOrType_const_type', () {
4716 final __test = new SimpleParserTest(); 4748 final __test = new SimpleParserTest();
4717 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_const_type); 4749 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_const_type);
4718 }); 4750 });
4719 _ut.test('test_parseFinalConstVarOrType_final_noType', () { 4751 _ut.test('test_parseFinalConstVarOrType_final_noType', () {
4720 final __test = new SimpleParserTest(); 4752 final __test = new SimpleParserTest();
4721 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_final_noType); 4753 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_final_noType);
4722 }); 4754 });
4755 _ut.test('test_parseFinalConstVarOrType_final_prefixedType', () {
4756 final __test = new SimpleParserTest();
4757 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_final_prefixed Type);
4758 });
4723 _ut.test('test_parseFinalConstVarOrType_final_type', () { 4759 _ut.test('test_parseFinalConstVarOrType_final_type', () {
4724 final __test = new SimpleParserTest(); 4760 final __test = new SimpleParserTest();
4725 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_final_type); 4761 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_final_type);
4726 }); 4762 });
4727 _ut.test('test_parseFinalConstVarOrType_type_parameterized', () { 4763 _ut.test('test_parseFinalConstVarOrType_type_parameterized', () {
4728 final __test = new SimpleParserTest(); 4764 final __test = new SimpleParserTest();
4729 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_type_parameter ized); 4765 runJUnitTest(__test, __test.test_parseFinalConstVarOrType_type_parameter ized);
4730 }); 4766 });
4731 _ut.test('test_parseFinalConstVarOrType_type_prefixed', () { 4767 _ut.test('test_parseFinalConstVarOrType_type_prefixed', () {
4732 final __test = new SimpleParserTest(); 4768 final __test = new SimpleParserTest();
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
5045 runJUnitTest(__test, __test.test_parseListOrMapLiteral_map_type); 5081 runJUnitTest(__test, __test.test_parseListOrMapLiteral_map_type);
5046 }); 5082 });
5047 _ut.test('test_parseLogicalAndExpression', () { 5083 _ut.test('test_parseLogicalAndExpression', () {
5048 final __test = new SimpleParserTest(); 5084 final __test = new SimpleParserTest();
5049 runJUnitTest(__test, __test.test_parseLogicalAndExpression); 5085 runJUnitTest(__test, __test.test_parseLogicalAndExpression);
5050 }); 5086 });
5051 _ut.test('test_parseLogicalOrExpression', () { 5087 _ut.test('test_parseLogicalOrExpression', () {
5052 final __test = new SimpleParserTest(); 5088 final __test = new SimpleParserTest();
5053 runJUnitTest(__test, __test.test_parseLogicalOrExpression); 5089 runJUnitTest(__test, __test.test_parseLogicalOrExpression);
5054 }); 5090 });
5055 _ut.test('test_parseMapLiteralEntry', () { 5091 _ut.test('test_parseMapLiteralEntry_complex', () {
5056 final __test = new SimpleParserTest(); 5092 final __test = new SimpleParserTest();
5057 runJUnitTest(__test, __test.test_parseMapLiteralEntry); 5093 runJUnitTest(__test, __test.test_parseMapLiteralEntry_complex);
5094 });
5095 _ut.test('test_parseMapLiteralEntry_int', () {
5096 final __test = new SimpleParserTest();
5097 runJUnitTest(__test, __test.test_parseMapLiteralEntry_int);
5098 });
5099 _ut.test('test_parseMapLiteralEntry_string', () {
5100 final __test = new SimpleParserTest();
5101 runJUnitTest(__test, __test.test_parseMapLiteralEntry_string);
5058 }); 5102 });
5059 _ut.test('test_parseMapLiteral_empty', () { 5103 _ut.test('test_parseMapLiteral_empty', () {
5060 final __test = new SimpleParserTest(); 5104 final __test = new SimpleParserTest();
5061 runJUnitTest(__test, __test.test_parseMapLiteral_empty); 5105 runJUnitTest(__test, __test.test_parseMapLiteral_empty);
5062 }); 5106 });
5063 _ut.test('test_parseMapLiteral_multiple', () { 5107 _ut.test('test_parseMapLiteral_multiple', () {
5064 final __test = new SimpleParserTest(); 5108 final __test = new SimpleParserTest();
5065 runJUnitTest(__test, __test.test_parseMapLiteral_multiple); 5109 runJUnitTest(__test, __test.test_parseMapLiteral_multiple);
5066 }); 5110 });
5067 _ut.test('test_parseMapLiteral_single', () { 5111 _ut.test('test_parseMapLiteral_single', () {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
5277 runJUnitTest(__test, __test.test_parsePostfixExpression_none_propertyAcc ess); 5321 runJUnitTest(__test, __test.test_parsePostfixExpression_none_propertyAcc ess);
5278 }); 5322 });
5279 _ut.test('test_parsePrefixedIdentifier_noPrefix', () { 5323 _ut.test('test_parsePrefixedIdentifier_noPrefix', () {
5280 final __test = new SimpleParserTest(); 5324 final __test = new SimpleParserTest();
5281 runJUnitTest(__test, __test.test_parsePrefixedIdentifier_noPrefix); 5325 runJUnitTest(__test, __test.test_parsePrefixedIdentifier_noPrefix);
5282 }); 5326 });
5283 _ut.test('test_parsePrefixedIdentifier_prefix', () { 5327 _ut.test('test_parsePrefixedIdentifier_prefix', () {
5284 final __test = new SimpleParserTest(); 5328 final __test = new SimpleParserTest();
5285 runJUnitTest(__test, __test.test_parsePrefixedIdentifier_prefix); 5329 runJUnitTest(__test, __test.test_parsePrefixedIdentifier_prefix);
5286 }); 5330 });
5287 _ut.test('test_parsePrimaryExpression_argumentDefinitionTest', () {
5288 final __test = new SimpleParserTest();
5289 runJUnitTest(__test, __test.test_parsePrimaryExpression_argumentDefiniti onTest);
5290 });
5291 _ut.test('test_parsePrimaryExpression_const', () { 5331 _ut.test('test_parsePrimaryExpression_const', () {
5292 final __test = new SimpleParserTest(); 5332 final __test = new SimpleParserTest();
5293 runJUnitTest(__test, __test.test_parsePrimaryExpression_const); 5333 runJUnitTest(__test, __test.test_parsePrimaryExpression_const);
5294 }); 5334 });
5295 _ut.test('test_parsePrimaryExpression_double', () { 5335 _ut.test('test_parsePrimaryExpression_double', () {
5296 final __test = new SimpleParserTest(); 5336 final __test = new SimpleParserTest();
5297 runJUnitTest(__test, __test.test_parsePrimaryExpression_double); 5337 runJUnitTest(__test, __test.test_parsePrimaryExpression_double);
5298 }); 5338 });
5299 _ut.test('test_parsePrimaryExpression_false', () { 5339 _ut.test('test_parsePrimaryExpression_false', () {
5300 final __test = new SimpleParserTest(); 5340 final __test = new SimpleParserTest();
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
5804 final __test = new SimpleParserTest(); 5844 final __test = new SimpleParserTest();
5805 runJUnitTest(__test, __test.test_skipTypeName_parameterized); 5845 runJUnitTest(__test, __test.test_skipTypeName_parameterized);
5806 }); 5846 });
5807 _ut.test('test_skipTypeName_simple', () { 5847 _ut.test('test_skipTypeName_simple', () {
5808 final __test = new SimpleParserTest(); 5848 final __test = new SimpleParserTest();
5809 runJUnitTest(__test, __test.test_skipTypeName_simple); 5849 runJUnitTest(__test, __test.test_skipTypeName_simple);
5810 }); 5850 });
5811 }); 5851 });
5812 } 5852 }
5813 } 5853 }
5814 class AnalysisErrorListener_19 implements AnalysisErrorListener { 5854 class AnalysisErrorListener_20 implements AnalysisErrorListener {
5815 void onError(AnalysisError event) { 5855 void onError(AnalysisError event) {
5816 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event. offset}, ${event.length})"); 5856 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event. offset}, ${event.length})");
5817 } 5857 }
5818 } 5858 }
5859
5819 /** 5860 /**
5820 * The class {@code ComplexParserTest} defines parser tests that test the parsin g of more complex 5861 * The class {@code ComplexParserTest} defines parser tests that test the parsin g of more complex
5821 * code fragments or the interactions between multiple parsing methods. For exam ple, tests to ensure 5862 * code fragments or the interactions between multiple parsing methods. For exam ple, tests to ensure
5822 * that the precedence of operations is being handled correctly should be define d in this class. 5863 * that the precedence of operations is being handled correctly should be define d in this class.
5823 * <p> 5864 * <p>
5824 * Simpler tests should be defined in the class {@link SimpleParserTest}. 5865 * Simpler tests should be defined in the class {@link SimpleParserTest}.
5825 */ 5866 */
5826 class ComplexParserTest extends ParserTestCase { 5867 class ComplexParserTest extends ParserTestCase {
5827 void test_additiveExpression_normal() { 5868 void test_additiveExpression_normal() {
5828 BinaryExpression expression = ParserTestCase.parseExpression("x + y - z", [] ); 5869 BinaryExpression expression = ParserTestCase.parseExpression("x + y - z", [] );
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
5940 Expression target2 = cascade.target; 5981 Expression target2 = cascade.target;
5941 for (Expression section in cascade.cascadeSections) { 5982 for (Expression section in cascade.cascadeSections) {
5942 EngineTestCase.assertInstanceOf(AssignmentExpression, section); 5983 EngineTestCase.assertInstanceOf(AssignmentExpression, section);
5943 Expression lhs = ((section as AssignmentExpression)).leftHandSide; 5984 Expression lhs = ((section as AssignmentExpression)).leftHandSide;
5944 EngineTestCase.assertInstanceOf(IndexExpression, lhs); 5985 EngineTestCase.assertInstanceOf(IndexExpression, lhs);
5945 IndexExpression index = lhs as IndexExpression; 5986 IndexExpression index = lhs as IndexExpression;
5946 JUnitTestCase.assertTrue(index.isCascaded()); 5987 JUnitTestCase.assertTrue(index.isCascaded());
5947 JUnitTestCase.assertSame(target2, index.realTarget); 5988 JUnitTestCase.assertSame(target2, index.realTarget);
5948 } 5989 }
5949 } 5990 }
5950 void test_conditionalExpression_precedence_argumentDefinitionTest_not() {
5951 ConditionalExpression conditional = ParserTestCase.parseExpression("!?a?!?b: !?c", []);
5952 EngineTestCase.assertInstanceOf(PrefixExpression, conditional.condition);
5953 EngineTestCase.assertInstanceOf(ArgumentDefinitionTest, ((conditional.condit ion as PrefixExpression)).operand);
5954 EngineTestCase.assertInstanceOf(PrefixExpression, conditional.thenExpression );
5955 EngineTestCase.assertInstanceOf(ArgumentDefinitionTest, ((conditional.thenEx pression as PrefixExpression)).operand);
5956 EngineTestCase.assertInstanceOf(PrefixExpression, conditional.elseExpression );
5957 EngineTestCase.assertInstanceOf(ArgumentDefinitionTest, ((conditional.elseEx pression as PrefixExpression)).operand);
5958 }
5959 void test_conditionalExpression_precedence_logicalOrExpression() { 5991 void test_conditionalExpression_precedence_logicalOrExpression() {
5960 ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z", []); 5992 ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z", []);
5961 EngineTestCase.assertInstanceOf(BinaryExpression, expression.condition); 5993 EngineTestCase.assertInstanceOf(BinaryExpression, expression.condition);
5962 } 5994 }
5963 void test_constructor_initializer_withParenthesizedExpression() { 5995 void test_constructor_initializer_withParenthesizedExpression() {
5964 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr eateSource(["class C {", " C() :", " this.a = (b == null ? c : d) {", " }", "}"]), []); 5996 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr eateSource(["class C {", " C() :", " this.a = (b == null ? c : d) {", " }", "}"]), []);
5965 NodeList<CompilationUnitMember> declarations2 = unit.declarations; 5997 NodeList<CompilationUnitMember> declarations2 = unit.declarations;
5966 EngineTestCase.assertSize(1, declarations2); 5998 EngineTestCase.assertSize(1, declarations2);
5967 } 5999 }
5968 void test_equalityExpression_normal() { 6000 void test_equalityExpression_normal() {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
6137 runJUnitTest(__test, __test.test_bitwiseXorExpression_precedence_and_rig ht); 6169 runJUnitTest(__test, __test.test_bitwiseXorExpression_precedence_and_rig ht);
6138 }); 6170 });
6139 _ut.test('test_bitwiseXorExpression_super', () { 6171 _ut.test('test_bitwiseXorExpression_super', () {
6140 final __test = new ComplexParserTest(); 6172 final __test = new ComplexParserTest();
6141 runJUnitTest(__test, __test.test_bitwiseXorExpression_super); 6173 runJUnitTest(__test, __test.test_bitwiseXorExpression_super);
6142 }); 6174 });
6143 _ut.test('test_cascade_withAssignment', () { 6175 _ut.test('test_cascade_withAssignment', () {
6144 final __test = new ComplexParserTest(); 6176 final __test = new ComplexParserTest();
6145 runJUnitTest(__test, __test.test_cascade_withAssignment); 6177 runJUnitTest(__test, __test.test_cascade_withAssignment);
6146 }); 6178 });
6147 _ut.test('test_conditionalExpression_precedence_argumentDefinitionTest_not ', () {
6148 final __test = new ComplexParserTest();
6149 runJUnitTest(__test, __test.test_conditionalExpression_precedence_argume ntDefinitionTest_not);
6150 });
6151 _ut.test('test_conditionalExpression_precedence_logicalOrExpression', () { 6179 _ut.test('test_conditionalExpression_precedence_logicalOrExpression', () {
6152 final __test = new ComplexParserTest(); 6180 final __test = new ComplexParserTest();
6153 runJUnitTest(__test, __test.test_conditionalExpression_precedence_logica lOrExpression); 6181 runJUnitTest(__test, __test.test_conditionalExpression_precedence_logica lOrExpression);
6154 }); 6182 });
6155 _ut.test('test_constructor_initializer_withParenthesizedExpression', () { 6183 _ut.test('test_constructor_initializer_withParenthesizedExpression', () {
6156 final __test = new ComplexParserTest(); 6184 final __test = new ComplexParserTest();
6157 runJUnitTest(__test, __test.test_constructor_initializer_withParenthesiz edExpression); 6185 runJUnitTest(__test, __test.test_constructor_initializer_withParenthesiz edExpression);
6158 }); 6186 });
6159 _ut.test('test_equalityExpression_normal', () { 6187 _ut.test('test_equalityExpression_normal', () {
6160 final __test = new ComplexParserTest(); 6188 final __test = new ComplexParserTest();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
6232 final __test = new ComplexParserTest(); 6260 final __test = new ComplexParserTest();
6233 runJUnitTest(__test, __test.test_shiftExpression_precedence_additive_rig ht); 6261 runJUnitTest(__test, __test.test_shiftExpression_precedence_additive_rig ht);
6234 }); 6262 });
6235 _ut.test('test_shiftExpression_super', () { 6263 _ut.test('test_shiftExpression_super', () {
6236 final __test = new ComplexParserTest(); 6264 final __test = new ComplexParserTest();
6237 runJUnitTest(__test, __test.test_shiftExpression_super); 6265 runJUnitTest(__test, __test.test_shiftExpression_super);
6238 }); 6266 });
6239 }); 6267 });
6240 } 6268 }
6241 } 6269 }
6270
6242 /** 6271 /**
6243 * Instances of the class {@code ASTValidator} are used to validate the correct construction of an 6272 * Instances of the class {@code ASTValidator} are used to validate the correct construction of an
6244 * AST structure. 6273 * AST structure.
6245 */ 6274 */
6246 class ASTValidator extends GeneralizingASTVisitor<Object> { 6275 class ASTValidator extends GeneralizingASTVisitor<Object> {
6276
6247 /** 6277 /**
6248 * A list containing the errors found while traversing the AST structure. 6278 * A list containing the errors found while traversing the AST structure.
6249 */ 6279 */
6250 List<String> _errors = new List<String>(); 6280 List<String> _errors = new List<String>();
6281
6251 /** 6282 /**
6252 * Assert that no errors were found while traversing any of the AST structures that have been 6283 * Assert that no errors were found while traversing any of the AST structures that have been
6253 * visited. 6284 * visited.
6254 */ 6285 */
6255 void assertValid() { 6286 void assertValid() {
6256 if (!_errors.isEmpty) { 6287 if (!_errors.isEmpty) {
6257 JavaStringBuilder builder = new JavaStringBuilder(); 6288 JavaStringBuilder builder = new JavaStringBuilder();
6258 builder.append("Invalid AST structure:"); 6289 builder.append("Invalid AST structure:");
6259 for (String message in _errors) { 6290 for (String message in _errors) {
6260 builder.append("\r\n "); 6291 builder.append("\r\n ");
6261 builder.append(message); 6292 builder.append(message);
6262 } 6293 }
6263 JUnitTestCase.fail(builder.toString()); 6294 JUnitTestCase.fail(builder.toString());
6264 } 6295 }
6265 } 6296 }
6266 Object visitNode(ASTNode node) { 6297 Object visitNode(ASTNode node) {
6267 validate(node); 6298 validate(node);
6268 return super.visitNode(node); 6299 return super.visitNode(node);
6269 } 6300 }
6301
6270 /** 6302 /**
6271 * Validate that the given AST node is correctly constructed. 6303 * Validate that the given AST node is correctly constructed.
6272 * @param node the AST node being validated 6304 * @param node the AST node being validated
6273 */ 6305 */
6274 void validate(ASTNode node) { 6306 void validate(ASTNode node) {
6275 ASTNode parent2 = node.parent; 6307 ASTNode parent2 = node.parent;
6276 if (node is CompilationUnit) { 6308 if (node is CompilationUnit) {
6277 if (parent2 != null) { 6309 if (parent2 != null) {
6278 _errors.add("Compilation units should not have a parent"); 6310 _errors.add("Compilation units should not have a parent");
6279 } 6311 }
(...skipping 20 matching lines...) Expand all
6300 if (nodeStart < parentStart) { 6332 if (nodeStart < parentStart) {
6301 _errors.add("Invalid source start (${nodeStart}) for ${node.runtimeType. toString()} inside ${parent2.runtimeType.toString()} (${parentStart})"); 6333 _errors.add("Invalid source start (${nodeStart}) for ${node.runtimeType. toString()} inside ${parent2.runtimeType.toString()} (${parentStart})");
6302 } 6334 }
6303 if (nodeEnd > parentEnd) { 6335 if (nodeEnd > parentEnd) {
6304 _errors.add("Invalid source end (${nodeEnd}) for ${node.runtimeType.toSt ring()} inside ${parent2.runtimeType.toString()} (${parentStart})"); 6336 _errors.add("Invalid source end (${nodeEnd}) for ${node.runtimeType.toSt ring()} inside ${parent2.runtimeType.toString()} (${parentStart})");
6305 } 6337 }
6306 } 6338 }
6307 } 6339 }
6308 } 6340 }
6309 class ParserTestCase extends EngineTestCase { 6341 class ParserTestCase extends EngineTestCase {
6342
6310 /** 6343 /**
6311 * An empty array of objects used as arguments to zero-argument methods. 6344 * An empty array of objects used as arguments to zero-argument methods.
6312 */ 6345 */
6313 static List<Object> _EMPTY_ARGUMENTS = new List<Object>(0); 6346 static List<Object> _EMPTY_ARGUMENTS = new List<Object>(0);
6347
6314 /** 6348 /**
6315 * Invoke a parse method in {@link Parser}. The method is assumed to have the given number and 6349 * Invoke a parse method in {@link Parser}. The method is assumed to have the given number and
6316 * type of parameters and will be invoked with the given arguments. 6350 * type of parameters and will be invoked with the given arguments.
6317 * <p> 6351 * <p>
6318 * The given source is scanned and the parser is initialized to start with the first token in the 6352 * The given source is scanned and the parser is initialized to start with the first token in the
6319 * source before the parse method is invoked. 6353 * source before the parse method is invoked.
6320 * @param methodName the name of the parse method that should be invoked to pa rse the source 6354 * @param methodName the name of the parse method that should be invoked to pa rse the source
6321 * @param objects the values of the arguments to the method 6355 * @param objects the values of the arguments to the method
6322 * @param source the source to be parsed by the parse method 6356 * @param source the source to be parsed by the parse method
6323 * @return the result of invoking the method 6357 * @return the result of invoking the method
6324 * @throws Exception if the method could not be invoked or throws an exception 6358 * @throws Exception if the method could not be invoked or throws an exception
6325 * @throws AssertionFailedError if the result is {@code null} or if any errors are produced 6359 * @throws AssertionFailedError if the result is {@code null} or if any errors are produced
6326 */ 6360 */
6327 static Object parse(String methodName, List<Object> objects, String source) => parse3(methodName, objects, source, new List<AnalysisError>(0)); 6361 static Object parse(String methodName, List<Object> objects, String source) => parse3(methodName, objects, source, new List<AnalysisError>(0));
6362
6328 /** 6363 /**
6329 * Invoke a parse method in {@link Parser}. The method is assumed to have the given number and 6364 * Invoke a parse method in {@link Parser}. The method is assumed to have the given number and
6330 * type of parameters and will be invoked with the given arguments. 6365 * type of parameters and will be invoked with the given arguments.
6331 * <p> 6366 * <p>
6332 * The given source is scanned and the parser is initialized to start with the first token in the 6367 * The given source is scanned and the parser is initialized to start with the first token in the
6333 * source before the parse method is invoked. 6368 * source before the parse method is invoked.
6334 * @param methodName the name of the parse method that should be invoked to pa rse the source 6369 * @param methodName the name of the parse method that should be invoked to pa rse the source
6335 * @param objects the values of the arguments to the method 6370 * @param objects the values of the arguments to the method
6336 * @param source the source to be parsed by the parse method 6371 * @param source the source to be parsed by the parse method
6337 * @param errorCodes the error codes of the errors that should be generated 6372 * @param errorCodes the error codes of the errors that should be generated
6338 * @return the result of invoking the method 6373 * @return the result of invoking the method
6339 * @throws Exception if the method could not be invoked or throws an exception 6374 * @throws Exception if the method could not be invoked or throws an exception
6340 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while 6375 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while
6341 * scanning and parsing the source do not match the expected errors 6376 * scanning and parsing the source do not match the expected errors
6342 */ 6377 */
6343 static Object parse3(String methodName, List<Object> objects, String source, L ist<AnalysisError> errors) { 6378 static Object parse3(String methodName, List<Object> objects, String source, L ist<AnalysisError> errors) {
6344 GatheringErrorListener listener = new GatheringErrorListener(); 6379 GatheringErrorListener listener = new GatheringErrorListener();
6345 Object result = invokeParserMethod(methodName, objects, source, listener); 6380 Object result = invokeParserMethod(methodName, objects, source, listener);
6346 listener.assertErrors(errors); 6381 listener.assertErrors(errors);
6347 return result; 6382 return result;
6348 } 6383 }
6384
6349 /** 6385 /**
6350 * Invoke a parse method in {@link Parser}. The method is assumed to have the given number and 6386 * Invoke a parse method in {@link Parser}. The method is assumed to have the given number and
6351 * type of parameters and will be invoked with the given arguments. 6387 * type of parameters and will be invoked with the given arguments.
6352 * <p> 6388 * <p>
6353 * The given source is scanned and the parser is initialized to start with the first token in the 6389 * The given source is scanned and the parser is initialized to start with the first token in the
6354 * source before the parse method is invoked. 6390 * source before the parse method is invoked.
6355 * @param methodName the name of the parse method that should be invoked to pa rse the source 6391 * @param methodName the name of the parse method that should be invoked to pa rse the source
6356 * @param objects the values of the arguments to the method 6392 * @param objects the values of the arguments to the method
6357 * @param source the source to be parsed by the parse method 6393 * @param source the source to be parsed by the parse method
6358 * @param errorCodes the error codes of the errors that should be generated 6394 * @param errorCodes the error codes of the errors that should be generated
6359 * @return the result of invoking the method 6395 * @return the result of invoking the method
6360 * @throws Exception if the method could not be invoked or throws an exception 6396 * @throws Exception if the method could not be invoked or throws an exception
6361 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while 6397 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while
6362 * scanning and parsing the source do not match the expected errors 6398 * scanning and parsing the source do not match the expected errors
6363 */ 6399 */
6364 static Object parse4(String methodName, List<Object> objects, String source, L ist<ErrorCode> errorCodes) { 6400 static Object parse4(String methodName, List<Object> objects, String source, L ist<ErrorCode> errorCodes) {
6365 GatheringErrorListener listener = new GatheringErrorListener(); 6401 GatheringErrorListener listener = new GatheringErrorListener();
6366 Object result = invokeParserMethod(methodName, objects, source, listener); 6402 Object result = invokeParserMethod(methodName, objects, source, listener);
6367 listener.assertErrors2(errorCodes); 6403 listener.assertErrors2(errorCodes);
6368 return result; 6404 return result;
6369 } 6405 }
6406
6370 /** 6407 /**
6371 * Invoke a parse method in {@link Parser}. The method is assumed to have no a rguments. 6408 * Invoke a parse method in {@link Parser}. The method is assumed to have no a rguments.
6372 * <p> 6409 * <p>
6373 * The given source is scanned and the parser is initialized to start with the first token in the 6410 * The given source is scanned and the parser is initialized to start with the first token in the
6374 * source before the parse method is invoked. 6411 * source before the parse method is invoked.
6375 * @param methodName the name of the parse method that should be invoked to pa rse the source 6412 * @param methodName the name of the parse method that should be invoked to pa rse the source
6376 * @param source the source to be parsed by the parse method 6413 * @param source the source to be parsed by the parse method
6377 * @param errorCodes the error codes of the errors that should be generated 6414 * @param errorCodes the error codes of the errors that should be generated
6378 * @return the result of invoking the method 6415 * @return the result of invoking the method
6379 * @throws Exception if the method could not be invoked or throws an exception 6416 * @throws Exception if the method could not be invoked or throws an exception
6380 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while 6417 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while
6381 * scanning and parsing the source do not match the expected errors 6418 * scanning and parsing the source do not match the expected errors
6382 */ 6419 */
6383 static Object parse5(String methodName, String source, List<ErrorCode> errorCo des) => parse4(methodName, _EMPTY_ARGUMENTS, source, errorCodes); 6420 static Object parse5(String methodName, String source, List<ErrorCode> errorCo des) => parse4(methodName, _EMPTY_ARGUMENTS, source, errorCodes);
6421
6384 /** 6422 /**
6385 * Parse the given source as a compilation unit. 6423 * Parse the given source as a compilation unit.
6386 * @param source the source to be parsed 6424 * @param source the source to be parsed
6387 * @param errorCodes the error codes of the errors that are expected to be fou nd 6425 * @param errorCodes the error codes of the errors that are expected to be fou nd
6388 * @return the compilation unit that was parsed 6426 * @return the compilation unit that was parsed
6389 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do 6427 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do
6390 * not match those that are expected, or if the result would have been {@code null} 6428 * not match those that are expected, or if the result would have been {@code null}
6391 */ 6429 */
6392 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err orCodes) { 6430 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err orCodes) {
6393 GatheringErrorListener listener = new GatheringErrorListener(); 6431 GatheringErrorListener listener = new GatheringErrorListener();
6394 StringScanner scanner = new StringScanner(null, source, listener); 6432 StringScanner scanner = new StringScanner(null, source, listener);
6395 listener.setLineInfo(new TestSource(), scanner.lineStarts); 6433 listener.setLineInfo(new TestSource(), scanner.lineStarts);
6396 Token token = scanner.tokenize(); 6434 Token token = scanner.tokenize();
6397 Parser parser = new Parser(null, listener); 6435 Parser parser = new Parser(null, listener);
6398 CompilationUnit unit = parser.parseCompilationUnit(token); 6436 CompilationUnit unit = parser.parseCompilationUnit(token);
6399 JUnitTestCase.assertNotNull(unit); 6437 JUnitTestCase.assertNotNull(unit);
6400 listener.assertErrors2(errorCodes); 6438 listener.assertErrors2(errorCodes);
6401 return unit; 6439 return unit;
6402 } 6440 }
6441
6403 /** 6442 /**
6404 * Parse the given source as an expression. 6443 * Parse the given source as an expression.
6405 * @param source the source to be parsed 6444 * @param source the source to be parsed
6406 * @param errorCodes the error codes of the errors that are expected to be fou nd 6445 * @param errorCodes the error codes of the errors that are expected to be fou nd
6407 * @return the expression that was parsed 6446 * @return the expression that was parsed
6408 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do 6447 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do
6409 * not match those that are expected, or if the result would have been {@code null} 6448 * not match those that are expected, or if the result would have been {@code null}
6410 */ 6449 */
6411 static Expression parseExpression(String source, List<ErrorCode> errorCodes) { 6450 static Expression parseExpression(String source, List<ErrorCode> errorCodes) {
6412 GatheringErrorListener listener = new GatheringErrorListener(); 6451 GatheringErrorListener listener = new GatheringErrorListener();
6413 StringScanner scanner = new StringScanner(null, source, listener); 6452 StringScanner scanner = new StringScanner(null, source, listener);
6414 listener.setLineInfo(new TestSource(), scanner.lineStarts); 6453 listener.setLineInfo(new TestSource(), scanner.lineStarts);
6415 Token token = scanner.tokenize(); 6454 Token token = scanner.tokenize();
6416 Parser parser = new Parser(null, listener); 6455 Parser parser = new Parser(null, listener);
6417 Expression expression = parser.parseExpression(token); 6456 Expression expression = parser.parseExpression(token);
6418 JUnitTestCase.assertNotNull(expression); 6457 JUnitTestCase.assertNotNull(expression);
6419 listener.assertErrors2(errorCodes); 6458 listener.assertErrors2(errorCodes);
6420 return expression as Expression; 6459 return expression as Expression;
6421 } 6460 }
6461
6422 /** 6462 /**
6423 * Parse the given source as a statement. 6463 * Parse the given source as a statement.
6424 * @param source the source to be parsed 6464 * @param source the source to be parsed
6425 * @param errorCodes the error codes of the errors that are expected to be fou nd 6465 * @param errorCodes the error codes of the errors that are expected to be fou nd
6426 * @return the statement that was parsed 6466 * @return the statement that was parsed
6427 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do 6467 * @throws Exception if the source could not be parsed, if the compilation err ors in the source do
6428 * not match those that are expected, or if the result would have been {@code null} 6468 * not match those that are expected, or if the result would have been {@code null}
6429 */ 6469 */
6430 static Statement parseStatement(String source, List<ErrorCode> errorCodes) { 6470 static Statement parseStatement(String source, List<ErrorCode> errorCodes) {
6431 GatheringErrorListener listener = new GatheringErrorListener(); 6471 GatheringErrorListener listener = new GatheringErrorListener();
6432 StringScanner scanner = new StringScanner(null, source, listener); 6472 StringScanner scanner = new StringScanner(null, source, listener);
6433 listener.setLineInfo(new TestSource(), scanner.lineStarts); 6473 listener.setLineInfo(new TestSource(), scanner.lineStarts);
6434 Token token = scanner.tokenize(); 6474 Token token = scanner.tokenize();
6435 Parser parser = new Parser(null, listener); 6475 Parser parser = new Parser(null, listener);
6436 Statement statement = parser.parseStatement(token); 6476 Statement statement = parser.parseStatement(token);
6437 JUnitTestCase.assertNotNull(statement); 6477 JUnitTestCase.assertNotNull(statement);
6438 listener.assertErrors2(errorCodes); 6478 listener.assertErrors2(errorCodes);
6439 return statement as Statement; 6479 return statement as Statement;
6440 } 6480 }
6481
6441 /** 6482 /**
6442 * Parse the given source as a sequence of statements. 6483 * Parse the given source as a sequence of statements.
6443 * @param source the source to be parsed 6484 * @param source the source to be parsed
6444 * @param expectedCount the number of statements that are expected 6485 * @param expectedCount the number of statements that are expected
6445 * @param errorCodes the error codes of the errors that are expected to be fou nd 6486 * @param errorCodes the error codes of the errors that are expected to be fou nd
6446 * @return the statements that were parsed 6487 * @return the statements that were parsed
6447 * @throws Exception if the source could not be parsed, if the number of state ments does not match 6488 * @throws Exception if the source could not be parsed, if the number of state ments does not match
6448 * the expected count, if the compilation errors in the source do not match th ose that 6489 * the expected count, if the compilation errors in the source do not match th ose that
6449 * are expected, or if the result would have been {@code null} 6490 * are expected, or if the result would have been {@code null}
6450 */ 6491 */
6451 static List<Statement> parseStatements(String source, int expectedCount, List< ErrorCode> errorCodes) { 6492 static List<Statement> parseStatements(String source, int expectedCount, List< ErrorCode> errorCodes) {
6452 GatheringErrorListener listener = new GatheringErrorListener(); 6493 GatheringErrorListener listener = new GatheringErrorListener();
6453 StringScanner scanner = new StringScanner(null, source, listener); 6494 StringScanner scanner = new StringScanner(null, source, listener);
6454 listener.setLineInfo(new TestSource(), scanner.lineStarts); 6495 listener.setLineInfo(new TestSource(), scanner.lineStarts);
6455 Token token = scanner.tokenize(); 6496 Token token = scanner.tokenize();
6456 Parser parser = new Parser(null, listener); 6497 Parser parser = new Parser(null, listener);
6457 List<Statement> statements = parser.parseStatements(token); 6498 List<Statement> statements = parser.parseStatements(token);
6458 EngineTestCase.assertSize(expectedCount, statements); 6499 EngineTestCase.assertSize(expectedCount, statements);
6459 listener.assertErrors2(errorCodes); 6500 listener.assertErrors2(errorCodes);
6460 return statements; 6501 return statements;
6461 } 6502 }
6503
6462 /** 6504 /**
6463 * Invoke a method in {@link Parser}. The method is assumed to have the given number and type of 6505 * Invoke a method in {@link Parser}. The method is assumed to have the given number and type of
6464 * parameters and will be invoked with the given arguments. 6506 * parameters and will be invoked with the given arguments.
6465 * <p> 6507 * <p>
6466 * The given source is scanned and the parser is initialized to start with the first token in the 6508 * The given source is scanned and the parser is initialized to start with the first token in the
6467 * source before the method is invoked. 6509 * source before the method is invoked.
6468 * @param methodName the name of the method that should be invoked 6510 * @param methodName the name of the method that should be invoked
6469 * @param objects the values of the arguments to the method 6511 * @param objects the values of the arguments to the method
6470 * @param source the source to be processed by the parse method 6512 * @param source the source to be processed by the parse method
6471 * @param listener the error listener that will be used for both scanning and parsing 6513 * @param listener the error listener that will be used for both scanning and parsing
6472 * @return the result of invoking the method 6514 * @return the result of invoking the method
6473 * @throws Exception if the method could not be invoked or throws an exception 6515 * @throws Exception if the method could not be invoked or throws an exception
6474 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while 6516 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while
6475 * scanning and parsing the source do not match the expected errors 6517 * scanning and parsing the source do not match the expected errors
6476 */ 6518 */
6477 static Object invokeParserMethod(String methodName, List<Object> objects, Stri ng source, GatheringErrorListener listener) { 6519 static Object invokeParserMethod(String methodName, List<Object> objects, Stri ng source, GatheringErrorListener listener) {
6478 StringScanner scanner = new StringScanner(null, source, listener); 6520 StringScanner scanner = new StringScanner(null, source, listener);
6479 Token tokenStream = scanner.tokenize(); 6521 Token tokenStream = scanner.tokenize();
6480 listener.setLineInfo(new TestSource(), scanner.lineStarts); 6522 listener.setLineInfo(new TestSource(), scanner.lineStarts);
6481 Parser parser = new Parser(null, listener); 6523 Parser parser = new Parser(null, listener);
6482 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr eam); 6524 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr eam);
6483 if (!listener.hasErrors()) { 6525 if (!listener.hasErrors()) {
6484 JUnitTestCase.assertNotNull(result); 6526 JUnitTestCase.assertNotNull(result);
6485 } 6527 }
6486 return result as Object; 6528 return result as Object;
6487 } 6529 }
6530
6488 /** 6531 /**
6489 * Invoke a method in {@link Parser}. The method is assumed to have no argumen ts. 6532 * Invoke a method in {@link Parser}. The method is assumed to have no argumen ts.
6490 * <p> 6533 * <p>
6491 * The given source is scanned and the parser is initialized to start with the first token in the 6534 * The given source is scanned and the parser is initialized to start with the first token in the
6492 * source before the method is invoked. 6535 * source before the method is invoked.
6493 * @param methodName the name of the method that should be invoked 6536 * @param methodName the name of the method that should be invoked
6494 * @param source the source to be processed by the parse method 6537 * @param source the source to be processed by the parse method
6495 * @param listener the error listener that will be used for both scanning and parsing 6538 * @param listener the error listener that will be used for both scanning and parsing
6496 * @return the result of invoking the method 6539 * @return the result of invoking the method
6497 * @throws Exception if the method could not be invoked or throws an exception 6540 * @throws Exception if the method could not be invoked or throws an exception
6498 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while 6541 * @throws AssertionFailedError if the result is {@code null} or the errors pr oduced while
6499 * scanning and parsing the source do not match the expected errors 6542 * scanning and parsing the source do not match the expected errors
6500 */ 6543 */
6501 static Object invokeParserMethod2(String methodName, String source, GatheringE rrorListener listener) => invokeParserMethod(methodName, _EMPTY_ARGUMENTS, sourc e, listener); 6544 static Object invokeParserMethod2(String methodName, String source, GatheringE rrorListener listener) => invokeParserMethod(methodName, _EMPTY_ARGUMENTS, sourc e, listener);
6545
6502 /** 6546 /**
6503 * Return a CommentAndMetadata object with the given values that can be used f or testing. 6547 * Return a CommentAndMetadata object with the given values that can be used f or testing.
6504 * @param comment the comment to be wrapped in the object 6548 * @param comment the comment to be wrapped in the object
6505 * @param annotations the annotations to be wrapped in the object 6549 * @param annotations the annotations to be wrapped in the object
6506 * @return a CommentAndMetadata object that can be used for testing 6550 * @return a CommentAndMetadata object that can be used for testing
6507 */ 6551 */
6508 CommentAndMetadata commentAndMetadata(Comment comment, List<Annotation> annota tions) { 6552 CommentAndMetadata commentAndMetadata(Comment comment, List<Annotation> annota tions) {
6509 List<Annotation> metadata = new List<Annotation>(); 6553 List<Annotation> metadata = new List<Annotation>();
6510 for (Annotation annotation in annotations) { 6554 for (Annotation annotation in annotations) {
6511 metadata.add(annotation); 6555 metadata.add(annotation);
6512 } 6556 }
6513 return new CommentAndMetadata(comment, metadata); 6557 return new CommentAndMetadata(comment, metadata);
6514 } 6558 }
6559
6515 /** 6560 /**
6516 * Return an empty CommentAndMetadata object that can be used for testing. 6561 * Return an empty CommentAndMetadata object that can be used for testing.
6517 * @return an empty CommentAndMetadata object that can be used for testing 6562 * @return an empty CommentAndMetadata object that can be used for testing
6518 */ 6563 */
6519 CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, n ew List<Annotation>()); 6564 CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, n ew List<Annotation>());
6520 static dartSuite() { 6565 static dartSuite() {
6521 _ut.group('ParserTestCase', () { 6566 _ut.group('ParserTestCase', () {
6522 }); 6567 });
6523 } 6568 }
6524 } 6569 }
6570
6525 /** 6571 /**
6526 * The class {@code RecoveryParserTest} defines parser tests that test the parsi ng of invalid code 6572 * The class {@code RecoveryParserTest} defines parser tests that test the parsi ng of invalid code
6527 * sequences to ensure that the correct recovery steps are taken in the parser. 6573 * sequences to ensure that the correct recovery steps are taken in the parser.
6528 */ 6574 */
6529 class RecoveryParserTest extends ParserTestCase { 6575 class RecoveryParserTest extends ParserTestCase {
6576 void fail_incompleteReturnType() {
6577 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource(["Map<Symbol , convertStringToSymbolMap(Map<String, dynamic> map) {", " if (map == null) ret urn null;", " Map<Symbol, dynamic> result = new Map<Symbol, dynamic>();", " ma p.forEach((name, value) {", " result[new Symbol(name)] = value;", " });", " return result;", "}"]), []);
6578 }
6530 void test_additiveExpression_missing_LHS() { 6579 void test_additiveExpression_missing_LHS() {
6531 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE rrorCode.USE_OF_UNARY_PLUS_OPERATOR]); 6580 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6532 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6581 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6533 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6582 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6534 } 6583 }
6535 void test_additiveExpression_missing_LHS_RHS() { 6584 void test_additiveExpression_missing_LHS_RHS() {
6536 BinaryExpression expression = ParserTestCase.parseExpression("+", [ParserErr orCode.USE_OF_UNARY_PLUS_OPERATOR]); 6585 BinaryExpression expression = ParserTestCase.parseExpression("+", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6537 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6586 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6538 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6587 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6539 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6588 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6540 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6589 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6541 } 6590 }
6542 void test_additiveExpression_missing_RHS() { 6591 void test_additiveExpression_missing_RHS() {
6543 BinaryExpression expression = ParserTestCase.parseExpression("x +", []); 6592 BinaryExpression expression = ParserTestCase.parseExpression("x +", [ParserE rrorCode.MISSING_IDENTIFIER]);
6544 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6593 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6545 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6594 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6546 } 6595 }
6547 void test_additiveExpression_missing_RHS_super() { 6596 void test_additiveExpression_missing_RHS_super() {
6548 BinaryExpression expression = ParserTestCase.parseExpression("super +", []); 6597 BinaryExpression expression = ParserTestCase.parseExpression("super +", [Par serErrorCode.MISSING_IDENTIFIER]);
6549 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6598 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6550 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6599 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6551 } 6600 }
6552 void test_additiveExpression_precedence_multiplicative_left() { 6601 void test_additiveExpression_precedence_multiplicative_left() {
6553 BinaryExpression expression = ParserTestCase.parseExpression("* +", [ParserE rrorCode.USE_OF_UNARY_PLUS_OPERATOR]); 6602 BinaryExpression expression = ParserTestCase.parseExpression("* +", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]);
6554 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6603 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6555 } 6604 }
6556 void test_additiveExpression_precedence_multiplicative_right() { 6605 void test_additiveExpression_precedence_multiplicative_right() {
6557 BinaryExpression expression = ParserTestCase.parseExpression("+ *", [ParserE rrorCode.USE_OF_UNARY_PLUS_OPERATOR]); 6606 BinaryExpression expression = ParserTestCase.parseExpression("+ *", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]);
6558 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6607 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6559 } 6608 }
6560 void test_additiveExpression_super() { 6609 void test_additiveExpression_super() {
6561 BinaryExpression expression = ParserTestCase.parseExpression("super + +", [P arserErrorCode.USE_OF_UNARY_PLUS_OPERATOR]); 6610 BinaryExpression expression = ParserTestCase.parseExpression("super + +", [P arserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6562 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6611 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6563 }
6564 void test_argumentDefinitionTest_missing_identifier() {
6565 ArgumentDefinitionTest expression = ParserTestCase.parseExpression("?", [Par serErrorCode.MISSING_IDENTIFIER]);
6566 JUnitTestCase.assertTrue(expression.identifier.isSynthetic());
6567 } 6612 }
6568 void test_assignmentExpression_missing_compound1() { 6613 void test_assignmentExpression_missing_compound1() {
6569 AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", []); 6614 AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
6570 Expression syntheticExpression = expression.leftHandSide; 6615 Expression syntheticExpression = expression.leftHandSide;
6571 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 6616 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
6572 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic()); 6617 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic());
6573 } 6618 }
6574 void test_assignmentExpression_missing_compound2() { 6619 void test_assignmentExpression_missing_compound2() {
6575 AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", []); 6620 AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
6576 Expression syntheticExpression = ((expression.rightHandSide as AssignmentExp ression)).leftHandSide; 6621 Expression syntheticExpression = ((expression.rightHandSide as AssignmentExp ression)).leftHandSide;
6577 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 6622 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
6578 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic()); 6623 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic());
6579 } 6624 }
6580 void test_assignmentExpression_missing_compound3() { 6625 void test_assignmentExpression_missing_compound3() {
6581 AssignmentExpression expression = ParserTestCase.parseExpression("x = y =", []); 6626 AssignmentExpression expression = ParserTestCase.parseExpression("x = y =", [ParserErrorCode.MISSING_IDENTIFIER]);
6582 Expression syntheticExpression = ((expression.rightHandSide as AssignmentExp ression)).rightHandSide; 6627 Expression syntheticExpression = ((expression.rightHandSide as AssignmentExp ression)).rightHandSide;
6583 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 6628 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
6584 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic()); 6629 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic());
6585 } 6630 }
6586 void test_assignmentExpression_missing_LHS() { 6631 void test_assignmentExpression_missing_LHS() {
6587 AssignmentExpression expression = ParserTestCase.parseExpression("= 0", []); 6632 AssignmentExpression expression = ParserTestCase.parseExpression("= 0", [Par serErrorCode.MISSING_IDENTIFIER]);
6588 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide); 6633 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide);
6589 JUnitTestCase.assertTrue(expression.leftHandSide.isSynthetic()); 6634 JUnitTestCase.assertTrue(expression.leftHandSide.isSynthetic());
6590 } 6635 }
6591 void test_assignmentExpression_missing_RHS() { 6636 void test_assignmentExpression_missing_RHS() {
6592 AssignmentExpression expression = ParserTestCase.parseExpression("x =", []); 6637 AssignmentExpression expression = ParserTestCase.parseExpression("x =", [Par serErrorCode.MISSING_IDENTIFIER]);
6593 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide); 6638 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide);
6594 JUnitTestCase.assertTrue(expression.rightHandSide.isSynthetic()); 6639 JUnitTestCase.assertTrue(expression.rightHandSide.isSynthetic());
6595 } 6640 }
6596 void test_bitwiseAndExpression_missing_LHS() { 6641 void test_bitwiseAndExpression_missing_LHS() {
6597 BinaryExpression expression = ParserTestCase.parseExpression("& y", []); 6642 BinaryExpression expression = ParserTestCase.parseExpression("& y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6598 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6643 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6599 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6644 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6600 } 6645 }
6601 void test_bitwiseAndExpression_missing_LHS_RHS() { 6646 void test_bitwiseAndExpression_missing_LHS_RHS() {
6602 BinaryExpression expression = ParserTestCase.parseExpression("&", []); 6647 BinaryExpression expression = ParserTestCase.parseExpression("&", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6603 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6648 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6604 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6649 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6605 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6650 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6606 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6651 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6607 } 6652 }
6608 void test_bitwiseAndExpression_missing_RHS() { 6653 void test_bitwiseAndExpression_missing_RHS() {
6609 BinaryExpression expression = ParserTestCase.parseExpression("x &", []); 6654 BinaryExpression expression = ParserTestCase.parseExpression("x &", [ParserE rrorCode.MISSING_IDENTIFIER]);
6610 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6655 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6611 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6656 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6612 } 6657 }
6613 void test_bitwiseAndExpression_missing_RHS_super() { 6658 void test_bitwiseAndExpression_missing_RHS_super() {
6614 BinaryExpression expression = ParserTestCase.parseExpression("super &", []); 6659 BinaryExpression expression = ParserTestCase.parseExpression("super &", [Par serErrorCode.MISSING_IDENTIFIER]);
6615 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6660 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6616 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6661 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6617 } 6662 }
6618 void test_bitwiseAndExpression_precedence_equality_left() { 6663 void test_bitwiseAndExpression_precedence_equality_left() {
6619 BinaryExpression expression = ParserTestCase.parseExpression("== &", []); 6664 BinaryExpression expression = ParserTestCase.parseExpression("== &", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]);
6620 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6665 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6621 } 6666 }
6622 void test_bitwiseAndExpression_precedence_equality_right() { 6667 void test_bitwiseAndExpression_precedence_equality_right() {
6623 BinaryExpression expression = ParserTestCase.parseExpression("& ==", []); 6668 BinaryExpression expression = ParserTestCase.parseExpression("& ==", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]);
6624 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6669 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6625 } 6670 }
6626 void test_bitwiseAndExpression_super() { 6671 void test_bitwiseAndExpression_super() {
6627 BinaryExpression expression = ParserTestCase.parseExpression("super & &", [ ]); 6672 BinaryExpression expression = ParserTestCase.parseExpression("super & &", [ ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6628 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6673 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6629 } 6674 }
6630 void test_bitwiseOrExpression_missing_LHS() { 6675 void test_bitwiseOrExpression_missing_LHS() {
6631 BinaryExpression expression = ParserTestCase.parseExpression("| y", []); 6676 BinaryExpression expression = ParserTestCase.parseExpression("| y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6632 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6677 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6633 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6678 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6634 } 6679 }
6635 void test_bitwiseOrExpression_missing_LHS_RHS() { 6680 void test_bitwiseOrExpression_missing_LHS_RHS() {
6636 BinaryExpression expression = ParserTestCase.parseExpression("|", []); 6681 BinaryExpression expression = ParserTestCase.parseExpression("|", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6637 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6682 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6638 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6683 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6639 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6684 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6640 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6685 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6641 } 6686 }
6642 void test_bitwiseOrExpression_missing_RHS() { 6687 void test_bitwiseOrExpression_missing_RHS() {
6643 BinaryExpression expression = ParserTestCase.parseExpression("x |", []); 6688 BinaryExpression expression = ParserTestCase.parseExpression("x |", [ParserE rrorCode.MISSING_IDENTIFIER]);
6644 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6689 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6645 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6690 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6646 } 6691 }
6647 void test_bitwiseOrExpression_missing_RHS_super() { 6692 void test_bitwiseOrExpression_missing_RHS_super() {
6648 BinaryExpression expression = ParserTestCase.parseExpression("super |", []); 6693 BinaryExpression expression = ParserTestCase.parseExpression("super |", [Par serErrorCode.MISSING_IDENTIFIER]);
6649 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6694 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6650 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6695 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6651 } 6696 }
6652 void test_bitwiseOrExpression_precedence_xor_left() { 6697 void test_bitwiseOrExpression_precedence_xor_left() {
6653 BinaryExpression expression = ParserTestCase.parseExpression("^ |", []); 6698 BinaryExpression expression = ParserTestCase.parseExpression("^ |", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]);
6654 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6699 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6655 } 6700 }
6656 void test_bitwiseOrExpression_precedence_xor_right() { 6701 void test_bitwiseOrExpression_precedence_xor_right() {
6657 BinaryExpression expression = ParserTestCase.parseExpression("| ^", []); 6702 BinaryExpression expression = ParserTestCase.parseExpression("| ^", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]);
6658 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6703 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6659 } 6704 }
6660 void test_bitwiseOrExpression_super() { 6705 void test_bitwiseOrExpression_super() {
6661 BinaryExpression expression = ParserTestCase.parseExpression("super | |", [ ]); 6706 BinaryExpression expression = ParserTestCase.parseExpression("super | |", [ ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6662 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6707 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6663 } 6708 }
6664 void test_bitwiseXorExpression_missing_LHS() { 6709 void test_bitwiseXorExpression_missing_LHS() {
6665 BinaryExpression expression = ParserTestCase.parseExpression("^ y", []); 6710 BinaryExpression expression = ParserTestCase.parseExpression("^ y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6666 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6711 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6667 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6712 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6668 } 6713 }
6669 void test_bitwiseXorExpression_missing_LHS_RHS() { 6714 void test_bitwiseXorExpression_missing_LHS_RHS() {
6670 BinaryExpression expression = ParserTestCase.parseExpression("^", []); 6715 BinaryExpression expression = ParserTestCase.parseExpression("^", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6671 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6716 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6672 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6717 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6673 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6718 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6674 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6719 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6675 } 6720 }
6676 void test_bitwiseXorExpression_missing_RHS() { 6721 void test_bitwiseXorExpression_missing_RHS() {
6677 BinaryExpression expression = ParserTestCase.parseExpression("x ^", []); 6722 BinaryExpression expression = ParserTestCase.parseExpression("x ^", [ParserE rrorCode.MISSING_IDENTIFIER]);
6678 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6723 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6679 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6724 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6680 } 6725 }
6681 void test_bitwiseXorExpression_missing_RHS_super() { 6726 void test_bitwiseXorExpression_missing_RHS_super() {
6682 BinaryExpression expression = ParserTestCase.parseExpression("super ^", []); 6727 BinaryExpression expression = ParserTestCase.parseExpression("super ^", [Par serErrorCode.MISSING_IDENTIFIER]);
6683 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6728 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6684 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6729 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6685 } 6730 }
6686 void test_bitwiseXorExpression_precedence_and_left() { 6731 void test_bitwiseXorExpression_precedence_and_left() {
6687 BinaryExpression expression = ParserTestCase.parseExpression("& ^", []); 6732 BinaryExpression expression = ParserTestCase.parseExpression("& ^", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]);
6688 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6733 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6689 } 6734 }
6690 void test_bitwiseXorExpression_precedence_and_right() { 6735 void test_bitwiseXorExpression_precedence_and_right() {
6691 BinaryExpression expression = ParserTestCase.parseExpression("^ &", []); 6736 BinaryExpression expression = ParserTestCase.parseExpression("^ &", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]);
6692 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6737 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6693 } 6738 }
6694 void test_bitwiseXorExpression_super() { 6739 void test_bitwiseXorExpression_super() {
6695 BinaryExpression expression = ParserTestCase.parseExpression("super ^ ^", [ ]); 6740 BinaryExpression expression = ParserTestCase.parseExpression("super ^ ^", [ ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6696 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6741 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6742 }
6743 void test_classTypeAlias_withBody() {
6744 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource(["class A {} ", "typedef B = Object with A {}"]), [ParserErrorCode.EXPECTED_TOKEN]);
6697 } 6745 }
6698 void test_conditionalExpression_missingElse() { 6746 void test_conditionalExpression_missingElse() {
6699 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y :", []); 6747 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]);
6700 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.elseExpression) ; 6748 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.elseExpression) ;
6701 JUnitTestCase.assertTrue(expression.elseExpression.isSynthetic()); 6749 JUnitTestCase.assertTrue(expression.elseExpression.isSynthetic());
6702 } 6750 }
6703 void test_conditionalExpression_missingThen() { 6751 void test_conditionalExpression_missingThen() {
6704 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? : z", []); 6752 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? : z", [ParserErrorCode.MISSING_IDENTIFIER]);
6705 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.thenExpression) ; 6753 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.thenExpression) ;
6706 JUnitTestCase.assertTrue(expression.thenExpression.isSynthetic()); 6754 JUnitTestCase.assertTrue(expression.thenExpression.isSynthetic());
6707 } 6755 }
6708 void test_equalityExpression_missing_LHS() { 6756 void test_equalityExpression_missing_LHS() {
6709 BinaryExpression expression = ParserTestCase.parseExpression("== y", []); 6757 BinaryExpression expression = ParserTestCase.parseExpression("== y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6710 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6758 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6711 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6759 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6712 } 6760 }
6713 void test_equalityExpression_missing_LHS_RHS() { 6761 void test_equalityExpression_missing_LHS_RHS() {
6714 BinaryExpression expression = ParserTestCase.parseExpression("==", []); 6762 BinaryExpression expression = ParserTestCase.parseExpression("==", [ParserEr rorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6715 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6763 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6716 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6764 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6717 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6765 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6718 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6766 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6719 } 6767 }
6720 void test_equalityExpression_missing_RHS() { 6768 void test_equalityExpression_missing_RHS() {
6721 BinaryExpression expression = ParserTestCase.parseExpression("x ==", []); 6769 BinaryExpression expression = ParserTestCase.parseExpression("x ==", [Parser ErrorCode.MISSING_IDENTIFIER]);
6722 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6770 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6723 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6771 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6724 } 6772 }
6725 void test_equalityExpression_missing_RHS_super() { 6773 void test_equalityExpression_missing_RHS_super() {
6726 BinaryExpression expression = ParserTestCase.parseExpression("super ==", []) ; 6774 BinaryExpression expression = ParserTestCase.parseExpression("super ==", [Pa rserErrorCode.MISSING_IDENTIFIER]);
6727 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6775 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6728 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6776 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6729 } 6777 }
6730 void test_equalityExpression_precedence_relational_left() { 6778 void test_equalityExpression_precedence_relational_left() {
6731 BinaryExpression expression = ParserTestCase.parseExpression("is ==", [Parse rErrorCode.MISSING_IDENTIFIER]); 6779 BinaryExpression expression = ParserTestCase.parseExpression("is ==", [Parse rErrorCode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCo de.MISSING_IDENTIFIER]);
6732 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand); 6780 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand);
6733 } 6781 }
6734 void test_equalityExpression_precedence_relational_right() { 6782 void test_equalityExpression_precedence_relational_right() {
6735 BinaryExpression expression = ParserTestCase.parseExpression("== is", [Parse rErrorCode.MISSING_IDENTIFIER]); 6783 BinaryExpression expression = ParserTestCase.parseExpression("== is", [Parse rErrorCode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCo de.MISSING_IDENTIFIER]);
6736 EngineTestCase.assertInstanceOf(IsExpression, expression.rightOperand); 6784 EngineTestCase.assertInstanceOf(IsExpression, expression.rightOperand);
6737 } 6785 }
6738 void test_equalityExpression_super() { 6786 void test_equalityExpression_super() {
6739 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", []); 6787 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6740 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6788 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6741 } 6789 }
6742 void test_expressionList_multiple_end() { 6790 void test_expressionList_multiple_end() {
6743 List<Expression> result = ParserTestCase.parse5("parseExpressionList", ", 2, 3, 4", []); 6791 List<Expression> result = ParserTestCase.parse5("parseExpressionList", ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]);
6744 EngineTestCase.assertSize(4, result); 6792 EngineTestCase.assertSize(4, result);
6745 Expression syntheticExpression = result[0]; 6793 Expression syntheticExpression = result[0];
6746 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 6794 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
6747 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic()); 6795 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic());
6748 } 6796 }
6749 void test_expressionList_multiple_middle() { 6797 void test_expressionList_multiple_middle() {
6750 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , , 4", []); 6798 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , , 4", [ParserErrorCode.MISSING_IDENTIFIER]);
6751 EngineTestCase.assertSize(4, result); 6799 EngineTestCase.assertSize(4, result);
6752 Expression syntheticExpression = result[2]; 6800 Expression syntheticExpression = result[2];
6753 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 6801 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
6754 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic()); 6802 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic());
6755 } 6803 }
6756 void test_expressionList_multiple_start() { 6804 void test_expressionList_multiple_start() {
6757 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , 3,", []); 6805 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , 3,", [ParserErrorCode.MISSING_IDENTIFIER]);
6758 EngineTestCase.assertSize(4, result); 6806 EngineTestCase.assertSize(4, result);
6759 Expression syntheticExpression = result[3]; 6807 Expression syntheticExpression = result[3];
6760 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 6808 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
6761 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic()); 6809 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic());
6762 } 6810 }
6763 void test_isExpression_noType() { 6811 void test_isExpression_noType() {
6764 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T exte nds Foo> {m(x){if (x is ) return;if (x is !)}}", [ParserErrorCode.MISSING_IDENTI FIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_STATEMENT]); 6812 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T exte nds Foo> {m(x){if (x is ) return;if (x is !)}}", [ParserErrorCode.EXPECTED_TYPE_ NAME, ParserErrorCode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_STATEMENT]);
6765 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration; 6813 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
6766 MethodDeclaration method = declaration.members[0] as MethodDeclaration; 6814 MethodDeclaration method = declaration.members[0] as MethodDeclaration;
6767 BlockFunctionBody body2 = method.body as BlockFunctionBody; 6815 BlockFunctionBody body2 = method.body as BlockFunctionBody;
6768 IfStatement ifStatement = body2.block.statements[1] as IfStatement; 6816 IfStatement ifStatement = body2.block.statements[1] as IfStatement;
6769 IsExpression expression = ifStatement.condition as IsExpression; 6817 IsExpression expression = ifStatement.condition as IsExpression;
6770 JUnitTestCase.assertNotNull(expression.expression); 6818 JUnitTestCase.assertNotNull(expression.expression);
6771 JUnitTestCase.assertNotNull(expression.isOperator); 6819 JUnitTestCase.assertNotNull(expression.isOperator);
6772 JUnitTestCase.assertNotNull(expression.notOperator); 6820 JUnitTestCase.assertNotNull(expression.notOperator);
6773 TypeName type2 = expression.type; 6821 TypeName type2 = expression.type;
6774 JUnitTestCase.assertNotNull(type2); 6822 JUnitTestCase.assertNotNull(type2);
6775 JUnitTestCase.assertTrue(type2.name.isSynthetic()); 6823 JUnitTestCase.assertTrue(type2.name.isSynthetic());
6776 EngineTestCase.assertInstanceOf(EmptyStatement, ifStatement.thenStatement); 6824 EngineTestCase.assertInstanceOf(EmptyStatement, ifStatement.thenStatement);
6777 } 6825 }
6778 void test_logicalAndExpression_missing_LHS() { 6826 void test_logicalAndExpression_missing_LHS() {
6779 BinaryExpression expression = ParserTestCase.parseExpression("&& y", []); 6827 BinaryExpression expression = ParserTestCase.parseExpression("&& y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6780 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6828 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6781 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6829 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6782 } 6830 }
6783 void test_logicalAndExpression_missing_LHS_RHS() { 6831 void test_logicalAndExpression_missing_LHS_RHS() {
6784 BinaryExpression expression = ParserTestCase.parseExpression("&&", []); 6832 BinaryExpression expression = ParserTestCase.parseExpression("&&", [ParserEr rorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6785 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6833 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6786 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6834 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6787 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6835 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6788 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6836 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6789 } 6837 }
6790 void test_logicalAndExpression_missing_RHS() { 6838 void test_logicalAndExpression_missing_RHS() {
6791 BinaryExpression expression = ParserTestCase.parseExpression("x &&", []); 6839 BinaryExpression expression = ParserTestCase.parseExpression("x &&", [Parser ErrorCode.MISSING_IDENTIFIER]);
6792 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6840 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6793 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6841 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6794 } 6842 }
6795 void test_logicalAndExpression_precedence_bitwiseOr_left() { 6843 void test_logicalAndExpression_precedence_bitwiseOr_left() {
6796 BinaryExpression expression = ParserTestCase.parseExpression("| &&", []); 6844 BinaryExpression expression = ParserTestCase.parseExpression("| &&", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]);
6797 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6845 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6798 } 6846 }
6799 void test_logicalAndExpression_precedence_bitwiseOr_right() { 6847 void test_logicalAndExpression_precedence_bitwiseOr_right() {
6800 BinaryExpression expression = ParserTestCase.parseExpression("&& |", []); 6848 BinaryExpression expression = ParserTestCase.parseExpression("&& |", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]);
6801 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6849 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6802 } 6850 }
6803 void test_logicalOrExpression_missing_LHS() { 6851 void test_logicalOrExpression_missing_LHS() {
6804 BinaryExpression expression = ParserTestCase.parseExpression("|| y", []); 6852 BinaryExpression expression = ParserTestCase.parseExpression("|| y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6805 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6853 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6806 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6854 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6807 } 6855 }
6808 void test_logicalOrExpression_missing_LHS_RHS() { 6856 void test_logicalOrExpression_missing_LHS_RHS() {
6809 BinaryExpression expression = ParserTestCase.parseExpression("||", []); 6857 BinaryExpression expression = ParserTestCase.parseExpression("||", [ParserEr rorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6810 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6858 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6811 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6859 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6812 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6860 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6813 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6861 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6814 } 6862 }
6815 void test_logicalOrExpression_missing_RHS() { 6863 void test_logicalOrExpression_missing_RHS() {
6816 BinaryExpression expression = ParserTestCase.parseExpression("x ||", []); 6864 BinaryExpression expression = ParserTestCase.parseExpression("x ||", [Parser ErrorCode.MISSING_IDENTIFIER]);
6817 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6865 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6818 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6866 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6819 } 6867 }
6820 void test_logicalOrExpression_precedence_logicalAnd_left() { 6868 void test_logicalOrExpression_precedence_logicalAnd_left() {
6821 BinaryExpression expression = ParserTestCase.parseExpression("&& ||", []); 6869 BinaryExpression expression = ParserTestCase.parseExpression("&& ||", [Parse rErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCo de.MISSING_IDENTIFIER]);
6822 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6870 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6823 } 6871 }
6824 void test_logicalOrExpression_precedence_logicalAnd_right() { 6872 void test_logicalOrExpression_precedence_logicalAnd_right() {
6825 BinaryExpression expression = ParserTestCase.parseExpression("|| &&", []); 6873 BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [Parse rErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCo de.MISSING_IDENTIFIER]);
6826 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6874 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6827 } 6875 }
6828 void test_multiplicativeExpression_missing_LHS() { 6876 void test_multiplicativeExpression_missing_LHS() {
6829 BinaryExpression expression = ParserTestCase.parseExpression("* y", []); 6877 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6830 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6878 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6831 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6879 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6832 } 6880 }
6833 void test_multiplicativeExpression_missing_LHS_RHS() { 6881 void test_multiplicativeExpression_missing_LHS_RHS() {
6834 BinaryExpression expression = ParserTestCase.parseExpression("*", []); 6882 BinaryExpression expression = ParserTestCase.parseExpression("*", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6835 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6883 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6836 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6884 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6837 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6885 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6838 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6886 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6839 } 6887 }
6840 void test_multiplicativeExpression_missing_RHS() { 6888 void test_multiplicativeExpression_missing_RHS() {
6841 BinaryExpression expression = ParserTestCase.parseExpression("x *", []); 6889 BinaryExpression expression = ParserTestCase.parseExpression("x *", [ParserE rrorCode.MISSING_IDENTIFIER]);
6842 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6890 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6843 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6891 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6844 } 6892 }
6845 void test_multiplicativeExpression_missing_RHS_super() { 6893 void test_multiplicativeExpression_missing_RHS_super() {
6846 BinaryExpression expression = ParserTestCase.parseExpression("super *", []); 6894 BinaryExpression expression = ParserTestCase.parseExpression("super *", [Par serErrorCode.MISSING_IDENTIFIER]);
6847 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6895 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6848 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6896 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6849 } 6897 }
6850 void test_multiplicativeExpression_precedence_unary_left() { 6898 void test_multiplicativeExpression_precedence_unary_left() {
6851 BinaryExpression expression = ParserTestCase.parseExpression("-x *", []); 6899 BinaryExpression expression = ParserTestCase.parseExpression("-x *", [Parser ErrorCode.MISSING_IDENTIFIER]);
6852 EngineTestCase.assertInstanceOf(PrefixExpression, expression.leftOperand); 6900 EngineTestCase.assertInstanceOf(PrefixExpression, expression.leftOperand);
6853 } 6901 }
6854 void test_multiplicativeExpression_precedence_unary_right() { 6902 void test_multiplicativeExpression_precedence_unary_right() {
6855 BinaryExpression expression = ParserTestCase.parseExpression("* -y", []); 6903 BinaryExpression expression = ParserTestCase.parseExpression("* -y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6856 EngineTestCase.assertInstanceOf(PrefixExpression, expression.rightOperand); 6904 EngineTestCase.assertInstanceOf(PrefixExpression, expression.rightOperand);
6857 } 6905 }
6858 void test_multiplicativeExpression_super() { 6906 void test_multiplicativeExpression_super() {
6859 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", []); 6907 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6860 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6908 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6861 } 6909 }
6862 void test_prefixExpression_missing_operand_minus() { 6910 void test_prefixExpression_missing_operand_minus() {
6863 PrefixExpression expression = ParserTestCase.parseExpression("-", []); 6911 PrefixExpression expression = ParserTestCase.parseExpression("-", [ParserErr orCode.MISSING_IDENTIFIER]);
6864 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.operand); 6912 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.operand);
6865 JUnitTestCase.assertTrue(expression.operand.isSynthetic()); 6913 JUnitTestCase.assertTrue(expression.operand.isSynthetic());
6866 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 6914 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type);
6867 } 6915 }
6868 void test_relationalExpression_missing_LHS() { 6916 void test_relationalExpression_missing_LHS() {
6869 IsExpression expression = ParserTestCase.parseExpression("is y", []); 6917 IsExpression expression = ParserTestCase.parseExpression("is y", [ParserErro rCode.MISSING_IDENTIFIER]);
6870 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression); 6918 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression);
6871 JUnitTestCase.assertTrue(expression.expression.isSynthetic()); 6919 JUnitTestCase.assertTrue(expression.expression.isSynthetic());
6872 } 6920 }
6873 void test_relationalExpression_missing_LHS_RHS() { 6921 void test_relationalExpression_missing_LHS_RHS() {
6874 IsExpression expression = ParserTestCase.parseExpression("is", [ParserErrorC ode.MISSING_IDENTIFIER]); 6922 IsExpression expression = ParserTestCase.parseExpression("is", [ParserErrorC ode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER]);
6875 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression); 6923 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression);
6876 JUnitTestCase.assertTrue(expression.expression.isSynthetic()); 6924 JUnitTestCase.assertTrue(expression.expression.isSynthetic());
6877 EngineTestCase.assertInstanceOf(TypeName, expression.type); 6925 EngineTestCase.assertInstanceOf(TypeName, expression.type);
6878 JUnitTestCase.assertTrue(expression.type.isSynthetic()); 6926 JUnitTestCase.assertTrue(expression.type.isSynthetic());
6879 } 6927 }
6880 void test_relationalExpression_missing_RHS() { 6928 void test_relationalExpression_missing_RHS() {
6881 IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErro rCode.MISSING_IDENTIFIER]); 6929 IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErro rCode.EXPECTED_TYPE_NAME]);
6882 EngineTestCase.assertInstanceOf(TypeName, expression.type); 6930 EngineTestCase.assertInstanceOf(TypeName, expression.type);
6883 JUnitTestCase.assertTrue(expression.type.isSynthetic()); 6931 JUnitTestCase.assertTrue(expression.type.isSynthetic());
6884 } 6932 }
6885 void test_relationalExpression_precedence_shift_right() { 6933 void test_relationalExpression_precedence_shift_right() {
6886 IsExpression expression = ParserTestCase.parseExpression("<< is", [ParserErr orCode.MISSING_IDENTIFIER]); 6934 IsExpression expression = ParserTestCase.parseExpression("<< is", [ParserErr orCode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.M ISSING_IDENTIFIER]);
6887 EngineTestCase.assertInstanceOf(BinaryExpression, expression.expression); 6935 EngineTestCase.assertInstanceOf(BinaryExpression, expression.expression);
6888 } 6936 }
6889 void test_shiftExpression_missing_LHS() { 6937 void test_shiftExpression_missing_LHS() {
6890 BinaryExpression expression = ParserTestCase.parseExpression("<< y", []); 6938 BinaryExpression expression = ParserTestCase.parseExpression("<< y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6891 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6939 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6892 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6940 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6893 } 6941 }
6894 void test_shiftExpression_missing_LHS_RHS() { 6942 void test_shiftExpression_missing_LHS_RHS() {
6895 BinaryExpression expression = ParserTestCase.parseExpression("<<", []); 6943 BinaryExpression expression = ParserTestCase.parseExpression("<<", [ParserEr rorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6896 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6944 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6897 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic()); 6945 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic());
6898 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6946 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6899 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6947 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6900 } 6948 }
6901 void test_shiftExpression_missing_RHS() { 6949 void test_shiftExpression_missing_RHS() {
6902 BinaryExpression expression = ParserTestCase.parseExpression("x <<", []); 6950 BinaryExpression expression = ParserTestCase.parseExpression("x <<", [Parser ErrorCode.MISSING_IDENTIFIER]);
6903 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6951 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6904 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6952 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6905 } 6953 }
6906 void test_shiftExpression_missing_RHS_super() { 6954 void test_shiftExpression_missing_RHS_super() {
6907 BinaryExpression expression = ParserTestCase.parseExpression("super <<", []) ; 6955 BinaryExpression expression = ParserTestCase.parseExpression("super <<", [Pa rserErrorCode.MISSING_IDENTIFIER]);
6908 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6956 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6909 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic()); 6957 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic());
6910 } 6958 }
6911 void test_shiftExpression_precedence_unary_left() { 6959 void test_shiftExpression_precedence_unary_left() {
6912 BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [Parser ErrorCode.USE_OF_UNARY_PLUS_OPERATOR]); 6960 BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]);
6913 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6961 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6914 } 6962 }
6915 void test_shiftExpression_precedence_unary_right() { 6963 void test_shiftExpression_precedence_unary_right() {
6916 BinaryExpression expression = ParserTestCase.parseExpression("<< +", [Parser ErrorCode.USE_OF_UNARY_PLUS_OPERATOR]); 6964 BinaryExpression expression = ParserTestCase.parseExpression("<< +", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]);
6917 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6965 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6918 } 6966 }
6919 void test_shiftExpression_super() { 6967 void test_shiftExpression_super() {
6920 BinaryExpression expression = ParserTestCase.parseExpression("super << <<", []); 6968 BinaryExpression expression = ParserTestCase.parseExpression("super << <<", [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
6921 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6969 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6922 } 6970 }
6923 void test_typedef_eof() { 6971 void test_typedef_eof() {
6924 CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [Par serErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]); 6972 CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [Par serErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
6925 NodeList<CompilationUnitMember> declarations2 = unit.declarations; 6973 NodeList<CompilationUnitMember> declarations2 = unit.declarations;
6926 EngineTestCase.assertSize(1, declarations2); 6974 EngineTestCase.assertSize(1, declarations2);
6927 CompilationUnitMember member = declarations2[0]; 6975 CompilationUnitMember member = declarations2[0];
6928 EngineTestCase.assertInstanceOf(FunctionTypeAlias, member); 6976 EngineTestCase.assertInstanceOf(FunctionTypeAlias, member);
6929 } 6977 }
6930 static dartSuite() { 6978 static dartSuite() {
(...skipping 19 matching lines...) Expand all
6950 runJUnitTest(__test, __test.test_additiveExpression_precedence_multiplic ative_left); 6998 runJUnitTest(__test, __test.test_additiveExpression_precedence_multiplic ative_left);
6951 }); 6999 });
6952 _ut.test('test_additiveExpression_precedence_multiplicative_right', () { 7000 _ut.test('test_additiveExpression_precedence_multiplicative_right', () {
6953 final __test = new RecoveryParserTest(); 7001 final __test = new RecoveryParserTest();
6954 runJUnitTest(__test, __test.test_additiveExpression_precedence_multiplic ative_right); 7002 runJUnitTest(__test, __test.test_additiveExpression_precedence_multiplic ative_right);
6955 }); 7003 });
6956 _ut.test('test_additiveExpression_super', () { 7004 _ut.test('test_additiveExpression_super', () {
6957 final __test = new RecoveryParserTest(); 7005 final __test = new RecoveryParserTest();
6958 runJUnitTest(__test, __test.test_additiveExpression_super); 7006 runJUnitTest(__test, __test.test_additiveExpression_super);
6959 }); 7007 });
6960 _ut.test('test_argumentDefinitionTest_missing_identifier', () {
6961 final __test = new RecoveryParserTest();
6962 runJUnitTest(__test, __test.test_argumentDefinitionTest_missing_identifi er);
6963 });
6964 _ut.test('test_assignmentExpression_missing_LHS', () { 7008 _ut.test('test_assignmentExpression_missing_LHS', () {
6965 final __test = new RecoveryParserTest(); 7009 final __test = new RecoveryParserTest();
6966 runJUnitTest(__test, __test.test_assignmentExpression_missing_LHS); 7010 runJUnitTest(__test, __test.test_assignmentExpression_missing_LHS);
6967 }); 7011 });
6968 _ut.test('test_assignmentExpression_missing_RHS', () { 7012 _ut.test('test_assignmentExpression_missing_RHS', () {
6969 final __test = new RecoveryParserTest(); 7013 final __test = new RecoveryParserTest();
6970 runJUnitTest(__test, __test.test_assignmentExpression_missing_RHS); 7014 runJUnitTest(__test, __test.test_assignmentExpression_missing_RHS);
6971 }); 7015 });
6972 _ut.test('test_assignmentExpression_missing_compound1', () { 7016 _ut.test('test_assignmentExpression_missing_compound1', () {
6973 final __test = new RecoveryParserTest(); 7017 final __test = new RecoveryParserTest();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
7058 runJUnitTest(__test, __test.test_bitwiseXorExpression_precedence_and_lef t); 7102 runJUnitTest(__test, __test.test_bitwiseXorExpression_precedence_and_lef t);
7059 }); 7103 });
7060 _ut.test('test_bitwiseXorExpression_precedence_and_right', () { 7104 _ut.test('test_bitwiseXorExpression_precedence_and_right', () {
7061 final __test = new RecoveryParserTest(); 7105 final __test = new RecoveryParserTest();
7062 runJUnitTest(__test, __test.test_bitwiseXorExpression_precedence_and_rig ht); 7106 runJUnitTest(__test, __test.test_bitwiseXorExpression_precedence_and_rig ht);
7063 }); 7107 });
7064 _ut.test('test_bitwiseXorExpression_super', () { 7108 _ut.test('test_bitwiseXorExpression_super', () {
7065 final __test = new RecoveryParserTest(); 7109 final __test = new RecoveryParserTest();
7066 runJUnitTest(__test, __test.test_bitwiseXorExpression_super); 7110 runJUnitTest(__test, __test.test_bitwiseXorExpression_super);
7067 }); 7111 });
7112 _ut.test('test_classTypeAlias_withBody', () {
7113 final __test = new RecoveryParserTest();
7114 runJUnitTest(__test, __test.test_classTypeAlias_withBody);
7115 });
7068 _ut.test('test_conditionalExpression_missingElse', () { 7116 _ut.test('test_conditionalExpression_missingElse', () {
7069 final __test = new RecoveryParserTest(); 7117 final __test = new RecoveryParserTest();
7070 runJUnitTest(__test, __test.test_conditionalExpression_missingElse); 7118 runJUnitTest(__test, __test.test_conditionalExpression_missingElse);
7071 }); 7119 });
7072 _ut.test('test_conditionalExpression_missingThen', () { 7120 _ut.test('test_conditionalExpression_missingThen', () {
7073 final __test = new RecoveryParserTest(); 7121 final __test = new RecoveryParserTest();
7074 runJUnitTest(__test, __test.test_conditionalExpression_missingThen); 7122 runJUnitTest(__test, __test.test_conditionalExpression_missingThen);
7075 }); 7123 });
7076 _ut.test('test_equalityExpression_missing_LHS', () { 7124 _ut.test('test_equalityExpression_missing_LHS', () {
7077 final __test = new RecoveryParserTest(); 7125 final __test = new RecoveryParserTest();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
7233 final __test = new RecoveryParserTest(); 7281 final __test = new RecoveryParserTest();
7234 runJUnitTest(__test, __test.test_shiftExpression_super); 7282 runJUnitTest(__test, __test.test_shiftExpression_super);
7235 }); 7283 });
7236 _ut.test('test_typedef_eof', () { 7284 _ut.test('test_typedef_eof', () {
7237 final __test = new RecoveryParserTest(); 7285 final __test = new RecoveryParserTest();
7238 runJUnitTest(__test, __test.test_typedef_eof); 7286 runJUnitTest(__test, __test.test_typedef_eof);
7239 }); 7287 });
7240 }); 7288 });
7241 } 7289 }
7242 } 7290 }
7291
7243 /** 7292 /**
7244 * The class {@code ErrorParserTest} defines parser tests that test the parsing of code to ensure 7293 * The class {@code ErrorParserTest} defines parser tests that test the parsing of code to ensure
7245 * that errors are correctly reported, and in some cases, not reported. 7294 * that errors are correctly reported, and in some cases, not reported.
7246 */ 7295 */
7247 class ErrorParserTest extends ParserTestCase { 7296 class ErrorParserTest extends ParserTestCase {
7248 void fail_expectedListOrMapLiteral() { 7297 void fail_expectedListOrMapLiteral() {
7249 TypedLiteral literal = ParserTestCase.parse4("parseListOrMapLiteral", <Objec t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]); 7298 TypedLiteral literal = ParserTestCase.parse4("parseListOrMapLiteral", <Objec t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]);
7250 JUnitTestCase.assertTrue(literal.isSynthetic()); 7299 JUnitTestCase.assertTrue(literal.isSynthetic());
7251 } 7300 }
7252 void fail_illegalAssignmentToNonAssignable_superAssigned() { 7301 void fail_illegalAssignmentToNonAssignable_superAssigned() {
7253 ParserTestCase.parse5("parseExpression", "super = x;", [ParserErrorCode.ILLE GAL_ASSIGNMENT_TO_NON_ASSIGNABLE]); 7302 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN MENT_TO_NON_ASSIGNABLE]);
7254 } 7303 }
7255 void fail_invalidCommentReference__new_nonIdentifier() { 7304 void fail_invalidCommentReference__new_nonIdentifier() {
7256 ParserTestCase.parse4("parseCommentReference", <Object> ["new 42", 0], "", [ ParserErrorCode.INVALID_COMMENT_REFERENCE]); 7305 ParserTestCase.parse4("parseCommentReference", <Object> ["new 42", 0], "", [ ParserErrorCode.INVALID_COMMENT_REFERENCE]);
7257 } 7306 }
7258 void fail_invalidCommentReference__new_tooMuch() { 7307 void fail_invalidCommentReference__new_tooMuch() {
7259 ParserTestCase.parse4("parseCommentReference", <Object> ["new a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]); 7308 ParserTestCase.parse4("parseCommentReference", <Object> ["new a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
7260 } 7309 }
7261 void fail_invalidCommentReference__nonNew_nonIdentifier() { 7310 void fail_invalidCommentReference__nonNew_nonIdentifier() {
7262 ParserTestCase.parse4("parseCommentReference", <Object> ["42", 0], "", [Pars erErrorCode.INVALID_COMMENT_REFERENCE]); 7311 ParserTestCase.parse4("parseCommentReference", <Object> ["42", 0], "", [Pars erErrorCode.INVALID_COMMENT_REFERENCE]);
7263 } 7312 }
7264 void fail_invalidCommentReference__nonNew_tooMuch() { 7313 void fail_invalidCommentReference__nonNew_tooMuch() {
7265 ParserTestCase.parse4("parseCommentReference", <Object> ["a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]); 7314 ParserTestCase.parse4("parseCommentReference", <Object> ["a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
7266 } 7315 }
7267 void fail_missingClosingParenthesis() { 7316 void fail_missingClosingParenthesis() {
7268 ParserTestCase.parse5("parseFormalParameterList", "(int a, int b ;", [Parser ErrorCode.MISSING_CLOSING_PARENTHESIS]); 7317 ParserTestCase.parse5("parseFormalParameterList", "(int a, int b ;", [Parser ErrorCode.MISSING_CLOSING_PARENTHESIS]);
7269 } 7318 }
7270 void fail_missingExpressionInThrow_withCascade() {
7271 ParserTestCase.parse5("parseThrowExpression", "throw;", [ParserErrorCode.MIS SING_EXPRESSION_IN_THROW]);
7272 }
7273 void fail_missingExpressionInThrow_withoutCascade() {
7274 ParserTestCase.parse5("parseThrowExpressionWithoutCascade", "throw;", [Parse rErrorCode.MISSING_EXPRESSION_IN_THROW]);
7275 }
7276 void fail_missingFunctionParameters_local_nonVoid_block() { 7319 void fail_missingFunctionParameters_local_nonVoid_block() {
7277 ParserTestCase.parse5("parseStatement", "int f { return x;}", [ParserErrorCo de.MISSING_FUNCTION_PARAMETERS]); 7320 ParserTestCase.parseStatement("int f { return x;}", [ParserErrorCode.MISSING _FUNCTION_PARAMETERS]);
7278 } 7321 }
7279 void fail_missingFunctionParameters_local_nonVoid_expression() { 7322 void fail_missingFunctionParameters_local_nonVoid_expression() {
7280 ParserTestCase.parse5("parseStatement", "int f => x;", [ParserErrorCode.MISS ING_FUNCTION_PARAMETERS]); 7323 ParserTestCase.parseStatement("int f => x;", [ParserErrorCode.MISSING_FUNCTI ON_PARAMETERS]);
7281 } 7324 }
7282 void fail_namedFunctionExpression() { 7325 void fail_namedFunctionExpression() {
7283 Expression expression = ParserTestCase.parse5("parsePrimaryExpression", "f() {}", [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]); 7326 Expression expression = ParserTestCase.parse5("parsePrimaryExpression", "f() {}", [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
7284 EngineTestCase.assertInstanceOf(FunctionExpression, expression); 7327 EngineTestCase.assertInstanceOf(FunctionExpression, expression);
7285 } 7328 }
7286 void fail_unexpectedToken_invalidPostfixExpression() { 7329 void fail_unexpectedToken_invalidPostfixExpression() {
7287 ParserTestCase.parse5("parseExpression", "f()++", [ParserErrorCode.UNEXPECTE D_TOKEN]); 7330 ParserTestCase.parseExpression("f()++", [ParserErrorCode.UNEXPECTED_TOKEN]);
7288 } 7331 }
7289 void fail_voidVariable_initializer() { 7332 void fail_voidVariable_initializer() {
7290 ParserTestCase.parse5("parseStatement", "void x = 0;", [ParserErrorCode.VOID _VARIABLE]); 7333 ParserTestCase.parseStatement("void x = 0;", [ParserErrorCode.VOID_VARIABLE] );
7291 } 7334 }
7292 void fail_voidVariable_noInitializer() { 7335 void fail_voidVariable_noInitializer() {
7293 ParserTestCase.parse5("parseStatement", "void x;", [ParserErrorCode.VOID_VAR IABLE]); 7336 ParserTestCase.parseStatement("void x;", [ParserErrorCode.VOID_VARIABLE]);
7294 } 7337 }
7295 void test_abstractClassMember_constructor() { 7338 void test_abstractClassMember_constructor() {
7296 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C.c();", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 7339 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C.c();", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
7297 } 7340 }
7298 void test_abstractClassMember_field() { 7341 void test_abstractClassMember_field() {
7299 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C f;", [ ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 7342 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C f;", [ ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
7300 } 7343 }
7301 void test_abstractClassMember_getter() { 7344 void test_abstractClassMember_getter() {
7302 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract get m;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 7345 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract get m;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
7303 } 7346 }
7304 void test_abstractClassMember_method() { 7347 void test_abstractClassMember_method() {
7305 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract m();", [ ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 7348 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract m();", [ ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
7306 } 7349 }
7307 void test_abstractClassMember_setter() { 7350 void test_abstractClassMember_setter() {
7308 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract set m(v) ;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 7351 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract set m(v) ;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
7309 } 7352 }
7310 void test_abstractTopLevelFunction_function() { 7353 void test_abstractTopLevelFunction_function() {
7311 ParserTestCase.parse5("parseCompilationUnit", "abstract f(v) {}", [ParserErr orCode.ABSTRACT_TOP_LEVEL_FUNCTION]); 7354 ParserTestCase.parseCompilationUnit("abstract f(v) {}", [ParserErrorCode.ABS TRACT_TOP_LEVEL_FUNCTION]);
7312 } 7355 }
7313 void test_abstractTopLevelFunction_getter() { 7356 void test_abstractTopLevelFunction_getter() {
7314 ParserTestCase.parse5("parseCompilationUnit", "abstract get m {}", [ParserEr rorCode.ABSTRACT_TOP_LEVEL_FUNCTION]); 7357 ParserTestCase.parseCompilationUnit("abstract get m {}", [ParserErrorCode.AB STRACT_TOP_LEVEL_FUNCTION]);
7315 } 7358 }
7316 void test_abstractTopLevelFunction_setter() { 7359 void test_abstractTopLevelFunction_setter() {
7317 ParserTestCase.parse5("parseCompilationUnit", "abstract set m(v) {}", [Parse rErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION]); 7360 ParserTestCase.parseCompilationUnit("abstract set m(v) {}", [ParserErrorCode .ABSTRACT_TOP_LEVEL_FUNCTION]);
7318 } 7361 }
7319 void test_abstractTopLevelVariable() { 7362 void test_abstractTopLevelVariable() {
7320 ParserTestCase.parse5("parseCompilationUnit", "abstract C f;", [ParserErrorC ode.ABSTRACT_TOP_LEVEL_VARIABLE]); 7363 ParserTestCase.parseCompilationUnit("abstract C f;", [ParserErrorCode.ABSTRA CT_TOP_LEVEL_VARIABLE]);
7321 } 7364 }
7322 void test_abstractTypeDef() { 7365 void test_abstractTypeDef() {
7323 ParserTestCase.parse5("parseCompilationUnit", "abstract typedef F();", [Pars erErrorCode.ABSTRACT_TYPEDEF]); 7366 ParserTestCase.parseCompilationUnit("abstract typedef F();", [ParserErrorCod e.ABSTRACT_TYPEDEF]);
7324 } 7367 }
7325 void test_breakOutsideOfLoop_breakInDoStatement() { 7368 void test_breakOutsideOfLoop_breakInDoStatement() {
7326 ParserTestCase.parse5("parseDoStatement", "do {break;} while (x);", []); 7369 ParserTestCase.parse5("parseDoStatement", "do {break;} while (x);", []);
7327 } 7370 }
7328 void test_breakOutsideOfLoop_breakInForStatement() { 7371 void test_breakOutsideOfLoop_breakInForStatement() {
7329 ParserTestCase.parse5("parseForStatement", "for (; x;) {break;}", []); 7372 ParserTestCase.parse5("parseForStatement", "for (; x;) {break;}", []);
7330 } 7373 }
7331 void test_breakOutsideOfLoop_breakInIfStatement() { 7374 void test_breakOutsideOfLoop_breakInIfStatement() {
7332 ParserTestCase.parse5("parseIfStatement", "if (x) {break;}", [ParserErrorCod e.BREAK_OUTSIDE_OF_LOOP]); 7375 ParserTestCase.parse5("parseIfStatement", "if (x) {break;}", [ParserErrorCod e.BREAK_OUTSIDE_OF_LOOP]);
7333 } 7376 }
7334 void test_breakOutsideOfLoop_breakInSwitchStatement() { 7377 void test_breakOutsideOfLoop_breakInSwitchStatement() {
7335 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: break;}", []); 7378 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: break;}", []);
7336 } 7379 }
7337 void test_breakOutsideOfLoop_breakInWhileStatement() { 7380 void test_breakOutsideOfLoop_breakInWhileStatement() {
7338 ParserTestCase.parse5("parseWhileStatement", "while (x) {break;}", []); 7381 ParserTestCase.parse5("parseWhileStatement", "while (x) {break;}", []);
7339 } 7382 }
7340 void test_breakOutsideOfLoop_functionExpression_inALoop() { 7383 void test_breakOutsideOfLoop_functionExpression_inALoop() {
7341 ParserTestCase.parse5("parseStatement", "for(; x;) {() {break;};}", [ParserE rrorCode.BREAK_OUTSIDE_OF_LOOP]); 7384 ParserTestCase.parseStatement("for(; x;) {() {break;};}", [ParserErrorCode.B REAK_OUTSIDE_OF_LOOP]);
7342 } 7385 }
7343 void test_breakOutsideOfLoop_functionExpression_withALoop() { 7386 void test_breakOutsideOfLoop_functionExpression_withALoop() {
7344 ParserTestCase.parse5("parseStatement", "() {for (; x;) {break;}};", []); 7387 ParserTestCase.parseStatement("() {for (; x;) {break;}};", []);
7345 } 7388 }
7346 void test_constAndFinal() { 7389 void test_constAndFinal() {
7347 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const final int x ;", [ParserErrorCode.CONST_AND_FINAL]); 7390 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const final int x ;", [ParserErrorCode.CONST_AND_FINAL]);
7348 } 7391 }
7349 void test_constAndVar() { 7392 void test_constAndVar() {
7350 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const var x;", [P arserErrorCode.CONST_AND_VAR]); 7393 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const var x;", [P arserErrorCode.CONST_AND_VAR]);
7351 } 7394 }
7352 void test_constClass() { 7395 void test_constClass() {
7353 ParserTestCase.parse5("parseCompilationUnit", "const class C {}", [ParserErr orCode.CONST_CLASS]); 7396 ParserTestCase.parseCompilationUnit("const class C {}", [ParserErrorCode.CON ST_CLASS]);
7397 }
7398 void test_constConstructorWithBody() {
7399 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const C() {}", [P arserErrorCode.CONST_CONSTRUCTOR_WITH_BODY]);
7400 }
7401 void test_constFactory() {
7402 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const factory C() {}", [ParserErrorCode.CONST_FACTORY]);
7354 } 7403 }
7355 void test_constMethod() { 7404 void test_constMethod() {
7356 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const int m() {}" , [ParserErrorCode.CONST_METHOD]); 7405 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const int m() {}" , [ParserErrorCode.CONST_METHOD]);
7357 } 7406 }
7407 void test_constructorWithReturnType() {
7408 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "C C() {}", [Parse rErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]);
7409 }
7410 void test_constructorWithReturnType_var() {
7411 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var C() {}", [Par serErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]);
7412 }
7358 void test_constTypedef() { 7413 void test_constTypedef() {
7359 ParserTestCase.parse5("parseCompilationUnit", "const typedef F();", [ParserE rrorCode.CONST_TYPEDEF]); 7414 ParserTestCase.parseCompilationUnit("const typedef F();", [ParserErrorCode.C ONST_TYPEDEF]);
7360 } 7415 }
7361 void test_continueOutsideOfLoop_continueInDoStatement() { 7416 void test_continueOutsideOfLoop_continueInDoStatement() {
7362 ParserTestCase.parse5("parseDoStatement", "do {continue;} while (x);", []); 7417 ParserTestCase.parse5("parseDoStatement", "do {continue;} while (x);", []);
7363 } 7418 }
7364 void test_continueOutsideOfLoop_continueInForStatement() { 7419 void test_continueOutsideOfLoop_continueInForStatement() {
7365 ParserTestCase.parse5("parseForStatement", "for (; x;) {continue;}", []); 7420 ParserTestCase.parse5("parseForStatement", "for (; x;) {continue;}", []);
7366 } 7421 }
7367 void test_continueOutsideOfLoop_continueInIfStatement() { 7422 void test_continueOutsideOfLoop_continueInIfStatement() {
7368 ParserTestCase.parse5("parseIfStatement", "if (x) {continue;}", [ParserError Code.CONTINUE_OUTSIDE_OF_LOOP]); 7423 ParserTestCase.parse5("parseIfStatement", "if (x) {continue;}", [ParserError Code.CONTINUE_OUTSIDE_OF_LOOP]);
7369 } 7424 }
7370 void test_continueOutsideOfLoop_continueInSwitchStatement() { 7425 void test_continueOutsideOfLoop_continueInSwitchStatement() {
7371 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue a;}", []); 7426 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue a;}", []);
7372 } 7427 }
7373 void test_continueOutsideOfLoop_continueInWhileStatement() { 7428 void test_continueOutsideOfLoop_continueInWhileStatement() {
7374 ParserTestCase.parse5("parseWhileStatement", "while (x) {continue;}", []); 7429 ParserTestCase.parse5("parseWhileStatement", "while (x) {continue;}", []);
7375 } 7430 }
7376 void test_continueOutsideOfLoop_functionExpression_inALoop() { 7431 void test_continueOutsideOfLoop_functionExpression_inALoop() {
7377 ParserTestCase.parse5("parseStatement", "for(; x;) {() {continue;};}", [Pars erErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); 7432 ParserTestCase.parseStatement("for(; x;) {() {continue;};}", [ParserErrorCod e.CONTINUE_OUTSIDE_OF_LOOP]);
7378 } 7433 }
7379 void test_continueOutsideOfLoop_functionExpression_withALoop() { 7434 void test_continueOutsideOfLoop_functionExpression_withALoop() {
7380 ParserTestCase.parse5("parseStatement", "() {for (; x;) {continue;}};", []); 7435 ParserTestCase.parseStatement("() {for (; x;) {continue;}};", []);
7381 } 7436 }
7382 void test_continueWithoutLabelInCase_error() { 7437 void test_continueWithoutLabelInCase_error() {
7383 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue; }", [ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE]); 7438 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue; }", [ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE]);
7384 } 7439 }
7385 void test_continueWithoutLabelInCase_noError() { 7440 void test_continueWithoutLabelInCase_noError() {
7386 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue a;}", []); 7441 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue a;}", []);
7387 } 7442 }
7388 void test_continueWithoutLabelInCase_noError_switchInLoop() { 7443 void test_continueWithoutLabelInCase_noError_switchInLoop() {
7389 ParserTestCase.parse5("parseWhileStatement", "while (a) { switch (b) {defaul t: continue;}}", []); 7444 ParserTestCase.parse5("parseWhileStatement", "while (a) { switch (b) {defaul t: continue;}}", []);
7390 } 7445 }
7391 void test_directiveAfterDeclaration_classBeforeDirective() { 7446 void test_directiveAfterDeclaration_classBeforeDirective() {
7392 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "class Foo{} library l;", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); 7447 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Foo{} libr ary l;", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
7393 JUnitTestCase.assertNotNull(unit); 7448 JUnitTestCase.assertNotNull(unit);
7394 } 7449 }
7395 void test_directiveAfterDeclaration_classBetweenDirectives() { 7450 void test_directiveAfterDeclaration_classBetweenDirectives() {
7396 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "librar y l;\nclass Foo{}\npart 'a.dart';", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION ]); 7451 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library l;\nclas s Foo{}\npart 'a.dart';", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
7397 JUnitTestCase.assertNotNull(unit); 7452 JUnitTestCase.assertNotNull(unit);
7398 } 7453 }
7399 void test_duplicatedModifier_const() { 7454 void test_duplicatedModifier_const() {
7400 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const const m;", [ParserErrorCode.DUPLICATED_MODIFIER]); 7455 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const const m;", [ParserErrorCode.DUPLICATED_MODIFIER]);
7401 } 7456 }
7402 void test_duplicatedModifier_external() { 7457 void test_duplicatedModifier_external() {
7403 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external external f();", [ParserErrorCode.DUPLICATED_MODIFIER]); 7458 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external external f();", [ParserErrorCode.DUPLICATED_MODIFIER]);
7404 } 7459 }
7405 void test_duplicatedModifier_factory() { 7460 void test_duplicatedModifier_factory() {
7406 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory factory C () {}", [ParserErrorCode.DUPLICATED_MODIFIER]); 7461 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory factory C () {}", [ParserErrorCode.DUPLICATED_MODIFIER]);
7407 } 7462 }
7408 void test_duplicatedModifier_final() { 7463 void test_duplicatedModifier_final() {
7409 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final final m;", [ParserErrorCode.DUPLICATED_MODIFIER]); 7464 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final final m;", [ParserErrorCode.DUPLICATED_MODIFIER]);
7410 } 7465 }
7411 void test_duplicatedModifier_static() { 7466 void test_duplicatedModifier_static() {
7412 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static static m;" , [ParserErrorCode.DUPLICATED_MODIFIER]); 7467 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static static var m;", [ParserErrorCode.DUPLICATED_MODIFIER]);
7413 } 7468 }
7414 void test_duplicatedModifier_var() { 7469 void test_duplicatedModifier_var() {
7415 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var var m;", [Par serErrorCode.DUPLICATED_MODIFIER]); 7470 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var var m;", [Par serErrorCode.DUPLICATED_MODIFIER]);
7416 } 7471 }
7417 void test_duplicateLabelInSwitchStatement() { 7472 void test_duplicateLabelInSwitchStatement() {
7418 ParserTestCase.parse5("parseSwitchStatement", "switch (e) {l1: case 0: break ; l1: case 1: break;}", [ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT]); 7473 ParserTestCase.parse5("parseSwitchStatement", "switch (e) {l1: case 0: break ; l1: case 1: break;}", [ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT]);
7419 } 7474 }
7420 void test_expectedCaseOrDefault() { 7475 void test_expectedCaseOrDefault() {
7421 ParserTestCase.parse5("parseSwitchStatement", "switch (e) {break;}", [Parser ErrorCode.EXPECTED_CASE_OR_DEFAULT]); 7476 ParserTestCase.parse5("parseSwitchStatement", "switch (e) {break;}", [Parser ErrorCode.EXPECTED_CASE_OR_DEFAULT]);
7422 } 7477 }
7423 void test_expectedClassMember_inClass_afterType() { 7478 void test_expectedClassMember_inClass_afterType() {
7424 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "heart 2 heart", [ ParserErrorCode.EXPECTED_CLASS_MEMBER]); 7479 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "heart 2 heart", [ ParserErrorCode.EXPECTED_CLASS_MEMBER]);
7425 } 7480 }
7426 void test_expectedClassMember_inClass_beforeType() { 7481 void test_expectedClassMember_inClass_beforeType() {
7427 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "4 score", [Parser ErrorCode.EXPECTED_CLASS_MEMBER]); 7482 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "4 score", [Parser ErrorCode.EXPECTED_CLASS_MEMBER]);
7428 } 7483 }
7429 void test_expectedExecutable_inClass_afterVoid() { 7484 void test_expectedExecutable_inClass_afterVoid() {
7430 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void 2 void", [Pa rserErrorCode.EXPECTED_EXECUTABLE]); 7485 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void 2 void", [Pa rserErrorCode.EXPECTED_EXECUTABLE]);
7431 } 7486 }
7432 void test_expectedExecutable_topLevel_afterType() { 7487 void test_expectedExecutable_topLevel_afterType() {
7433 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "heart 2 heart", [ParserErrorCode.EXPECTED_EXECUTABLE]); 7488 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "heart 2 heart", [ParserErrorCode.EXPECTED_EXECUTABLE]);
7434 } 7489 }
7435 void test_expectedExecutable_topLevel_afterVoid() { 7490 void test_expectedExecutable_topLevel_afterVoid() {
7436 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void 2 void", [ParserErrorCode.EXPECTED_EXECUTABLE]); 7491 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void 2 void", [ParserErrorCode.EXPECTED_EXECUTABLE]);
7437 } 7492 }
7438 void test_expectedExecutable_topLevel_beforeType() { 7493 void test_expectedExecutable_topLevel_beforeType() {
7439 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "4 score", [ParserErrorCode.EXPECTED_EXECUTABLE]); 7494 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "4 score", [ParserErrorCode.EXPECTED_EXECUTABLE]);
7440 } 7495 }
7496 void test_expectedInterpolationIdentifier() {
7497 ParserTestCase.parse5("parseStringLiteral", "'\$x\$'", [ParserErrorCode.MISS ING_IDENTIFIER]);
7498 }
7441 void test_expectedStringLiteral() { 7499 void test_expectedStringLiteral() {
7442 StringLiteral expression = ParserTestCase.parse5("parseStringLiteral", "1", [ParserErrorCode.EXPECTED_STRING_LITERAL]); 7500 StringLiteral expression = ParserTestCase.parse5("parseStringLiteral", "1", [ParserErrorCode.EXPECTED_STRING_LITERAL]);
7443 JUnitTestCase.assertTrue(expression.isSynthetic()); 7501 JUnitTestCase.assertTrue(expression.isSynthetic());
7444 } 7502 }
7445 void test_expectedToken_commaMissingInArgumentList() { 7503 void test_expectedToken_commaMissingInArgumentList() {
7446 ParserTestCase.parse5("parseArgumentList", "(x, y z)", [ParserErrorCode.EXPE CTED_TOKEN]); 7504 ParserTestCase.parse5("parseArgumentList", "(x, y z)", [ParserErrorCode.EXPE CTED_TOKEN]);
7447 } 7505 }
7448 void test_expectedToken_semicolonMissingAfterExpression() { 7506 void test_expectedToken_semicolonMissingAfterExpression() {
7449 ParserTestCase.parse5("parseStatement", "x", [ParserErrorCode.EXPECTED_TOKEN ]); 7507 ParserTestCase.parseStatement("x", [ParserErrorCode.EXPECTED_TOKEN]);
7450 } 7508 }
7451 void test_expectedToken_whileMissingInDoStatement() { 7509 void test_expectedToken_whileMissingInDoStatement() {
7452 ParserTestCase.parse5("parseStatement", "do {} (x);", [ParserErrorCode.EXPEC TED_TOKEN]); 7510 ParserTestCase.parseStatement("do {} (x);", [ParserErrorCode.EXPECTED_TOKEN] );
7511 }
7512 void test_expectedTwoMapTypeArguments_one() {
7513 Expression expression = ParserTestCase.parse5("parsePrimaryExpression", "<in t>{}", [ParserErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS]);
7514 EngineTestCase.assertInstanceOf(MapLiteral, expression);
7515 }
7516 void test_expectedTwoMapTypeArguments_three() {
7517 Expression expression = ParserTestCase.parse5("parsePrimaryExpression", "<in t, int, int>{}", [ParserErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS]);
7518 EngineTestCase.assertInstanceOf(MapLiteral, expression);
7519 }
7520 void test_expectedTypeName_is() {
7521 ParserTestCase.parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]) ;
7453 } 7522 }
7454 void test_exportDirectiveAfterPartDirective() { 7523 void test_exportDirectiveAfterPartDirective() {
7455 ParserTestCase.parse5("parseCompilationUnit", "part 'a.dart'; export 'b.dart ';", [ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]); 7524 ParserTestCase.parseCompilationUnit("part 'a.dart'; export 'b.dart';", [Pars erErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]);
7456 } 7525 }
7457 void test_externalAfterConst() { 7526 void test_externalAfterConst() {
7458 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const external C( );", [ParserErrorCode.EXTERNAL_AFTER_CONST]); 7527 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const external C( );", [ParserErrorCode.EXTERNAL_AFTER_CONST]);
7459 } 7528 }
7460 void test_externalAfterFactory() { 7529 void test_externalAfterFactory() {
7461 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory external C();", [ParserErrorCode.EXTERNAL_AFTER_FACTORY]); 7530 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory external C();", [ParserErrorCode.EXTERNAL_AFTER_FACTORY]);
7462 } 7531 }
7463 void test_externalAfterStatic() { 7532 void test_externalAfterStatic() {
7464 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static external i nt m();", [ParserErrorCode.EXTERNAL_AFTER_STATIC]); 7533 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static external i nt m();", [ParserErrorCode.EXTERNAL_AFTER_STATIC]);
7465 } 7534 }
7466 void test_externalClass() { 7535 void test_externalClass() {
7467 ParserTestCase.parse5("parseCompilationUnit", "external class C {}", [Parser ErrorCode.EXTERNAL_CLASS]); 7536 ParserTestCase.parseCompilationUnit("external class C {}", [ParserErrorCode. EXTERNAL_CLASS]);
7468 } 7537 }
7469 void test_externalConstructorWithBody_factory() { 7538 void test_externalConstructorWithBody_factory() {
7470 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external factory C() {}", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]); 7539 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external factory C() {}", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
7471 } 7540 }
7472 void test_externalConstructorWithBody_named() { 7541 void test_externalConstructorWithBody_named() {
7473 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external C.c() {} ", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]); 7542 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external C.c() {} ", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
7474 } 7543 }
7475 void test_externalField_const() { 7544 void test_externalField_const() {
7476 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external const A f;", [ParserErrorCode.EXTERNAL_FIELD]); 7545 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external const A f;", [ParserErrorCode.EXTERNAL_FIELD]);
7477 } 7546 }
(...skipping 15 matching lines...) Expand all
7493 void test_externalMethodWithBody() { 7562 void test_externalMethodWithBody() {
7494 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external m() {}", [ParserErrorCode.EXTERNAL_METHOD_WITH_BODY]); 7563 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external m() {}", [ParserErrorCode.EXTERNAL_METHOD_WITH_BODY]);
7495 } 7564 }
7496 void test_externalOperatorWithBody() { 7565 void test_externalOperatorWithBody() {
7497 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external operator +(int value) {}", [ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY]); 7566 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external operator +(int value) {}", [ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY]);
7498 } 7567 }
7499 void test_externalSetterWithBody() { 7568 void test_externalSetterWithBody() {
7500 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external set x(in t value) {}", [ParserErrorCode.EXTERNAL_SETTER_WITH_BODY]); 7569 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external set x(in t value) {}", [ParserErrorCode.EXTERNAL_SETTER_WITH_BODY]);
7501 } 7570 }
7502 void test_externalTypedef() { 7571 void test_externalTypedef() {
7503 ParserTestCase.parse5("parseCompilationUnit", "external typedef F();", [Pars erErrorCode.EXTERNAL_TYPEDEF]); 7572 ParserTestCase.parseCompilationUnit("external typedef F();", [ParserErrorCod e.EXTERNAL_TYPEDEF]);
7504 } 7573 }
7505 void test_factoryTopLevelDeclaration_class() { 7574 void test_factoryTopLevelDeclaration_class() {
7506 ParserTestCase.parse5("parseCompilationUnit", "factory class C {}", [ParserE rrorCode.FACTORY_TOP_LEVEL_DECLARATION]); 7575 ParserTestCase.parseCompilationUnit("factory class C {}", [ParserErrorCode.F ACTORY_TOP_LEVEL_DECLARATION]);
7507 } 7576 }
7508 void test_factoryTopLevelDeclaration_typedef() { 7577 void test_factoryTopLevelDeclaration_typedef() {
7509 ParserTestCase.parse5("parseCompilationUnit", "factory typedef F();", [Parse rErrorCode.FACTORY_TOP_LEVEL_DECLARATION]); 7578 ParserTestCase.parseCompilationUnit("factory typedef F();", [ParserErrorCode .FACTORY_TOP_LEVEL_DECLARATION]);
7579 }
7580 void test_factoryWithoutBody() {
7581 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory C();", [P arserErrorCode.FACTORY_WITHOUT_BODY]);
7510 } 7582 }
7511 void test_fieldInitializerOutsideConstructor() { 7583 void test_fieldInitializerOutsideConstructor() {
7512 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void m(this.x);", [ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); 7584 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void m(this.x);", [ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
7513 } 7585 }
7514 void test_finalAndVar() { 7586 void test_finalAndVar() {
7515 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final var x;", [P arserErrorCode.FINAL_AND_VAR]); 7587 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final var x;", [P arserErrorCode.FINAL_AND_VAR]);
7516 } 7588 }
7517 void test_finalClass() { 7589 void test_finalClass() {
7518 ParserTestCase.parse5("parseCompilationUnit", "final class C {}", [ParserErr orCode.FINAL_CLASS]); 7590 ParserTestCase.parseCompilationUnit("final class C {}", [ParserErrorCode.FIN AL_CLASS]);
7519 } 7591 }
7520 void test_finalConstructor() { 7592 void test_finalConstructor() {
7521 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final C() {}", [P arserErrorCode.FINAL_CONSTRUCTOR]); 7593 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final C() {}", [P arserErrorCode.FINAL_CONSTRUCTOR]);
7522 } 7594 }
7523 void test_finalMethod() { 7595 void test_finalMethod() {
7524 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final int m() {}" , [ParserErrorCode.FINAL_METHOD]); 7596 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final int m() {}" , [ParserErrorCode.FINAL_METHOD]);
7525 } 7597 }
7526 void test_finalTypedef() { 7598 void test_finalTypedef() {
7527 ParserTestCase.parse5("parseCompilationUnit", "final typedef F();", [ParserE rrorCode.FINAL_TYPEDEF]); 7599 ParserTestCase.parseCompilationUnit("final typedef F();", [ParserErrorCode.F INAL_TYPEDEF]);
7528 } 7600 }
7529 void test_getterWithParameters() { 7601 void test_getterWithParameters() {
7530 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int get x() {}", [ParserErrorCode.GETTER_WITH_PARAMETERS]); 7602 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int get x() {}", [ParserErrorCode.GETTER_WITH_PARAMETERS]);
7531 } 7603 }
7532 void test_illegalAssignmentToNonAssignable_superAssigned() { 7604 void test_illegalAssignmentToNonAssignable_superAssigned() {
7533 ParserTestCase.parse5("parseExpression", "super = x;", [ParserErrorCode.MISS ING_ASSIGNABLE_SELECTOR, ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]); 7605 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.MISSING_ASSIGN ABLE_SELECTOR, ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
7534 } 7606 }
7535 void test_implementsBeforeExtends() { 7607 void test_implementsBeforeExtends() {
7536 ParserTestCase.parse5("parseCompilationUnit", "class A implements B extends C {}", [ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS]); 7608 ParserTestCase.parseCompilationUnit("class A implements B extends C {}", [Pa rserErrorCode.IMPLEMENTS_BEFORE_EXTENDS]);
7537 } 7609 }
7538 void test_implementsBeforeWith() { 7610 void test_implementsBeforeWith() {
7539 ParserTestCase.parse5("parseCompilationUnit", "class A extends B implements C with D {}", [ParserErrorCode.IMPLEMENTS_BEFORE_WITH]); 7611 ParserTestCase.parseCompilationUnit("class A extends B implements C with D { }", [ParserErrorCode.IMPLEMENTS_BEFORE_WITH]);
7540 } 7612 }
7541 void test_importDirectiveAfterPartDirective() { 7613 void test_importDirectiveAfterPartDirective() {
7542 ParserTestCase.parse5("parseCompilationUnit", "part 'a.dart'; import 'b.dart ';", [ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]); 7614 ParserTestCase.parseCompilationUnit("part 'a.dart'; import 'b.dart';", [Pars erErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]);
7543 } 7615 }
7544 void test_initializedVariableInForEach() { 7616 void test_initializedVariableInForEach() {
7545 ParserTestCase.parse5("parseForStatement", "for (int a = 0 in foo) {}", [Par serErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH]); 7617 ParserTestCase.parse5("parseForStatement", "for (int a = 0 in foo) {}", [Par serErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH]);
7546 } 7618 }
7547 void test_invalidCodePoint() { 7619 void test_invalidCodePoint() {
7548 ParserTestCase.parse5("parseStringLiteral", "'\\uD900'", [ParserErrorCode.IN VALID_CODE_POINT]); 7620 ParserTestCase.parse5("parseStringLiteral", "'\\uD900'", [ParserErrorCode.IN VALID_CODE_POINT]);
7549 } 7621 }
7550 void test_invalidHexEscape_invalidDigit() { 7622 void test_invalidHexEscape_invalidDigit() {
7551 ParserTestCase.parse5("parseStringLiteral", "'\\x0 a'", [ParserErrorCode.INV ALID_HEX_ESCAPE]); 7623 ParserTestCase.parse5("parseStringLiteral", "'\\x0 a'", [ParserErrorCode.INV ALID_HEX_ESCAPE]);
7552 } 7624 }
7553 void test_invalidHexEscape_tooFewDigits() { 7625 void test_invalidHexEscape_tooFewDigits() {
7554 ParserTestCase.parse5("parseStringLiteral", "'\\x0'", [ParserErrorCode.INVAL ID_HEX_ESCAPE]); 7626 ParserTestCase.parse5("parseStringLiteral", "'\\x0'", [ParserErrorCode.INVAL ID_HEX_ESCAPE]);
7555 } 7627 }
7628 void test_invalidInterpolationIdentifier_startWithDigit() {
7629 ParserTestCase.parse5("parseStringLiteral", "'\$1'", [ParserErrorCode.MISSIN G_IDENTIFIER]);
7630 }
7556 void test_invalidOperator() { 7631 void test_invalidOperator() {
7557 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void operator === (x) {}", [ParserErrorCode.INVALID_OPERATOR]); 7632 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void operator === (x) {}", [ParserErrorCode.INVALID_OPERATOR]);
7558 } 7633 }
7559 void test_invalidOperatorForSuper() { 7634 void test_invalidOperatorForSuper() {
7560 ParserTestCase.parse5("parseUnaryExpression", "++super", [ParserErrorCode.IN VALID_OPERATOR_FOR_SUPER]); 7635 ParserTestCase.parse5("parseUnaryExpression", "++super", [ParserErrorCode.IN VALID_OPERATOR_FOR_SUPER]);
7561 } 7636 }
7562 void test_invalidUnicodeEscape_incomplete_noDigits() { 7637 void test_invalidUnicodeEscape_incomplete_noDigits() {
7563 ParserTestCase.parse5("parseStringLiteral", "'\\u{'", [ParserErrorCode.INVAL ID_UNICODE_ESCAPE]); 7638 ParserTestCase.parse5("parseStringLiteral", "'\\u{'", [ParserErrorCode.INVAL ID_UNICODE_ESCAPE]);
7564 } 7639 }
7565 void test_invalidUnicodeEscape_incomplete_someDigits() { 7640 void test_invalidUnicodeEscape_incomplete_someDigits() {
7566 ParserTestCase.parse5("parseStringLiteral", "'\\u{0A'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]); 7641 ParserTestCase.parse5("parseStringLiteral", "'\\u{0A'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]);
7567 } 7642 }
7568 void test_invalidUnicodeEscape_invalidDigit() { 7643 void test_invalidUnicodeEscape_invalidDigit() {
7569 ParserTestCase.parse5("parseStringLiteral", "'\\u0 a'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]); 7644 ParserTestCase.parse5("parseStringLiteral", "'\\u0 a'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]);
7570 } 7645 }
7571 void test_invalidUnicodeEscape_tooFewDigits_fixed() { 7646 void test_invalidUnicodeEscape_tooFewDigits_fixed() {
7572 ParserTestCase.parse5("parseStringLiteral", "'\\u04'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]); 7647 ParserTestCase.parse5("parseStringLiteral", "'\\u04'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]);
7573 } 7648 }
7574 void test_invalidUnicodeEscape_tooFewDigits_variable() { 7649 void test_invalidUnicodeEscape_tooFewDigits_variable() {
7575 ParserTestCase.parse5("parseStringLiteral", "'\\u{}'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]); 7650 ParserTestCase.parse5("parseStringLiteral", "'\\u{}'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]);
7576 } 7651 }
7577 void test_invalidUnicodeEscape_tooManyDigits_variable() { 7652 void test_invalidUnicodeEscape_tooManyDigits_variable() {
7578 ParserTestCase.parse5("parseStringLiteral", "'\\u{12345678}'", [ParserErrorC ode.INVALID_UNICODE_ESCAPE, ParserErrorCode.INVALID_CODE_POINT]); 7653 ParserTestCase.parse5("parseStringLiteral", "'\\u{12345678}'", [ParserErrorC ode.INVALID_UNICODE_ESCAPE, ParserErrorCode.INVALID_CODE_POINT]);
7579 } 7654 }
7580 void test_libraryDirectiveNotFirst() { 7655 void test_libraryDirectiveNotFirst() {
7581 ParserTestCase.parse5("parseCompilationUnit", "import 'x.dart'; library l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]); 7656 ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;", [ParserEr rorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
7582 } 7657 }
7583 void test_libraryDirectiveNotFirst_afterPart() { 7658 void test_libraryDirectiveNotFirst_afterPart() {
7584 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "part ' a.dart';\nlibrary l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]); 7659 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part 'a.dart';\n library l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
7585 JUnitTestCase.assertNotNull(unit); 7660 JUnitTestCase.assertNotNull(unit);
7586 } 7661 }
7587 void test_missingAssignableSelector_identifiersAssigned() { 7662 void test_missingAssignableSelector_identifiersAssigned() {
7588 ParserTestCase.parse5("parseExpression", "x.y = y;", []); 7663 ParserTestCase.parseExpression("x.y = y;", []);
7589 } 7664 }
7590 void test_missingAssignableSelector_primarySelectorPostfix() { 7665 void test_missingAssignableSelector_primarySelectorPostfix() {
7591 ParserTestCase.parse5("parseExpression", "x(y)(z)++", [ParserErrorCode.MISSI NG_ASSIGNABLE_SELECTOR]); 7666 ParserTestCase.parseExpression("x(y)(z)++", [ParserErrorCode.MISSING_ASSIGNA BLE_SELECTOR]);
7592 } 7667 }
7593 void test_missingAssignableSelector_selector() { 7668 void test_missingAssignableSelector_selector() {
7594 ParserTestCase.parse5("parseExpression", "x(y)(z).a++", []); 7669 ParserTestCase.parseExpression("x(y)(z).a++", []);
7595 } 7670 }
7596 void test_missingAssignableSelector_superPrimaryExpression() { 7671 void test_missingAssignableSelector_superPrimaryExpression() {
7597 SuperExpression expression = ParserTestCase.parse5("parsePrimaryExpression", "super", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]); 7672 SuperExpression expression = ParserTestCase.parse5("parsePrimaryExpression", "super", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
7598 JUnitTestCase.assertNotNull(expression.keyword); 7673 JUnitTestCase.assertNotNull(expression.keyword);
7599 } 7674 }
7600 void test_missingAssignableSelector_superPropertyAccessAssigned() { 7675 void test_missingAssignableSelector_superPropertyAccessAssigned() {
7601 ParserTestCase.parse5("parseExpression", "super.x = x;", []); 7676 ParserTestCase.parseExpression("super.x = x;", []);
7602 } 7677 }
7603 void test_missingCatchOrFinally() { 7678 void test_missingCatchOrFinally() {
7604 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}" , [ParserErrorCode.MISSING_CATCH_OR_FINALLY]); 7679 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}" , [ParserErrorCode.MISSING_CATCH_OR_FINALLY]);
7605 JUnitTestCase.assertNotNull(statement); 7680 JUnitTestCase.assertNotNull(statement);
7606 } 7681 }
7607 void test_missingClassBody() { 7682 void test_missingClassBody() {
7608 ParserTestCase.parse5("parseCompilationUnit", "class A class B {}", [ParserE rrorCode.MISSING_CLASS_BODY]); 7683 ParserTestCase.parseCompilationUnit("class A class B {}", [ParserErrorCode.M ISSING_CLASS_BODY]);
7609 } 7684 }
7610 void test_missingConstFinalVarOrType() { 7685 void test_missingConstFinalVarOrType_static() {
7686 ParserTestCase.parseCompilationUnit("class A { static f; }", [ParserErrorCod e.MISSING_CONST_FINAL_VAR_OR_TYPE]);
7687 }
7688 void test_missingConstFinalVarOrType_topLevel() {
7611 ParserTestCase.parse4("parseFinalConstVarOrType", <Object> [false], "a;", [P arserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]); 7689 ParserTestCase.parse4("parseFinalConstVarOrType", <Object> [false], "a;", [P arserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
7612 } 7690 }
7691 void test_missingExpressionInThrow_withCascade() {
7692 ParserTestCase.parse5("parseThrowExpression", "throw;", [ParserErrorCode.MIS SING_EXPRESSION_IN_THROW]);
7693 }
7694 void test_missingExpressionInThrow_withoutCascade() {
7695 ParserTestCase.parse5("parseThrowExpressionWithoutCascade", "throw;", [Parse rErrorCode.MISSING_EXPRESSION_IN_THROW]);
7696 }
7613 void test_missingFunctionBody_emptyNotAllowed() { 7697 void test_missingFunctionBody_emptyNotAllowed() {
7614 ParserTestCase.parse4("parseFunctionBody", <Object> [false, false], ";", [Pa rserErrorCode.MISSING_FUNCTION_BODY]); 7698 ParserTestCase.parse4("parseFunctionBody", <Object> [false, ParserErrorCode. MISSING_FUNCTION_BODY, false], ";", [ParserErrorCode.MISSING_FUNCTION_BODY]);
7615 } 7699 }
7616 void test_missingFunctionBody_invalid() { 7700 void test_missingFunctionBody_invalid() {
7617 ParserTestCase.parse4("parseFunctionBody", <Object> [false, false], "return 0;", [ParserErrorCode.MISSING_FUNCTION_BODY]); 7701 ParserTestCase.parse4("parseFunctionBody", <Object> [false, ParserErrorCode. MISSING_FUNCTION_BODY, false], "return 0;", [ParserErrorCode.MISSING_FUNCTION_BO DY]);
7618 } 7702 }
7619 void test_missingFunctionParameters_local_void_block() { 7703 void test_missingFunctionParameters_local_void_block() {
7620 ParserTestCase.parse5("parseStatement", "void f { return x;}", [ParserErrorC ode.MISSING_FUNCTION_PARAMETERS]); 7704 ParserTestCase.parseStatement("void f { return x;}", [ParserErrorCode.MISSIN G_FUNCTION_PARAMETERS]);
7621 } 7705 }
7622 void test_missingFunctionParameters_local_void_expression() { 7706 void test_missingFunctionParameters_local_void_expression() {
7623 ParserTestCase.parse5("parseStatement", "void f => x;", [ParserErrorCode.MIS SING_FUNCTION_PARAMETERS]); 7707 ParserTestCase.parseStatement("void f => x;", [ParserErrorCode.MISSING_FUNCT ION_PARAMETERS]);
7624 } 7708 }
7625 void test_missingFunctionParameters_topLevel_nonVoid_block() { 7709 void test_missingFunctionParameters_topLevel_nonVoid_block() {
7626 ParserTestCase.parse5("parseCompilationUnit", "int f { return x;}", [ParserE rrorCode.MISSING_FUNCTION_PARAMETERS]); 7710 ParserTestCase.parseCompilationUnit("int f { return x;}", [ParserErrorCode.M ISSING_FUNCTION_PARAMETERS]);
7627 } 7711 }
7628 void test_missingFunctionParameters_topLevel_nonVoid_expression() { 7712 void test_missingFunctionParameters_topLevel_nonVoid_expression() {
7629 ParserTestCase.parse5("parseCompilationUnit", "int f => x;", [ParserErrorCod e.MISSING_FUNCTION_PARAMETERS]); 7713 ParserTestCase.parseCompilationUnit("int f => x;", [ParserErrorCode.MISSING_ FUNCTION_PARAMETERS]);
7630 } 7714 }
7631 void test_missingFunctionParameters_topLevel_void_block() { 7715 void test_missingFunctionParameters_topLevel_void_block() {
7632 ParserTestCase.parse5("parseCompilationUnit", "void f { return x;}", [Parser ErrorCode.MISSING_FUNCTION_PARAMETERS]); 7716 ParserTestCase.parseCompilationUnit("void f { return x;}", [ParserErrorCode. MISSING_FUNCTION_PARAMETERS]);
7633 } 7717 }
7634 void test_missingFunctionParameters_topLevel_void_expression() { 7718 void test_missingFunctionParameters_topLevel_void_expression() {
7635 ParserTestCase.parse5("parseCompilationUnit", "void f => x;", [ParserErrorCo de.MISSING_FUNCTION_PARAMETERS]); 7719 ParserTestCase.parseCompilationUnit("void f => x;", [ParserErrorCode.MISSING _FUNCTION_PARAMETERS]);
7720 }
7721 void test_missingIdentifier_afterOperator() {
7722 ParserTestCase.parse5("parseMultiplicativeExpression", "1 *", [ParserErrorCo de.MISSING_IDENTIFIER]);
7636 } 7723 }
7637 void test_missingIdentifier_functionDeclaration_returnTypeWithoutName() { 7724 void test_missingIdentifier_functionDeclaration_returnTypeWithoutName() {
7638 ParserTestCase.parse5("parseFunctionDeclarationStatement", "A<T> () {}", [Pa rserErrorCode.MISSING_IDENTIFIER]); 7725 ParserTestCase.parse5("parseFunctionDeclarationStatement", "A<T> () {}", [Pa rserErrorCode.MISSING_IDENTIFIER]);
7639 } 7726 }
7640 void test_missingIdentifier_number() { 7727 void test_missingIdentifier_number() {
7641 SimpleIdentifier expression = ParserTestCase.parse5("parseSimpleIdentifier", "1", [ParserErrorCode.MISSING_IDENTIFIER]); 7728 SimpleIdentifier expression = ParserTestCase.parse5("parseSimpleIdentifier", "1", [ParserErrorCode.MISSING_IDENTIFIER]);
7642 JUnitTestCase.assertTrue(expression.isSynthetic()); 7729 JUnitTestCase.assertTrue(expression.isSynthetic());
7643 } 7730 }
7644 void test_missingKeywordOperator() { 7731 void test_missingKeywordOperator() {
7645 ParserTestCase.parse4("parseOperator", <Object> [emptyCommentAndMetadata(), null, null], "+(x) {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]); 7732 ParserTestCase.parse4("parseOperator", <Object> [emptyCommentAndMetadata(), null, null], "+(x) {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
7646 } 7733 }
7647 void test_missingNameInLibraryDirective() { 7734 void test_missingNameInLibraryDirective() {
7648 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "librar y;", [ParserErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]); 7735 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library;", [Pars erErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]);
7649 JUnitTestCase.assertNotNull(unit); 7736 JUnitTestCase.assertNotNull(unit);
7650 } 7737 }
7651 void test_missingNameInPartOfDirective() { 7738 void test_missingNameInPartOfDirective() {
7652 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "part o f;", [ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE]); 7739 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of;", [Pars erErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE]);
7653 JUnitTestCase.assertNotNull(unit); 7740 JUnitTestCase.assertNotNull(unit);
7654 } 7741 }
7655 void test_missingTerminatorForParameterGroup_named() { 7742 void test_missingTerminatorForParameterGroup_named() {
7656 ParserTestCase.parse5("parseFormalParameterList", "(a, {b: 0)", [ParserError Code.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]); 7743 ParserTestCase.parse5("parseFormalParameterList", "(a, {b: 0)", [ParserError Code.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
7657 } 7744 }
7658 void test_missingTerminatorForParameterGroup_optional() { 7745 void test_missingTerminatorForParameterGroup_optional() {
7659 ParserTestCase.parse5("parseFormalParameterList", "(a, [b = 0)", [ParserErro rCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]); 7746 ParserTestCase.parse5("parseFormalParameterList", "(a, [b = 0)", [ParserErro rCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
7660 } 7747 }
7661 void test_missingTypedefParameters_nonVoid() { 7748 void test_missingTypedefParameters_nonVoid() {
7662 ParserTestCase.parse5("parseCompilationUnit", "typedef int F;", [ParserError Code.MISSING_TYPEDEF_PARAMETERS]); 7749 ParserTestCase.parseCompilationUnit("typedef int F;", [ParserErrorCode.MISSI NG_TYPEDEF_PARAMETERS]);
7663 } 7750 }
7664 void test_missingTypedefParameters_typeParameters() { 7751 void test_missingTypedefParameters_typeParameters() {
7665 ParserTestCase.parse5("parseCompilationUnit", "typedef F<E>;", [ParserErrorC ode.MISSING_TYPEDEF_PARAMETERS]); 7752 ParserTestCase.parseCompilationUnit("typedef F<E>;", [ParserErrorCode.MISSIN G_TYPEDEF_PARAMETERS]);
7666 } 7753 }
7667 void test_missingTypedefParameters_void() { 7754 void test_missingTypedefParameters_void() {
7668 ParserTestCase.parse5("parseCompilationUnit", "typedef void F;", [ParserErro rCode.MISSING_TYPEDEF_PARAMETERS]); 7755 ParserTestCase.parseCompilationUnit("typedef void F;", [ParserErrorCode.MISS ING_TYPEDEF_PARAMETERS]);
7669 } 7756 }
7670 void test_missingVariableInForEach() { 7757 void test_missingVariableInForEach() {
7671 ParserTestCase.parse5("parseForStatement", "for (a < b in foo) {}", [ParserE rrorCode.MISSING_VARIABLE_IN_FOR_EACH]); 7758 ParserTestCase.parse5("parseForStatement", "for (a < b in foo) {}", [ParserE rrorCode.MISSING_VARIABLE_IN_FOR_EACH]);
7672 } 7759 }
7673 void test_mixedParameterGroups_namedPositional() { 7760 void test_mixedParameterGroups_namedPositional() {
7674 ParserTestCase.parse5("parseFormalParameterList", "(a, {b}, [c])", [ParserEr rorCode.MIXED_PARAMETER_GROUPS]); 7761 ParserTestCase.parse5("parseFormalParameterList", "(a, {b}, [c])", [ParserEr rorCode.MIXED_PARAMETER_GROUPS]);
7675 } 7762 }
7676 void test_mixedParameterGroups_positionalNamed() { 7763 void test_mixedParameterGroups_positionalNamed() {
7677 ParserTestCase.parse5("parseFormalParameterList", "(a, [b], {c})", [ParserEr rorCode.MIXED_PARAMETER_GROUPS]); 7764 ParserTestCase.parse5("parseFormalParameterList", "(a, [b], {c})", [ParserEr rorCode.MIXED_PARAMETER_GROUPS]);
7678 } 7765 }
7679 void test_multipleLibraryDirectives() { 7766 void test_multipleLibraryDirectives() {
7680 ParserTestCase.parse5("parseCompilationUnit", "library l; library m;", [Pars erErrorCode.MULTIPLE_LIBRARY_DIRECTIVES]); 7767 ParserTestCase.parseCompilationUnit("library l; library m;", [ParserErrorCod e.MULTIPLE_LIBRARY_DIRECTIVES]);
7681 } 7768 }
7682 void test_multipleNamedParameterGroups() { 7769 void test_multipleNamedParameterGroups() {
7683 ParserTestCase.parse5("parseFormalParameterList", "(a, {b}, {c})", [ParserEr rorCode.MULTIPLE_NAMED_PARAMETER_GROUPS]); 7770 ParserTestCase.parse5("parseFormalParameterList", "(a, {b}, {c})", [ParserEr rorCode.MULTIPLE_NAMED_PARAMETER_GROUPS]);
7684 } 7771 }
7685 void test_multiplePartOfDirectives() { 7772 void test_multiplePartOfDirectives() {
7686 ParserTestCase.parse5("parseCompilationUnit", "part of l; part of m;", [Pars erErrorCode.MULTIPLE_PART_OF_DIRECTIVES]); 7773 ParserTestCase.parseCompilationUnit("part of l; part of m;", [ParserErrorCod e.MULTIPLE_PART_OF_DIRECTIVES]);
7687 } 7774 }
7688 void test_multiplePositionalParameterGroups() { 7775 void test_multiplePositionalParameterGroups() {
7689 ParserTestCase.parse5("parseFormalParameterList", "(a, [b], [c])", [ParserEr rorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS]); 7776 ParserTestCase.parse5("parseFormalParameterList", "(a, [b], [c])", [ParserEr rorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS]);
7690 } 7777 }
7691 void test_multipleVariablesInForEach() { 7778 void test_multipleVariablesInForEach() {
7692 ParserTestCase.parse5("parseForStatement", "for (int a, b in foo) {}", [Pars erErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH]); 7779 ParserTestCase.parse5("parseForStatement", "for (int a, b in foo) {}", [Pars erErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH]);
7693 } 7780 }
7694 void test_namedParameterOutsideGroup() { 7781 void test_namedParameterOutsideGroup() {
7695 ParserTestCase.parse5("parseFormalParameterList", "(a, b : 0)", [ParserError Code.NAMED_PARAMETER_OUTSIDE_GROUP]); 7782 ParserTestCase.parse5("parseFormalParameterList", "(a, b : 0)", [ParserError Code.NAMED_PARAMETER_OUTSIDE_GROUP]);
7696 } 7783 }
7697 void test_nonConstructorFactory_field() { 7784 void test_nonConstructorFactory_field() {
7698 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory int x;", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]); 7785 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory int x;", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
7699 } 7786 }
7700 void test_nonConstructorFactory_method() { 7787 void test_nonConstructorFactory_method() {
7701 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory int m() { }", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]); 7788 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory int m() { }", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
7702 } 7789 }
7703 void test_nonIdentifierLibraryName_library() { 7790 void test_nonIdentifierLibraryName_library() {
7704 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "librar y 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]); 7791 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
7705 JUnitTestCase.assertNotNull(unit); 7792 JUnitTestCase.assertNotNull(unit);
7706 } 7793 }
7707 void test_nonIdentifierLibraryName_partOf() { 7794 void test_nonIdentifierLibraryName_partOf() {
7708 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "part o f 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]); 7795 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
7709 JUnitTestCase.assertNotNull(unit); 7796 JUnitTestCase.assertNotNull(unit);
7710 } 7797 }
7711 void test_nonPartOfDirectiveInPart_after() { 7798 void test_nonPartOfDirectiveInPart_after() {
7712 ParserTestCase.parse5("parseCompilationUnit", "part of l; part 'f.dart';", [ ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART]); 7799 ParserTestCase.parseCompilationUnit("part of l; part 'f.dart';", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]);
7713 } 7800 }
7714 void test_nonPartOfDirectiveInPart_before() { 7801 void test_nonPartOfDirectiveInPart_before() {
7715 ParserTestCase.parse5("parseCompilationUnit", "part 'f.dart'; part of m;", [ ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART]); 7802 ParserTestCase.parseCompilationUnit("part 'f.dart'; part of m;", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]);
7716 } 7803 }
7717 void test_nonUserDefinableOperator() { 7804 void test_nonUserDefinableOperator() {
7718 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "operator +=(int x ) => x + 1;", [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]); 7805 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "operator +=(int x ) => x + 1;", [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]);
7719 } 7806 }
7720 void test_positionalAfterNamedArgument() { 7807 void test_positionalAfterNamedArgument() {
7721 ParserTestCase.parse5("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POS ITIONAL_AFTER_NAMED_ARGUMENT]); 7808 ParserTestCase.parse5("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POS ITIONAL_AFTER_NAMED_ARGUMENT]);
7722 } 7809 }
7723 void test_positionalParameterOutsideGroup() { 7810 void test_positionalParameterOutsideGroup() {
7724 ParserTestCase.parse5("parseFormalParameterList", "(a, b = 0)", [ParserError Code.POSITIONAL_PARAMETER_OUTSIDE_GROUP]); 7811 ParserTestCase.parse5("parseFormalParameterList", "(a, b = 0)", [ParserError Code.POSITIONAL_PARAMETER_OUTSIDE_GROUP]);
7725 } 7812 }
7726 void test_staticAfterConst() { 7813 void test_staticAfterConst() {
7727 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final static int f;", [ParserErrorCode.STATIC_AFTER_FINAL]); 7814 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final static int f;", [ParserErrorCode.STATIC_AFTER_FINAL]);
7728 } 7815 }
7729 void test_staticAfterFinal() { 7816 void test_staticAfterFinal() {
7730 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const static int f;", [ParserErrorCode.STATIC_AFTER_CONST]); 7817 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const static int f;", [ParserErrorCode.STATIC_AFTER_CONST]);
7731 } 7818 }
7732 void test_staticAfterVar() { 7819 void test_staticAfterVar() {
7733 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var static f;", [ ParserErrorCode.STATIC_AFTER_VAR]); 7820 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var static f;", [ ParserErrorCode.STATIC_AFTER_VAR]);
7734 } 7821 }
7735 void test_staticConstructor() { 7822 void test_staticConstructor() {
7736 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static C.m() {}", [ParserErrorCode.STATIC_CONSTRUCTOR]); 7823 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static C.m() {}", [ParserErrorCode.STATIC_CONSTRUCTOR]);
7737 } 7824 }
7825 void test_staticGetterWithoutBody() {
7826 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static get m;", [ ParserErrorCode.STATIC_GETTER_WITHOUT_BODY]);
7827 }
7738 void test_staticOperator_noReturnType() { 7828 void test_staticOperator_noReturnType() {
7739 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static operator + (int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]); 7829 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static operator + (int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]);
7740 } 7830 }
7741 void test_staticOperator_returnType() { 7831 void test_staticOperator_returnType() {
7742 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static int operat or +(int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]); 7832 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static int operat or +(int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]);
7743 } 7833 }
7834 void test_staticSetterWithoutBody() {
7835 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static set m(x);" , [ParserErrorCode.STATIC_SETTER_WITHOUT_BODY]);
7836 }
7744 void test_staticTopLevelDeclaration_class() { 7837 void test_staticTopLevelDeclaration_class() {
7745 ParserTestCase.parse5("parseCompilationUnit", "static class C {}", [ParserEr rorCode.STATIC_TOP_LEVEL_DECLARATION]); 7838 ParserTestCase.parseCompilationUnit("static class C {}", [ParserErrorCode.ST ATIC_TOP_LEVEL_DECLARATION]);
7746 } 7839 }
7747 void test_staticTopLevelDeclaration_typedef() { 7840 void test_staticTopLevelDeclaration_typedef() {
7748 ParserTestCase.parse5("parseCompilationUnit", "static typedef F();", [Parser ErrorCode.STATIC_TOP_LEVEL_DECLARATION]); 7841 ParserTestCase.parseCompilationUnit("static typedef F();", [ParserErrorCode. STATIC_TOP_LEVEL_DECLARATION]);
7749 } 7842 }
7750 void test_staticTopLevelDeclaration_variable() { 7843 void test_staticTopLevelDeclaration_variable() {
7751 ParserTestCase.parse5("parseCompilationUnit", "static var x;", [ParserErrorC ode.STATIC_TOP_LEVEL_DECLARATION]); 7844 ParserTestCase.parseCompilationUnit("static var x;", [ParserErrorCode.STATIC _TOP_LEVEL_DECLARATION]);
7752 } 7845 }
7753 void test_switchHasCaseAfterDefaultCase() { 7846 void test_switchHasCaseAfterDefaultCase() {
7754 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]); 7847 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
7755 } 7848 }
7756 void test_switchHasCaseAfterDefaultCase_repeated() { 7849 void test_switchHasCaseAfterDefaultCase_repeated() {
7757 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1; case 2: return 2;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_ DEFAULT_CASE, ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]); 7850 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1; case 2: return 2;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_ DEFAULT_CASE, ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
7758 } 7851 }
7759 void test_switchHasMultipleDefaultCases() { 7852 void test_switchHasMultipleDefaultCases() {
7760 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1;}", [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]); 7853 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1;}", [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
7761 } 7854 }
(...skipping 12 matching lines...) Expand all
7774 void test_unexpectedTerminatorForParameterGroup_named() { 7867 void test_unexpectedTerminatorForParameterGroup_named() {
7775 ParserTestCase.parse5("parseFormalParameterList", "(a, b})", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]); 7868 ParserTestCase.parse5("parseFormalParameterList", "(a, b})", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
7776 } 7869 }
7777 void test_unexpectedTerminatorForParameterGroup_optional() { 7870 void test_unexpectedTerminatorForParameterGroup_optional() {
7778 ParserTestCase.parse5("parseFormalParameterList", "(a, b])", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]); 7871 ParserTestCase.parse5("parseFormalParameterList", "(a, b])", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
7779 } 7872 }
7780 void test_unexpectedToken_semicolonBetweenClassMembers() { 7873 void test_unexpectedToken_semicolonBetweenClassMembers() {
7781 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]) ; 7874 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]) ;
7782 } 7875 }
7783 void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() { 7876 void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() {
7784 ParserTestCase.parse5("parseCompilationUnit", "int x; ; int y;", [ParserErro rCode.UNEXPECTED_TOKEN]); 7877 ParserTestCase.parseCompilationUnit("int x; ; int y;", [ParserErrorCode.UNEX PECTED_TOKEN]);
7785 } 7878 }
7786 void test_useOfUnaryPlusOperator() { 7879 void test_useOfUnaryPlusOperator() {
7787 ParserTestCase.parse5("parseUnaryExpression", "+x", [ParserErrorCode.USE_OF_ UNARY_PLUS_OPERATOR]); 7880 SimpleIdentifier expression = ParserTestCase.parse5("parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]);
7881 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression);
7882 JUnitTestCase.assertTrue(expression.isSynthetic());
7883 }
7884 void test_varAsTypeName_as() {
7885 ParserTestCase.parseExpression("x as var", [ParserErrorCode.VAR_AS_TYPE_NAME ]);
7788 } 7886 }
7789 void test_varClass() { 7887 void test_varClass() {
7790 ParserTestCase.parse5("parseCompilationUnit", "var class C {}", [ParserError Code.VAR_CLASS]); 7888 ParserTestCase.parseCompilationUnit("var class C {}", [ParserErrorCode.VAR_C LASS]);
7791 }
7792 void test_varConstructor() {
7793 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var C() {}", [Par serErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]);
7794 } 7889 }
7795 void test_varReturnType() { 7890 void test_varReturnType() {
7796 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var m() {}", [Par serErrorCode.VAR_RETURN_TYPE]); 7891 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var m() {}", [Par serErrorCode.VAR_RETURN_TYPE]);
7797 } 7892 }
7798 void test_varTypedef() { 7893 void test_varTypedef() {
7799 ParserTestCase.parse5("parseCompilationUnit", "var typedef F();", [ParserErr orCode.VAR_TYPEDEF]); 7894 ParserTestCase.parseCompilationUnit("var typedef F();", [ParserErrorCode.VAR _TYPEDEF]);
7800 } 7895 }
7801 void test_voidField_initializer() { 7896 void test_voidField_initializer() {
7802 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void x = 0;", [Pa rserErrorCode.VOID_VARIABLE]); 7897 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void x = 0;", [Pa rserErrorCode.VOID_VARIABLE]);
7803 } 7898 }
7804 void test_voidField_noInitializer() { 7899 void test_voidField_noInitializer() {
7805 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void x;", [Parser ErrorCode.VOID_VARIABLE]); 7900 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void x;", [Parser ErrorCode.VOID_VARIABLE]);
7806 } 7901 }
7807 void test_voidParameter() { 7902 void test_voidParameter() {
7808 ParserTestCase.parse5("parseNormalFormalParameter", "void a)", [ParserErrorC ode.VOID_PARAMETER]); 7903 ParserTestCase.parse5("parseNormalFormalParameter", "void a)", [ParserErrorC ode.VOID_PARAMETER]);
7809 } 7904 }
7810 void test_withBeforeExtends() { 7905 void test_withBeforeExtends() {
7811 ParserTestCase.parse5("parseCompilationUnit", "class A with B extends C {}", [ParserErrorCode.WITH_BEFORE_EXTENDS]); 7906 ParserTestCase.parseCompilationUnit("class A with B extends C {}", [ParserEr rorCode.WITH_BEFORE_EXTENDS]);
7812 } 7907 }
7813 void test_withWithoutExtends() { 7908 void test_withWithoutExtends() {
7814 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class A with B, C {}", [ParserErrorCode.WITH_WITHOUT_EXTENDS]); 7909 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class A with B, C {}", [ParserErrorCode.WITH_WITHOUT_EXTENDS]);
7815 } 7910 }
7816 void test_wrongSeparatorForNamedParameter() { 7911 void test_wrongSeparatorForNamedParameter() {
7817 ParserTestCase.parse5("parseFormalParameterList", "(a, {b = 0})", [ParserErr orCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER]); 7912 ParserTestCase.parse5("parseFormalParameterList", "(a, {b = 0})", [ParserErr orCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER]);
7818 } 7913 }
7819 void test_wrongSeparatorForPositionalParameter() { 7914 void test_wrongSeparatorForPositionalParameter() {
7820 ParserTestCase.parse5("parseFormalParameterList", "(a, [b : 0])", [ParserErr orCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER]); 7915 ParserTestCase.parse5("parseFormalParameterList", "(a, [b : 0])", [ParserErr orCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER]);
7821 } 7916 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
7900 runJUnitTest(__test, __test.test_constAndFinal); 7995 runJUnitTest(__test, __test.test_constAndFinal);
7901 }); 7996 });
7902 _ut.test('test_constAndVar', () { 7997 _ut.test('test_constAndVar', () {
7903 final __test = new ErrorParserTest(); 7998 final __test = new ErrorParserTest();
7904 runJUnitTest(__test, __test.test_constAndVar); 7999 runJUnitTest(__test, __test.test_constAndVar);
7905 }); 8000 });
7906 _ut.test('test_constClass', () { 8001 _ut.test('test_constClass', () {
7907 final __test = new ErrorParserTest(); 8002 final __test = new ErrorParserTest();
7908 runJUnitTest(__test, __test.test_constClass); 8003 runJUnitTest(__test, __test.test_constClass);
7909 }); 8004 });
8005 _ut.test('test_constConstructorWithBody', () {
8006 final __test = new ErrorParserTest();
8007 runJUnitTest(__test, __test.test_constConstructorWithBody);
8008 });
8009 _ut.test('test_constFactory', () {
8010 final __test = new ErrorParserTest();
8011 runJUnitTest(__test, __test.test_constFactory);
8012 });
7910 _ut.test('test_constMethod', () { 8013 _ut.test('test_constMethod', () {
7911 final __test = new ErrorParserTest(); 8014 final __test = new ErrorParserTest();
7912 runJUnitTest(__test, __test.test_constMethod); 8015 runJUnitTest(__test, __test.test_constMethod);
7913 }); 8016 });
7914 _ut.test('test_constTypedef', () { 8017 _ut.test('test_constTypedef', () {
7915 final __test = new ErrorParserTest(); 8018 final __test = new ErrorParserTest();
7916 runJUnitTest(__test, __test.test_constTypedef); 8019 runJUnitTest(__test, __test.test_constTypedef);
7917 }); 8020 });
8021 _ut.test('test_constructorWithReturnType', () {
8022 final __test = new ErrorParserTest();
8023 runJUnitTest(__test, __test.test_constructorWithReturnType);
8024 });
8025 _ut.test('test_constructorWithReturnType_var', () {
8026 final __test = new ErrorParserTest();
8027 runJUnitTest(__test, __test.test_constructorWithReturnType_var);
8028 });
7918 _ut.test('test_continueOutsideOfLoop_continueInDoStatement', () { 8029 _ut.test('test_continueOutsideOfLoop_continueInDoStatement', () {
7919 final __test = new ErrorParserTest(); 8030 final __test = new ErrorParserTest();
7920 runJUnitTest(__test, __test.test_continueOutsideOfLoop_continueInDoState ment); 8031 runJUnitTest(__test, __test.test_continueOutsideOfLoop_continueInDoState ment);
7921 }); 8032 });
7922 _ut.test('test_continueOutsideOfLoop_continueInForStatement', () { 8033 _ut.test('test_continueOutsideOfLoop_continueInForStatement', () {
7923 final __test = new ErrorParserTest(); 8034 final __test = new ErrorParserTest();
7924 runJUnitTest(__test, __test.test_continueOutsideOfLoop_continueInForStat ement); 8035 runJUnitTest(__test, __test.test_continueOutsideOfLoop_continueInForStat ement);
7925 }); 8036 });
7926 _ut.test('test_continueOutsideOfLoop_continueInIfStatement', () { 8037 _ut.test('test_continueOutsideOfLoop_continueInIfStatement', () {
7927 final __test = new ErrorParserTest(); 8038 final __test = new ErrorParserTest();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
8012 runJUnitTest(__test, __test.test_expectedExecutable_topLevel_afterType); 8123 runJUnitTest(__test, __test.test_expectedExecutable_topLevel_afterType);
8013 }); 8124 });
8014 _ut.test('test_expectedExecutable_topLevel_afterVoid', () { 8125 _ut.test('test_expectedExecutable_topLevel_afterVoid', () {
8015 final __test = new ErrorParserTest(); 8126 final __test = new ErrorParserTest();
8016 runJUnitTest(__test, __test.test_expectedExecutable_topLevel_afterVoid); 8127 runJUnitTest(__test, __test.test_expectedExecutable_topLevel_afterVoid);
8017 }); 8128 });
8018 _ut.test('test_expectedExecutable_topLevel_beforeType', () { 8129 _ut.test('test_expectedExecutable_topLevel_beforeType', () {
8019 final __test = new ErrorParserTest(); 8130 final __test = new ErrorParserTest();
8020 runJUnitTest(__test, __test.test_expectedExecutable_topLevel_beforeType) ; 8131 runJUnitTest(__test, __test.test_expectedExecutable_topLevel_beforeType) ;
8021 }); 8132 });
8133 _ut.test('test_expectedInterpolationIdentifier', () {
8134 final __test = new ErrorParserTest();
8135 runJUnitTest(__test, __test.test_expectedInterpolationIdentifier);
8136 });
8022 _ut.test('test_expectedStringLiteral', () { 8137 _ut.test('test_expectedStringLiteral', () {
8023 final __test = new ErrorParserTest(); 8138 final __test = new ErrorParserTest();
8024 runJUnitTest(__test, __test.test_expectedStringLiteral); 8139 runJUnitTest(__test, __test.test_expectedStringLiteral);
8025 }); 8140 });
8026 _ut.test('test_expectedToken_commaMissingInArgumentList', () { 8141 _ut.test('test_expectedToken_commaMissingInArgumentList', () {
8027 final __test = new ErrorParserTest(); 8142 final __test = new ErrorParserTest();
8028 runJUnitTest(__test, __test.test_expectedToken_commaMissingInArgumentLis t); 8143 runJUnitTest(__test, __test.test_expectedToken_commaMissingInArgumentLis t);
8029 }); 8144 });
8030 _ut.test('test_expectedToken_semicolonMissingAfterExpression', () { 8145 _ut.test('test_expectedToken_semicolonMissingAfterExpression', () {
8031 final __test = new ErrorParserTest(); 8146 final __test = new ErrorParserTest();
8032 runJUnitTest(__test, __test.test_expectedToken_semicolonMissingAfterExpr ession); 8147 runJUnitTest(__test, __test.test_expectedToken_semicolonMissingAfterExpr ession);
8033 }); 8148 });
8034 _ut.test('test_expectedToken_whileMissingInDoStatement', () { 8149 _ut.test('test_expectedToken_whileMissingInDoStatement', () {
8035 final __test = new ErrorParserTest(); 8150 final __test = new ErrorParserTest();
8036 runJUnitTest(__test, __test.test_expectedToken_whileMissingInDoStatement ); 8151 runJUnitTest(__test, __test.test_expectedToken_whileMissingInDoStatement );
8037 }); 8152 });
8153 _ut.test('test_expectedTwoMapTypeArguments_one', () {
8154 final __test = new ErrorParserTest();
8155 runJUnitTest(__test, __test.test_expectedTwoMapTypeArguments_one);
8156 });
8157 _ut.test('test_expectedTwoMapTypeArguments_three', () {
8158 final __test = new ErrorParserTest();
8159 runJUnitTest(__test, __test.test_expectedTwoMapTypeArguments_three);
8160 });
8161 _ut.test('test_expectedTypeName_is', () {
8162 final __test = new ErrorParserTest();
8163 runJUnitTest(__test, __test.test_expectedTypeName_is);
8164 });
8038 _ut.test('test_exportDirectiveAfterPartDirective', () { 8165 _ut.test('test_exportDirectiveAfterPartDirective', () {
8039 final __test = new ErrorParserTest(); 8166 final __test = new ErrorParserTest();
8040 runJUnitTest(__test, __test.test_exportDirectiveAfterPartDirective); 8167 runJUnitTest(__test, __test.test_exportDirectiveAfterPartDirective);
8041 }); 8168 });
8042 _ut.test('test_externalAfterConst', () { 8169 _ut.test('test_externalAfterConst', () {
8043 final __test = new ErrorParserTest(); 8170 final __test = new ErrorParserTest();
8044 runJUnitTest(__test, __test.test_externalAfterConst); 8171 runJUnitTest(__test, __test.test_externalAfterConst);
8045 }); 8172 });
8046 _ut.test('test_externalAfterFactory', () { 8173 _ut.test('test_externalAfterFactory', () {
8047 final __test = new ErrorParserTest(); 8174 final __test = new ErrorParserTest();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
8104 runJUnitTest(__test, __test.test_externalTypedef); 8231 runJUnitTest(__test, __test.test_externalTypedef);
8105 }); 8232 });
8106 _ut.test('test_factoryTopLevelDeclaration_class', () { 8233 _ut.test('test_factoryTopLevelDeclaration_class', () {
8107 final __test = new ErrorParserTest(); 8234 final __test = new ErrorParserTest();
8108 runJUnitTest(__test, __test.test_factoryTopLevelDeclaration_class); 8235 runJUnitTest(__test, __test.test_factoryTopLevelDeclaration_class);
8109 }); 8236 });
8110 _ut.test('test_factoryTopLevelDeclaration_typedef', () { 8237 _ut.test('test_factoryTopLevelDeclaration_typedef', () {
8111 final __test = new ErrorParserTest(); 8238 final __test = new ErrorParserTest();
8112 runJUnitTest(__test, __test.test_factoryTopLevelDeclaration_typedef); 8239 runJUnitTest(__test, __test.test_factoryTopLevelDeclaration_typedef);
8113 }); 8240 });
8241 _ut.test('test_factoryWithoutBody', () {
8242 final __test = new ErrorParserTest();
8243 runJUnitTest(__test, __test.test_factoryWithoutBody);
8244 });
8114 _ut.test('test_fieldInitializerOutsideConstructor', () { 8245 _ut.test('test_fieldInitializerOutsideConstructor', () {
8115 final __test = new ErrorParserTest(); 8246 final __test = new ErrorParserTest();
8116 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor); 8247 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor);
8117 }); 8248 });
8118 _ut.test('test_finalAndVar', () { 8249 _ut.test('test_finalAndVar', () {
8119 final __test = new ErrorParserTest(); 8250 final __test = new ErrorParserTest();
8120 runJUnitTest(__test, __test.test_finalAndVar); 8251 runJUnitTest(__test, __test.test_finalAndVar);
8121 }); 8252 });
8122 _ut.test('test_finalClass', () { 8253 _ut.test('test_finalClass', () {
8123 final __test = new ErrorParserTest(); 8254 final __test = new ErrorParserTest();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
8164 runJUnitTest(__test, __test.test_invalidCodePoint); 8295 runJUnitTest(__test, __test.test_invalidCodePoint);
8165 }); 8296 });
8166 _ut.test('test_invalidHexEscape_invalidDigit', () { 8297 _ut.test('test_invalidHexEscape_invalidDigit', () {
8167 final __test = new ErrorParserTest(); 8298 final __test = new ErrorParserTest();
8168 runJUnitTest(__test, __test.test_invalidHexEscape_invalidDigit); 8299 runJUnitTest(__test, __test.test_invalidHexEscape_invalidDigit);
8169 }); 8300 });
8170 _ut.test('test_invalidHexEscape_tooFewDigits', () { 8301 _ut.test('test_invalidHexEscape_tooFewDigits', () {
8171 final __test = new ErrorParserTest(); 8302 final __test = new ErrorParserTest();
8172 runJUnitTest(__test, __test.test_invalidHexEscape_tooFewDigits); 8303 runJUnitTest(__test, __test.test_invalidHexEscape_tooFewDigits);
8173 }); 8304 });
8305 _ut.test('test_invalidInterpolationIdentifier_startWithDigit', () {
8306 final __test = new ErrorParserTest();
8307 runJUnitTest(__test, __test.test_invalidInterpolationIdentifier_startWit hDigit);
8308 });
8174 _ut.test('test_invalidOperator', () { 8309 _ut.test('test_invalidOperator', () {
8175 final __test = new ErrorParserTest(); 8310 final __test = new ErrorParserTest();
8176 runJUnitTest(__test, __test.test_invalidOperator); 8311 runJUnitTest(__test, __test.test_invalidOperator);
8177 }); 8312 });
8178 _ut.test('test_invalidOperatorForSuper', () { 8313 _ut.test('test_invalidOperatorForSuper', () {
8179 final __test = new ErrorParserTest(); 8314 final __test = new ErrorParserTest();
8180 runJUnitTest(__test, __test.test_invalidOperatorForSuper); 8315 runJUnitTest(__test, __test.test_invalidOperatorForSuper);
8181 }); 8316 });
8182 _ut.test('test_invalidUnicodeEscape_incomplete_noDigits', () { 8317 _ut.test('test_invalidUnicodeEscape_incomplete_noDigits', () {
8183 final __test = new ErrorParserTest(); 8318 final __test = new ErrorParserTest();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
8232 runJUnitTest(__test, __test.test_missingAssignableSelector_superProperty AccessAssigned); 8367 runJUnitTest(__test, __test.test_missingAssignableSelector_superProperty AccessAssigned);
8233 }); 8368 });
8234 _ut.test('test_missingCatchOrFinally', () { 8369 _ut.test('test_missingCatchOrFinally', () {
8235 final __test = new ErrorParserTest(); 8370 final __test = new ErrorParserTest();
8236 runJUnitTest(__test, __test.test_missingCatchOrFinally); 8371 runJUnitTest(__test, __test.test_missingCatchOrFinally);
8237 }); 8372 });
8238 _ut.test('test_missingClassBody', () { 8373 _ut.test('test_missingClassBody', () {
8239 final __test = new ErrorParserTest(); 8374 final __test = new ErrorParserTest();
8240 runJUnitTest(__test, __test.test_missingClassBody); 8375 runJUnitTest(__test, __test.test_missingClassBody);
8241 }); 8376 });
8242 _ut.test('test_missingConstFinalVarOrType', () { 8377 _ut.test('test_missingConstFinalVarOrType_static', () {
8243 final __test = new ErrorParserTest(); 8378 final __test = new ErrorParserTest();
8244 runJUnitTest(__test, __test.test_missingConstFinalVarOrType); 8379 runJUnitTest(__test, __test.test_missingConstFinalVarOrType_static);
8380 });
8381 _ut.test('test_missingConstFinalVarOrType_topLevel', () {
8382 final __test = new ErrorParserTest();
8383 runJUnitTest(__test, __test.test_missingConstFinalVarOrType_topLevel);
8384 });
8385 _ut.test('test_missingExpressionInThrow_withCascade', () {
8386 final __test = new ErrorParserTest();
8387 runJUnitTest(__test, __test.test_missingExpressionInThrow_withCascade);
8388 });
8389 _ut.test('test_missingExpressionInThrow_withoutCascade', () {
8390 final __test = new ErrorParserTest();
8391 runJUnitTest(__test, __test.test_missingExpressionInThrow_withoutCascade );
8245 }); 8392 });
8246 _ut.test('test_missingFunctionBody_emptyNotAllowed', () { 8393 _ut.test('test_missingFunctionBody_emptyNotAllowed', () {
8247 final __test = new ErrorParserTest(); 8394 final __test = new ErrorParserTest();
8248 runJUnitTest(__test, __test.test_missingFunctionBody_emptyNotAllowed); 8395 runJUnitTest(__test, __test.test_missingFunctionBody_emptyNotAllowed);
8249 }); 8396 });
8250 _ut.test('test_missingFunctionBody_invalid', () { 8397 _ut.test('test_missingFunctionBody_invalid', () {
8251 final __test = new ErrorParserTest(); 8398 final __test = new ErrorParserTest();
8252 runJUnitTest(__test, __test.test_missingFunctionBody_invalid); 8399 runJUnitTest(__test, __test.test_missingFunctionBody_invalid);
8253 }); 8400 });
8254 _ut.test('test_missingFunctionParameters_local_void_block', () { 8401 _ut.test('test_missingFunctionParameters_local_void_block', () {
(...skipping 13 matching lines...) Expand all
8268 runJUnitTest(__test, __test.test_missingFunctionParameters_topLevel_nonV oid_expression); 8415 runJUnitTest(__test, __test.test_missingFunctionParameters_topLevel_nonV oid_expression);
8269 }); 8416 });
8270 _ut.test('test_missingFunctionParameters_topLevel_void_block', () { 8417 _ut.test('test_missingFunctionParameters_topLevel_void_block', () {
8271 final __test = new ErrorParserTest(); 8418 final __test = new ErrorParserTest();
8272 runJUnitTest(__test, __test.test_missingFunctionParameters_topLevel_void _block); 8419 runJUnitTest(__test, __test.test_missingFunctionParameters_topLevel_void _block);
8273 }); 8420 });
8274 _ut.test('test_missingFunctionParameters_topLevel_void_expression', () { 8421 _ut.test('test_missingFunctionParameters_topLevel_void_expression', () {
8275 final __test = new ErrorParserTest(); 8422 final __test = new ErrorParserTest();
8276 runJUnitTest(__test, __test.test_missingFunctionParameters_topLevel_void _expression); 8423 runJUnitTest(__test, __test.test_missingFunctionParameters_topLevel_void _expression);
8277 }); 8424 });
8425 _ut.test('test_missingIdentifier_afterOperator', () {
8426 final __test = new ErrorParserTest();
8427 runJUnitTest(__test, __test.test_missingIdentifier_afterOperator);
8428 });
8278 _ut.test('test_missingIdentifier_functionDeclaration_returnTypeWithoutName ', () { 8429 _ut.test('test_missingIdentifier_functionDeclaration_returnTypeWithoutName ', () {
8279 final __test = new ErrorParserTest(); 8430 final __test = new ErrorParserTest();
8280 runJUnitTest(__test, __test.test_missingIdentifier_functionDeclaration_r eturnTypeWithoutName); 8431 runJUnitTest(__test, __test.test_missingIdentifier_functionDeclaration_r eturnTypeWithoutName);
8281 }); 8432 });
8282 _ut.test('test_missingIdentifier_number', () { 8433 _ut.test('test_missingIdentifier_number', () {
8283 final __test = new ErrorParserTest(); 8434 final __test = new ErrorParserTest();
8284 runJUnitTest(__test, __test.test_missingIdentifier_number); 8435 runJUnitTest(__test, __test.test_missingIdentifier_number);
8285 }); 8436 });
8286 _ut.test('test_missingKeywordOperator', () { 8437 _ut.test('test_missingKeywordOperator', () {
8287 final __test = new ErrorParserTest(); 8438 final __test = new ErrorParserTest();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
8396 runJUnitTest(__test, __test.test_staticAfterFinal); 8547 runJUnitTest(__test, __test.test_staticAfterFinal);
8397 }); 8548 });
8398 _ut.test('test_staticAfterVar', () { 8549 _ut.test('test_staticAfterVar', () {
8399 final __test = new ErrorParserTest(); 8550 final __test = new ErrorParserTest();
8400 runJUnitTest(__test, __test.test_staticAfterVar); 8551 runJUnitTest(__test, __test.test_staticAfterVar);
8401 }); 8552 });
8402 _ut.test('test_staticConstructor', () { 8553 _ut.test('test_staticConstructor', () {
8403 final __test = new ErrorParserTest(); 8554 final __test = new ErrorParserTest();
8404 runJUnitTest(__test, __test.test_staticConstructor); 8555 runJUnitTest(__test, __test.test_staticConstructor);
8405 }); 8556 });
8557 _ut.test('test_staticGetterWithoutBody', () {
8558 final __test = new ErrorParserTest();
8559 runJUnitTest(__test, __test.test_staticGetterWithoutBody);
8560 });
8406 _ut.test('test_staticOperator_noReturnType', () { 8561 _ut.test('test_staticOperator_noReturnType', () {
8407 final __test = new ErrorParserTest(); 8562 final __test = new ErrorParserTest();
8408 runJUnitTest(__test, __test.test_staticOperator_noReturnType); 8563 runJUnitTest(__test, __test.test_staticOperator_noReturnType);
8409 }); 8564 });
8410 _ut.test('test_staticOperator_returnType', () { 8565 _ut.test('test_staticOperator_returnType', () {
8411 final __test = new ErrorParserTest(); 8566 final __test = new ErrorParserTest();
8412 runJUnitTest(__test, __test.test_staticOperator_returnType); 8567 runJUnitTest(__test, __test.test_staticOperator_returnType);
8413 }); 8568 });
8569 _ut.test('test_staticSetterWithoutBody', () {
8570 final __test = new ErrorParserTest();
8571 runJUnitTest(__test, __test.test_staticSetterWithoutBody);
8572 });
8414 _ut.test('test_staticTopLevelDeclaration_class', () { 8573 _ut.test('test_staticTopLevelDeclaration_class', () {
8415 final __test = new ErrorParserTest(); 8574 final __test = new ErrorParserTest();
8416 runJUnitTest(__test, __test.test_staticTopLevelDeclaration_class); 8575 runJUnitTest(__test, __test.test_staticTopLevelDeclaration_class);
8417 }); 8576 });
8418 _ut.test('test_staticTopLevelDeclaration_typedef', () { 8577 _ut.test('test_staticTopLevelDeclaration_typedef', () {
8419 final __test = new ErrorParserTest(); 8578 final __test = new ErrorParserTest();
8420 runJUnitTest(__test, __test.test_staticTopLevelDeclaration_typedef); 8579 runJUnitTest(__test, __test.test_staticTopLevelDeclaration_typedef);
8421 }); 8580 });
8422 _ut.test('test_staticTopLevelDeclaration_variable', () { 8581 _ut.test('test_staticTopLevelDeclaration_variable', () {
8423 final __test = new ErrorParserTest(); 8582 final __test = new ErrorParserTest();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
8464 runJUnitTest(__test, __test.test_unexpectedToken_semicolonBetweenClassMe mbers); 8623 runJUnitTest(__test, __test.test_unexpectedToken_semicolonBetweenClassMe mbers);
8465 }); 8624 });
8466 _ut.test('test_unexpectedToken_semicolonBetweenCompilationUnitMembers', () { 8625 _ut.test('test_unexpectedToken_semicolonBetweenCompilationUnitMembers', () {
8467 final __test = new ErrorParserTest(); 8626 final __test = new ErrorParserTest();
8468 runJUnitTest(__test, __test.test_unexpectedToken_semicolonBetweenCompila tionUnitMembers); 8627 runJUnitTest(__test, __test.test_unexpectedToken_semicolonBetweenCompila tionUnitMembers);
8469 }); 8628 });
8470 _ut.test('test_useOfUnaryPlusOperator', () { 8629 _ut.test('test_useOfUnaryPlusOperator', () {
8471 final __test = new ErrorParserTest(); 8630 final __test = new ErrorParserTest();
8472 runJUnitTest(__test, __test.test_useOfUnaryPlusOperator); 8631 runJUnitTest(__test, __test.test_useOfUnaryPlusOperator);
8473 }); 8632 });
8633 _ut.test('test_varAsTypeName_as', () {
8634 final __test = new ErrorParserTest();
8635 runJUnitTest(__test, __test.test_varAsTypeName_as);
8636 });
8474 _ut.test('test_varClass', () { 8637 _ut.test('test_varClass', () {
8475 final __test = new ErrorParserTest(); 8638 final __test = new ErrorParserTest();
8476 runJUnitTest(__test, __test.test_varClass); 8639 runJUnitTest(__test, __test.test_varClass);
8477 }); 8640 });
8478 _ut.test('test_varConstructor', () {
8479 final __test = new ErrorParserTest();
8480 runJUnitTest(__test, __test.test_varConstructor);
8481 });
8482 _ut.test('test_varReturnType', () { 8641 _ut.test('test_varReturnType', () {
8483 final __test = new ErrorParserTest(); 8642 final __test = new ErrorParserTest();
8484 runJUnitTest(__test, __test.test_varReturnType); 8643 runJUnitTest(__test, __test.test_varReturnType);
8485 }); 8644 });
8486 _ut.test('test_varTypedef', () { 8645 _ut.test('test_varTypedef', () {
8487 final __test = new ErrorParserTest(); 8646 final __test = new ErrorParserTest();
8488 runJUnitTest(__test, __test.test_varTypedef); 8647 runJUnitTest(__test, __test.test_varTypedef);
8489 }); 8648 });
8490 _ut.test('test_voidField_initializer', () { 8649 _ut.test('test_voidField_initializer', () {
8491 final __test = new ErrorParserTest(); 8650 final __test = new ErrorParserTest();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
8533 SimpleParserTest.dartSuite(); 8692 SimpleParserTest.dartSuite();
8534 } 8693 }
8535 Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> { 8694 Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> {
8536 'parseCompilationUnit_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseCompilationUnit(arg0)), 8695 'parseCompilationUnit_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseCompilationUnit(arg0)),
8537 'parseExpression_1': new MethodTrampoline(1, (Parser target, arg0) => target.p arseExpression(arg0)), 8696 'parseExpression_1': new MethodTrampoline(1, (Parser target, arg0) => target.p arseExpression(arg0)),
8538 'parseStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.pa rseStatement(arg0)), 8697 'parseStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.pa rseStatement(arg0)),
8539 'parseStatements_1': new MethodTrampoline(1, (Parser target, arg0) => target.p arseStatements(arg0)), 8698 'parseStatements_1': new MethodTrampoline(1, (Parser target, arg0) => target.p arseStatements(arg0)),
8540 'advance_0': new MethodTrampoline(0, (Parser target) => target.advance()), 8699 'advance_0': new MethodTrampoline(0, (Parser target) => target.advance()),
8541 'appendScalarValue_5': new MethodTrampoline(5, (Parser target, arg0, arg1, arg 2, arg3, arg4) => target.appendScalarValue(arg0, arg1, arg2, arg3, arg4)), 8700 'appendScalarValue_5': new MethodTrampoline(5, (Parser target, arg0, arg1, arg 2, arg3, arg4) => target.appendScalarValue(arg0, arg1, arg2, arg3, arg4)),
8542 'computeStringValue_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.computeStringValue(arg0)), 8701 'computeStringValue_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.computeStringValue(arg0)),
8702 'convertToFunctionDeclaration_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.convertToFunctionDeclaration(arg0)),
8703 'couldBeStartOfCompilationUnitMember_0': new MethodTrampoline(0, (Parser targe t) => target.couldBeStartOfCompilationUnitMember()),
8543 'createSyntheticIdentifier_0': new MethodTrampoline(0, (Parser target) => targ et.createSyntheticIdentifier()), 8704 'createSyntheticIdentifier_0': new MethodTrampoline(0, (Parser target) => targ et.createSyntheticIdentifier()),
8544 'createSyntheticStringLiteral_0': new MethodTrampoline(0, (Parser target) => t arget.createSyntheticStringLiteral()), 8705 'createSyntheticStringLiteral_0': new MethodTrampoline(0, (Parser target) => t arget.createSyntheticStringLiteral()),
8545 'createSyntheticToken_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.createSyntheticToken(arg0)), 8706 'createSyntheticToken_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.createSyntheticToken(arg0)),
8546 'ensureAssignable_1': new MethodTrampoline(1, (Parser target, arg0) => target. ensureAssignable(arg0)), 8707 'ensureAssignable_1': new MethodTrampoline(1, (Parser target, arg0) => target. ensureAssignable(arg0)),
8547 'expect_1': new MethodTrampoline(1, (Parser target, arg0) => target.expect(arg 0)), 8708 'expect_1': new MethodTrampoline(1, (Parser target, arg0) => target.expect(arg 0)),
8548 'findRange_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.f indRange(arg0, arg1)), 8709 'findRange_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.f indRange(arg0, arg1)),
8549 'getCodeBlockRanges_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.getCodeBlockRanges(arg0)), 8710 'getCodeBlockRanges_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.getCodeBlockRanges(arg0)),
8711 'getEndToken_1': new MethodTrampoline(1, (Parser target, arg0) => target.getEn dToken(arg0)),
8550 'hasReturnTypeInTypeAlias_0': new MethodTrampoline(0, (Parser target) => targe t.hasReturnTypeInTypeAlias()), 8712 'hasReturnTypeInTypeAlias_0': new MethodTrampoline(0, (Parser target) => targe t.hasReturnTypeInTypeAlias()),
8551 'isFunctionDeclaration_0': new MethodTrampoline(0, (Parser target) => target.i sFunctionDeclaration()), 8713 'isFunctionDeclaration_0': new MethodTrampoline(0, (Parser target) => target.i sFunctionDeclaration()),
8552 'isFunctionExpression_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.isFunctionExpression(arg0)), 8714 'isFunctionExpression_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.isFunctionExpression(arg0)),
8553 'isHexDigit_1': new MethodTrampoline(1, (Parser target, arg0) => target.isHexD igit(arg0)), 8715 'isHexDigit_1': new MethodTrampoline(1, (Parser target, arg0) => target.isHexD igit(arg0)),
8554 'isInitializedVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => target.isInitializedVariableDeclaration()), 8716 'isInitializedVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => target.isInitializedVariableDeclaration()),
8555 'isLinkText_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target. isLinkText(arg0, arg1)), 8717 'isLinkText_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target. isLinkText(arg0, arg1)),
8556 'isOperator_1': new MethodTrampoline(1, (Parser target, arg0) => target.isOper ator(arg0)), 8718 'isOperator_1': new MethodTrampoline(1, (Parser target, arg0) => target.isOper ator(arg0)),
8557 'isSwitchMember_0': new MethodTrampoline(0, (Parser target) => target.isSwitch Member()), 8719 'isSwitchMember_0': new MethodTrampoline(0, (Parser target) => target.isSwitch Member()),
8558 'lexicallyFirst_1': new MethodTrampoline(1, (Parser target, arg0) => target.le xicallyFirst(arg0)), 8720 'lexicallyFirst_1': new MethodTrampoline(1, (Parser target, arg0) => target.le xicallyFirst(arg0)),
8559 'matches_1': new MethodTrampoline(1, (Parser target, arg0) => target.matches(a rg0)), 8721 'matches_1': new MethodTrampoline(1, (Parser target, arg0) => target.matches(a rg0)),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
8599 'parseEqualityExpression_0': new MethodTrampoline(0, (Parser target) => target .parseEqualityExpression()), 8761 'parseEqualityExpression_0': new MethodTrampoline(0, (Parser target) => target .parseEqualityExpression()),
8600 'parseExportDirective_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseExportDirective(arg0)), 8762 'parseExportDirective_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseExportDirective(arg0)),
8601 'parseExpression_0': new MethodTrampoline(0, (Parser target) => target.parseEx pression2()), 8763 'parseExpression_0': new MethodTrampoline(0, (Parser target) => target.parseEx pression2()),
8602 'parseExpressionList_0': new MethodTrampoline(0, (Parser target) => target.par seExpressionList()), 8764 'parseExpressionList_0': new MethodTrampoline(0, (Parser target) => target.par seExpressionList()),
8603 'parseExpressionWithoutCascade_0': new MethodTrampoline(0, (Parser target) => target.parseExpressionWithoutCascade()), 8765 'parseExpressionWithoutCascade_0': new MethodTrampoline(0, (Parser target) => target.parseExpressionWithoutCascade()),
8604 'parseExtendsClause_0': new MethodTrampoline(0, (Parser target) => target.pars eExtendsClause()), 8766 'parseExtendsClause_0': new MethodTrampoline(0, (Parser target) => target.pars eExtendsClause()),
8605 'parseFinalConstVarOrType_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseFinalConstVarOrType(arg0)), 8767 'parseFinalConstVarOrType_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseFinalConstVarOrType(arg0)),
8606 'parseFormalParameter_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseFormalParameter(arg0)), 8768 'parseFormalParameter_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseFormalParameter(arg0)),
8607 'parseFormalParameterList_0': new MethodTrampoline(0, (Parser target) => targe t.parseFormalParameterList()), 8769 'parseFormalParameterList_0': new MethodTrampoline(0, (Parser target) => targe t.parseFormalParameterList()),
8608 'parseForStatement_0': new MethodTrampoline(0, (Parser target) => target.parse ForStatement()), 8770 'parseForStatement_0': new MethodTrampoline(0, (Parser target) => target.parse ForStatement()),
8609 'parseFunctionBody_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.parseFunctionBody(arg0, arg1)), 8771 'parseFunctionBody_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg 2) => target.parseFunctionBody(arg0, arg1, arg2)),
8610 'parseFunctionDeclaration_3': new MethodTrampoline(3, (Parser target, arg0, ar g1, arg2) => target.parseFunctionDeclaration(arg0, arg1, arg2)), 8772 'parseFunctionDeclaration_3': new MethodTrampoline(3, (Parser target, arg0, ar g1, arg2) => target.parseFunctionDeclaration(arg0, arg1, arg2)),
8611 'parseFunctionDeclarationStatement_0': new MethodTrampoline(0, (Parser target) => target.parseFunctionDeclarationStatement()), 8773 'parseFunctionDeclarationStatement_0': new MethodTrampoline(0, (Parser target) => target.parseFunctionDeclarationStatement()),
8612 'parseFunctionDeclarationStatement_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.parseFunctionDeclarationStatement2(arg0, arg1)), 8774 'parseFunctionDeclarationStatement_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.parseFunctionDeclarationStatement2(arg0, arg1)),
8613 'parseFunctionExpression_0': new MethodTrampoline(0, (Parser target) => target .parseFunctionExpression()), 8775 'parseFunctionExpression_0': new MethodTrampoline(0, (Parser target) => target .parseFunctionExpression()),
8614 'parseFunctionTypeAlias_2': new MethodTrampoline(2, (Parser target, arg0, arg1 ) => target.parseFunctionTypeAlias(arg0, arg1)), 8776 'parseFunctionTypeAlias_2': new MethodTrampoline(2, (Parser target, arg0, arg1 ) => target.parseFunctionTypeAlias(arg0, arg1)),
8615 'parseGetter_4': new MethodTrampoline(4, (Parser target, arg0, arg1, arg2, arg 3) => target.parseGetter(arg0, arg1, arg2, arg3)), 8777 'parseGetter_4': new MethodTrampoline(4, (Parser target, arg0, arg1, arg2, arg 3) => target.parseGetter(arg0, arg1, arg2, arg3)),
8616 'parseIdentifierList_0': new MethodTrampoline(0, (Parser target) => target.par seIdentifierList()), 8778 'parseIdentifierList_0': new MethodTrampoline(0, (Parser target) => target.par seIdentifierList()),
8617 'parseIfStatement_0': new MethodTrampoline(0, (Parser target) => target.parseI fStatement()), 8779 'parseIfStatement_0': new MethodTrampoline(0, (Parser target) => target.parseI fStatement()),
8618 'parseImplementsClause_0': new MethodTrampoline(0, (Parser target) => target.p arseImplementsClause()), 8780 'parseImplementsClause_0': new MethodTrampoline(0, (Parser target) => target.p arseImplementsClause()),
8619 'parseImportDirective_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseImportDirective(arg0)), 8781 'parseImportDirective_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseImportDirective(arg0)),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
8667 'parseVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => targe t.parseVariableDeclaration()), 8829 'parseVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => targe t.parseVariableDeclaration()),
8668 'parseVariableDeclarationList_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.parseVariableDeclarationList(arg0)), 8830 'parseVariableDeclarationList_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.parseVariableDeclarationList(arg0)),
8669 'parseVariableDeclarationList_3': new MethodTrampoline(3, (Parser target, arg0 , arg1, arg2) => target.parseVariableDeclarationList2(arg0, arg1, arg2)), 8831 'parseVariableDeclarationList_3': new MethodTrampoline(3, (Parser target, arg0 , arg1, arg2) => target.parseVariableDeclarationList2(arg0, arg1, arg2)),
8670 'parseVariableDeclarationStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseVariableDeclarationStatement(arg0)), 8832 'parseVariableDeclarationStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseVariableDeclarationStatement(arg0)),
8671 'parseVariableDeclarationStatement_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.parseVariableDeclarationStatement2(arg0, arg1, arg2 )), 8833 'parseVariableDeclarationStatement_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.parseVariableDeclarationStatement2(arg0, arg1, arg2 )),
8672 'parseWhileStatement_0': new MethodTrampoline(0, (Parser target) => target.par seWhileStatement()), 8834 'parseWhileStatement_0': new MethodTrampoline(0, (Parser target) => target.par seWhileStatement()),
8673 'parseWithClause_0': new MethodTrampoline(0, (Parser target) => target.parseWi thClause()), 8835 'parseWithClause_0': new MethodTrampoline(0, (Parser target) => target.parseWi thClause()),
8674 'peek_0': new MethodTrampoline(0, (Parser target) => target.peek()), 8836 'peek_0': new MethodTrampoline(0, (Parser target) => target.peek()),
8675 'peek_1': new MethodTrampoline(1, (Parser target, arg0) => target.peek2(arg0)) , 8837 'peek_1': new MethodTrampoline(1, (Parser target, arg0) => target.peek2(arg0)) ,
8676 'reportError_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.reportError(arg0, arg1, arg2)), 8838 'reportError_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.reportError(arg0, arg1, arg2)),
8677 'reportError_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target .reportError4(arg0, arg1)), 8839 'reportError_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target .reportError7(arg0, arg1)),
8678 'skipFinalConstVarOrType_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFinalConstVarOrType(arg0)), 8840 'skipFinalConstVarOrType_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFinalConstVarOrType(arg0)),
8679 'skipFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFormalParameterList(arg0)), 8841 'skipFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFormalParameterList(arg0)),
8680 'skipPastMatchingToken_1': new MethodTrampoline(1, (Parser target, arg0) => ta rget.skipPastMatchingToken(arg0)), 8842 'skipPastMatchingToken_1': new MethodTrampoline(1, (Parser target, arg0) => ta rget.skipPastMatchingToken(arg0)),
8681 'skipPrefixedIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => t arget.skipPrefixedIdentifier(arg0)), 8843 'skipPrefixedIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => t arget.skipPrefixedIdentifier(arg0)),
8682 'skipReturnType_1': new MethodTrampoline(1, (Parser target, arg0) => target.sk ipReturnType(arg0)), 8844 'skipReturnType_1': new MethodTrampoline(1, (Parser target, arg0) => target.sk ipReturnType(arg0)),
8683 'skipSimpleIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.skipSimpleIdentifier(arg0)), 8845 'skipSimpleIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.skipSimpleIdentifier(arg0)),
8684 'skipStringInterpolation_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipStringInterpolation(arg0)), 8846 'skipStringInterpolation_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipStringInterpolation(arg0)),
8685 'skipStringLiteral_1': new MethodTrampoline(1, (Parser target, arg0) => target .skipStringLiteral(arg0)), 8847 'skipStringLiteral_1': new MethodTrampoline(1, (Parser target, arg0) => target .skipStringLiteral(arg0)),
8686 'skipTypeArgumentList_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.skipTypeArgumentList(arg0)), 8848 'skipTypeArgumentList_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.skipTypeArgumentList(arg0)),
8687 'skipTypeName_1': new MethodTrampoline(1, (Parser target, arg0) => target.skip TypeName(arg0)), 8849 'skipTypeName_1': new MethodTrampoline(1, (Parser target, arg0) => target.skip TypeName(arg0)),
8688 'skipTypeParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => ta rget.skipTypeParameterList(arg0)), 8850 'skipTypeParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => ta rget.skipTypeParameterList(arg0)),
8689 'translateCharacter_3': new MethodTrampoline(3, (Parser target, arg0, arg1, ar g2) => target.translateCharacter(arg0, arg1, arg2)), 8851 'translateCharacter_3': new MethodTrampoline(3, (Parser target, arg0, arg1, ar g2) => target.translateCharacter(arg0, arg1, arg2)),
8690 'validateFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateFormalParameterList(arg0)), 8852 'validateFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateFormalParameterList(arg0)),
8691 'validateModifiersForClass_1': new MethodTrampoline(1, (Parser target, arg0) = > target.validateModifiersForClass(arg0)), 8853 'validateModifiersForClass_1': new MethodTrampoline(1, (Parser target, arg0) = > target.validateModifiersForClass(arg0)),
8692 'validateModifiersForConstructor_1': new MethodTrampoline(1, (Parser target, a rg0) => target.validateModifiersForConstructor(arg0)), 8854 'validateModifiersForConstructor_1': new MethodTrampoline(1, (Parser target, a rg0) => target.validateModifiersForConstructor(arg0)),
8693 'validateModifiersForField_1': new MethodTrampoline(1, (Parser target, arg0) = > target.validateModifiersForField(arg0)), 8855 'validateModifiersForField_1': new MethodTrampoline(1, (Parser target, arg0) = > target.validateModifiersForField(arg0)),
8694 'validateModifiersForGetterOrSetterOrMethod_1': new MethodTrampoline(1, (Parse r target, arg0) => target.validateModifiersForGetterOrSetterOrMethod(arg0)), 8856 'validateModifiersForGetterOrSetterOrMethod_1': new MethodTrampoline(1, (Parse r target, arg0) => target.validateModifiersForGetterOrSetterOrMethod(arg0)),
8695 'validateModifiersForOperator_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.validateModifiersForOperator(arg0)), 8857 'validateModifiersForOperator_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.validateModifiersForOperator(arg0)),
8696 'validateModifiersForTopLevelDeclaration_1': new MethodTrampoline(1, (Parser t arget, arg0) => target.validateModifiersForTopLevelDeclaration(arg0)), 8858 'validateModifiersForTopLevelDeclaration_1': new MethodTrampoline(1, (Parser t arget, arg0) => target.validateModifiersForTopLevelDeclaration(arg0)),
8697 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), 8859 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelFunction(arg0)),
8698 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), 8860 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelVariable(arg0)),
8699 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTypedef(arg0)),}; 8861 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTypedef(arg0)),};
8700 8862
8701 8863
8702 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj ects, Token tokenStream) { 8864 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj ects, Token tokenStream) {
8703 parser.currentToken = tokenStream; 8865 parser.currentToken = tokenStream;
8704 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length} ']; 8866 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length} '];
8705 return method.invoke(parser, objects); 8867 return method.invoke(parser, objects);
8706 } 8868 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698