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

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

Issue 18612009: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 library engine.parser_test; 3 library engine.parser_test;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'package:analyzer_experimental/src/generated/java_core.dart'; 5 import 'package:analyzer_experimental/src/generated/java_core.dart';
6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; 6 import 'package:analyzer_experimental/src/generated/java_engine.dart';
7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; 7 import 'package:analyzer_experimental/src/generated/java_junit.dart';
8 import 'package:analyzer_experimental/src/generated/source.dart'; 8 import 'package:analyzer_experimental/src/generated/source.dart';
9 import 'package:analyzer_experimental/src/generated/error.dart'; 9 import 'package:analyzer_experimental/src/generated/error.dart';
10 import 'package:analyzer_experimental/src/generated/scanner.dart'; 10 import 'package:analyzer_experimental/src/generated/scanner.dart';
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 JUnitTestCase.assertNotNull(section.argumentList); 510 JUnitTestCase.assertNotNull(section.argumentList);
511 EngineTestCase.assertSize(1, section.argumentList.arguments); 511 EngineTestCase.assertSize(1, section.argumentList.arguments);
512 } 512 }
513 void test_parseCascadeSection_pap() { 513 void test_parseCascadeSection_pap() {
514 PropertyAccess section = ParserTestCase.parse5("parseCascadeSection", "..a(b ).c", []); 514 PropertyAccess section = ParserTestCase.parse5("parseCascadeSection", "..a(b ).c", []);
515 JUnitTestCase.assertNotNull(section.target); 515 JUnitTestCase.assertNotNull(section.target);
516 JUnitTestCase.assertNotNull(section.operator); 516 JUnitTestCase.assertNotNull(section.operator);
517 JUnitTestCase.assertNotNull(section.propertyName); 517 JUnitTestCase.assertNotNull(section.propertyName);
518 } 518 }
519 void test_parseClassDeclaration_abstract() { 519 void test_parseClassDeclaration_abstract() {
520 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), TokenFactory.token(Keyword.ABSTRACT)], "cl ass A {}"); 520 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [
521 emptyCommentAndMetadata(),
522 TokenFactory.token(Keyword.ABSTRACT)], "class A {}");
521 JUnitTestCase.assertNull(declaration.documentationComment); 523 JUnitTestCase.assertNull(declaration.documentationComment);
522 JUnitTestCase.assertNotNull(declaration.abstractKeyword); 524 JUnitTestCase.assertNotNull(declaration.abstractKeyword);
523 JUnitTestCase.assertNull(declaration.extendsClause); 525 JUnitTestCase.assertNull(declaration.extendsClause);
524 JUnitTestCase.assertNull(declaration.implementsClause); 526 JUnitTestCase.assertNull(declaration.implementsClause);
525 JUnitTestCase.assertNotNull(declaration.classKeyword); 527 JUnitTestCase.assertNotNull(declaration.classKeyword);
526 JUnitTestCase.assertNotNull(declaration.leftBracket); 528 JUnitTestCase.assertNotNull(declaration.leftBracket);
527 JUnitTestCase.assertNotNull(declaration.name); 529 JUnitTestCase.assertNotNull(declaration.name);
528 EngineTestCase.assertSize(0, declaration.members); 530 EngineTestCase.assertSize(0, declaration.members);
529 JUnitTestCase.assertNotNull(declaration.rightBracket); 531 JUnitTestCase.assertNotNull(declaration.rightBracket);
530 JUnitTestCase.assertNull(declaration.typeParameters); 532 JUnitTestCase.assertNull(declaration.typeParameters);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 JUnitTestCase.assertNull(declaration.abstractKeyword); 604 JUnitTestCase.assertNull(declaration.abstractKeyword);
603 JUnitTestCase.assertNull(declaration.extendsClause); 605 JUnitTestCase.assertNull(declaration.extendsClause);
604 JUnitTestCase.assertNotNull(declaration.implementsClause); 606 JUnitTestCase.assertNotNull(declaration.implementsClause);
605 JUnitTestCase.assertNotNull(declaration.classKeyword); 607 JUnitTestCase.assertNotNull(declaration.classKeyword);
606 JUnitTestCase.assertNotNull(declaration.leftBracket); 608 JUnitTestCase.assertNotNull(declaration.leftBracket);
607 JUnitTestCase.assertNotNull(declaration.name); 609 JUnitTestCase.assertNotNull(declaration.name);
608 EngineTestCase.assertSize(0, declaration.members); 610 EngineTestCase.assertSize(0, declaration.members);
609 JUnitTestCase.assertNotNull(declaration.rightBracket); 611 JUnitTestCase.assertNotNull(declaration.rightBracket);
610 JUnitTestCase.assertNull(declaration.typeParameters); 612 JUnitTestCase.assertNull(declaration.typeParameters);
611 } 613 }
614 void test_parseClassDeclaration_native() {
615 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A native 'nativeValue' {}");
616 NativeClause nativeClause = declaration.nativeClause;
617 JUnitTestCase.assertNotNull(nativeClause);
618 JUnitTestCase.assertNotNull(nativeClause.keyword);
619 JUnitTestCase.assertEquals("nativeValue", nativeClause.name.stringValue);
620 JUnitTestCase.assertSame(nativeClause.keyword, nativeClause.beginToken);
621 JUnitTestCase.assertSame(nativeClause.name.endToken, nativeClause.endToken);
622 }
612 void test_parseClassDeclaration_nonEmpty() { 623 void test_parseClassDeclaration_nonEmpty() {
613 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {var f;}"); 624 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {var f;}");
614 JUnitTestCase.assertNull(declaration.documentationComment); 625 JUnitTestCase.assertNull(declaration.documentationComment);
615 JUnitTestCase.assertNull(declaration.abstractKeyword); 626 JUnitTestCase.assertNull(declaration.abstractKeyword);
616 JUnitTestCase.assertNull(declaration.extendsClause); 627 JUnitTestCase.assertNull(declaration.extendsClause);
617 JUnitTestCase.assertNull(declaration.implementsClause); 628 JUnitTestCase.assertNull(declaration.implementsClause);
618 JUnitTestCase.assertNotNull(declaration.classKeyword); 629 JUnitTestCase.assertNotNull(declaration.classKeyword);
619 JUnitTestCase.assertNotNull(declaration.leftBracket); 630 JUnitTestCase.assertNotNull(declaration.leftBracket);
620 JUnitTestCase.assertNotNull(declaration.name); 631 JUnitTestCase.assertNotNull(declaration.name);
621 EngineTestCase.assertSize(1, declaration.members); 632 EngineTestCase.assertSize(1, declaration.members);
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 CommentReference reference = references[0]; 1104 CommentReference reference = references[0];
1094 JUnitTestCase.assertNotNull(reference); 1105 JUnitTestCase.assertNotNull(reference);
1095 JUnitTestCase.assertNotNull(reference.identifier); 1106 JUnitTestCase.assertNotNull(reference.identifier);
1096 JUnitTestCase.assertEquals(12, reference.offset); 1107 JUnitTestCase.assertEquals(12, reference.offset);
1097 reference = references[1]; 1108 reference = references[1];
1098 JUnitTestCase.assertNotNull(reference); 1109 JUnitTestCase.assertNotNull(reference);
1099 JUnitTestCase.assertNotNull(reference.identifier); 1110 JUnitTestCase.assertNotNull(reference.identifier);
1100 JUnitTestCase.assertEquals(20, reference.offset); 1111 JUnitTestCase.assertEquals(20, reference.offset);
1101 } 1112 }
1102 void test_parseCommentReferences_singleLine() { 1113 void test_parseCommentReferences_singleLine() {
1103 List<Token> tokens = <Token> [new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// xxx [a] yyy [b] zzz", 3), new StringToken(TokenType.SINGLE_LINE_COMMENT, " /// x [c]", 28)]; 1114 List<Token> tokens = <Token> [
1115 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// xxx [a] yyy [b] zzz" , 3),
1116 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)];
1104 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 1117 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
1105 EngineTestCase.assertSize(3, references); 1118 EngineTestCase.assertSize(3, references);
1106 CommentReference reference = references[0]; 1119 CommentReference reference = references[0];
1107 JUnitTestCase.assertNotNull(reference); 1120 JUnitTestCase.assertNotNull(reference);
1108 JUnitTestCase.assertNotNull(reference.identifier); 1121 JUnitTestCase.assertNotNull(reference.identifier);
1109 JUnitTestCase.assertEquals(12, reference.offset); 1122 JUnitTestCase.assertEquals(12, reference.offset);
1110 reference = references[1]; 1123 reference = references[1];
1111 JUnitTestCase.assertNotNull(reference); 1124 JUnitTestCase.assertNotNull(reference);
1112 JUnitTestCase.assertNotNull(reference.identifier); 1125 JUnitTestCase.assertNotNull(reference.identifier);
1113 JUnitTestCase.assertEquals(20, reference.offset); 1126 JUnitTestCase.assertEquals(20, reference.offset);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 void test_parseCompilationUnitMember_typedef_function() { 1375 void test_parseCompilationUnitMember_typedef_function() {
1363 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMemb er", <Object> [emptyCommentAndMetadata()], "typedef F();"); 1376 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMemb er", <Object> [emptyCommentAndMetadata()], "typedef F();");
1364 JUnitTestCase.assertEquals("F", typeAlias.name.name); 1377 JUnitTestCase.assertEquals("F", typeAlias.name.name);
1365 EngineTestCase.assertSize(0, typeAlias.parameters.parameters); 1378 EngineTestCase.assertSize(0, typeAlias.parameters.parameters);
1366 } 1379 }
1367 void test_parseCompilationUnitMember_variable() { 1380 void test_parseCompilationUnitMember_variable() {
1368 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "var x = 0;"); 1381 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "var x = 0;");
1369 JUnitTestCase.assertNotNull(declaration.semicolon); 1382 JUnitTestCase.assertNotNull(declaration.semicolon);
1370 JUnitTestCase.assertNotNull(declaration.variables); 1383 JUnitTestCase.assertNotNull(declaration.variables);
1371 } 1384 }
1385 void test_parseCompilationUnitMember_variableGet() {
1386 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String get = null;");
1387 JUnitTestCase.assertNotNull(declaration.semicolon);
1388 JUnitTestCase.assertNotNull(declaration.variables);
1389 }
1390 void test_parseCompilationUnitMember_variableSet() {
1391 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String set = null;");
1392 JUnitTestCase.assertNotNull(declaration.semicolon);
1393 JUnitTestCase.assertNotNull(declaration.variables);
1394 }
1372 void test_parseConditionalExpression() { 1395 void test_parseConditionalExpression() {
1373 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y : z", []); 1396 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y : z", []);
1374 JUnitTestCase.assertNotNull(expression.condition); 1397 JUnitTestCase.assertNotNull(expression.condition);
1375 JUnitTestCase.assertNotNull(expression.question); 1398 JUnitTestCase.assertNotNull(expression.question);
1376 JUnitTestCase.assertNotNull(expression.thenExpression); 1399 JUnitTestCase.assertNotNull(expression.thenExpression);
1377 JUnitTestCase.assertNotNull(expression.colon); 1400 JUnitTestCase.assertNotNull(expression.colon);
1378 JUnitTestCase.assertNotNull(expression.elseExpression); 1401 JUnitTestCase.assertNotNull(expression.elseExpression);
1379 } 1402 }
1380 void test_parseConstExpression_instanceCreation() { 1403 void test_parseConstExpression_instanceCreation() {
1381 InstanceCreationExpression expression = ParserTestCase.parse5("parseConstExp ression", "const A()", []); 1404 InstanceCreationExpression expression = ParserTestCase.parse5("parseConstExp ression", "const A()", []);
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 JUnitTestCase.assertNotNull(method.name); 2185 JUnitTestCase.assertNotNull(method.name);
2163 JUnitTestCase.assertNull(method.operatorKeyword); 2186 JUnitTestCase.assertNull(method.operatorKeyword);
2164 JUnitTestCase.assertNull(method.parameters); 2187 JUnitTestCase.assertNull(method.parameters);
2165 JUnitTestCase.assertNotNull(method.propertyKeyword); 2188 JUnitTestCase.assertNotNull(method.propertyKeyword);
2166 JUnitTestCase.assertEquals(returnType, method.returnType); 2189 JUnitTestCase.assertEquals(returnType, method.returnType);
2167 } 2190 }
2168 void test_parseGetter_static() { 2191 void test_parseGetter_static() {
2169 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2192 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2170 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 2193 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
2171 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 2194 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2172 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com mentAndMetadata(comment, []), null, staticKeyword, returnType], "get a => 42;"); 2195 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [
2196 commentAndMetadata(comment, []),
2197 null,
2198 staticKeyword,
2199 returnType], "get a => 42;");
2173 JUnitTestCase.assertNotNull(method.body); 2200 JUnitTestCase.assertNotNull(method.body);
2174 JUnitTestCase.assertEquals(comment, method.documentationComment); 2201 JUnitTestCase.assertEquals(comment, method.documentationComment);
2175 JUnitTestCase.assertNull(method.externalKeyword); 2202 JUnitTestCase.assertNull(method.externalKeyword);
2176 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); 2203 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword);
2177 JUnitTestCase.assertNotNull(method.name); 2204 JUnitTestCase.assertNotNull(method.name);
2178 JUnitTestCase.assertNull(method.operatorKeyword); 2205 JUnitTestCase.assertNull(method.operatorKeyword);
2179 JUnitTestCase.assertNull(method.parameters); 2206 JUnitTestCase.assertNull(method.parameters);
2180 JUnitTestCase.assertNotNull(method.propertyKeyword); 2207 JUnitTestCase.assertNotNull(method.propertyKeyword);
2181 JUnitTestCase.assertEquals(returnType, method.returnType); 2208 JUnitTestCase.assertEquals(returnType, method.returnType);
2182 } 2209 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 JUnitTestCase.assertNotNull(directive.uri); 2316 JUnitTestCase.assertNotNull(directive.uri);
2290 JUnitTestCase.assertNull(directive.asToken); 2317 JUnitTestCase.assertNull(directive.asToken);
2291 JUnitTestCase.assertNull(directive.prefix); 2318 JUnitTestCase.assertNull(directive.prefix);
2292 EngineTestCase.assertSize(1, directive.combinators); 2319 EngineTestCase.assertSize(1, directive.combinators);
2293 JUnitTestCase.assertNotNull(directive.semicolon); 2320 JUnitTestCase.assertNotNull(directive.semicolon);
2294 } 2321 }
2295 void test_parseInitializedIdentifierList_type() { 2322 void test_parseInitializedIdentifierList_type() {
2296 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2323 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2297 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 2324 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
2298 TypeName type = new TypeName.full(new SimpleIdentifier.full(null), null); 2325 TypeName type = new TypeName.full(new SimpleIdentifier.full(null), null);
2299 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [commentAndMetadata(comment, []), staticKeyword, null, type], "a = 1, b, c = 3;"); 2326 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [
2327 commentAndMetadata(comment, []),
2328 staticKeyword,
2329 null,
2330 type], "a = 1, b, c = 3;");
2300 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 2331 JUnitTestCase.assertEquals(comment, declaration.documentationComment);
2301 VariableDeclarationList fields = declaration.fields; 2332 VariableDeclarationList fields = declaration.fields;
2302 JUnitTestCase.assertNotNull(fields); 2333 JUnitTestCase.assertNotNull(fields);
2303 JUnitTestCase.assertNull(fields.keyword); 2334 JUnitTestCase.assertNull(fields.keyword);
2304 JUnitTestCase.assertEquals(type, fields.type); 2335 JUnitTestCase.assertEquals(type, fields.type);
2305 EngineTestCase.assertSize(3, fields.variables); 2336 EngineTestCase.assertSize(3, fields.variables);
2306 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword); 2337 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword);
2307 JUnitTestCase.assertNotNull(declaration.semicolon); 2338 JUnitTestCase.assertNotNull(declaration.semicolon);
2308 } 2339 }
2309 void test_parseInitializedIdentifierList_var() { 2340 void test_parseInitializedIdentifierList_var() {
2310 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2341 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2311 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 2342 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
2312 Token varKeyword = TokenFactory.token(Keyword.VAR); 2343 Token varKeyword = TokenFactory.token(Keyword.VAR);
2313 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [commentAndMetadata(comment, []), staticKeyword, varKeyword, null], "a = 1, b, c = 3;"); 2344 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [
2345 commentAndMetadata(comment, []),
2346 staticKeyword,
2347 varKeyword,
2348 null], "a = 1, b, c = 3;");
2314 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 2349 JUnitTestCase.assertEquals(comment, declaration.documentationComment);
2315 VariableDeclarationList fields = declaration.fields; 2350 VariableDeclarationList fields = declaration.fields;
2316 JUnitTestCase.assertNotNull(fields); 2351 JUnitTestCase.assertNotNull(fields);
2317 JUnitTestCase.assertEquals(varKeyword, fields.keyword); 2352 JUnitTestCase.assertEquals(varKeyword, fields.keyword);
2318 JUnitTestCase.assertNull(fields.type); 2353 JUnitTestCase.assertNull(fields.type);
2319 EngineTestCase.assertSize(3, fields.variables); 2354 EngineTestCase.assertSize(3, fields.variables);
2320 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword); 2355 JUnitTestCase.assertEquals(staticKeyword, declaration.keyword);
2321 JUnitTestCase.assertNotNull(declaration.semicolon); 2356 JUnitTestCase.assertNotNull(declaration.semicolon);
2322 } 2357 }
2323 void test_parseInstanceCreationExpression_qualifiedType() { 2358 void test_parseInstanceCreationExpression_qualifiedType() {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 } 2492 }
2458 void test_parseLogicalOrExpression() { 2493 void test_parseLogicalOrExpression() {
2459 BinaryExpression expression = ParserTestCase.parse5("parseLogicalOrExpressio n", "x || y", []); 2494 BinaryExpression expression = ParserTestCase.parse5("parseLogicalOrExpressio n", "x || y", []);
2460 JUnitTestCase.assertNotNull(expression.leftOperand); 2495 JUnitTestCase.assertNotNull(expression.leftOperand);
2461 JUnitTestCase.assertNotNull(expression.operator); 2496 JUnitTestCase.assertNotNull(expression.operator);
2462 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type); 2497 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type);
2463 JUnitTestCase.assertNotNull(expression.rightOperand); 2498 JUnitTestCase.assertNotNull(expression.rightOperand);
2464 } 2499 }
2465 void test_parseMapLiteral_empty() { 2500 void test_parseMapLiteral_empty() {
2466 Token token = TokenFactory.token(Keyword.CONST); 2501 Token token = TokenFactory.token(Keyword.CONST);
2467 TypeArgumentList typeArguments = ASTFactory.typeArgumentList([ASTFactory.typ eName4("String", []), ASTFactory.typeName4("int", [])]); 2502 TypeArgumentList typeArguments = ASTFactory.typeArgumentList([
2503 ASTFactory.typeName4("String", []),
2504 ASTFactory.typeName4("int", [])]);
2468 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token , typeArguments], "{}"); 2505 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token , typeArguments], "{}");
2469 JUnitTestCase.assertEquals(token, literal.modifier); 2506 JUnitTestCase.assertEquals(token, literal.modifier);
2470 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); 2507 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments);
2471 JUnitTestCase.assertNotNull(literal.leftBracket); 2508 JUnitTestCase.assertNotNull(literal.leftBracket);
2472 EngineTestCase.assertSize(0, literal.entries); 2509 EngineTestCase.assertSize(0, literal.entries);
2473 JUnitTestCase.assertNotNull(literal.rightBracket); 2510 JUnitTestCase.assertNotNull(literal.rightBracket);
2474 } 2511 }
2475 void test_parseMapLiteral_multiple() { 2512 void test_parseMapLiteral_multiple() {
2476 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}"); 2513 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}");
2477 JUnitTestCase.assertNotNull(literal.leftBracket); 2514 JUnitTestCase.assertNotNull(literal.leftBracket);
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 JUnitTestCase.assertNotNull(method.name); 3039 JUnitTestCase.assertNotNull(method.name);
3003 JUnitTestCase.assertNull(method.operatorKeyword); 3040 JUnitTestCase.assertNull(method.operatorKeyword);
3004 JUnitTestCase.assertNotNull(method.parameters); 3041 JUnitTestCase.assertNotNull(method.parameters);
3005 JUnitTestCase.assertNotNull(method.propertyKeyword); 3042 JUnitTestCase.assertNotNull(method.propertyKeyword);
3006 JUnitTestCase.assertEquals(returnType, method.returnType); 3043 JUnitTestCase.assertEquals(returnType, method.returnType);
3007 } 3044 }
3008 void test_parseSetter_static() { 3045 void test_parseSetter_static() {
3009 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 3046 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
3010 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 3047 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
3011 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 3048 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
3012 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com mentAndMetadata(comment, []), null, staticKeyword, returnType], "set a(var x) {} "); 3049 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [
3050 commentAndMetadata(comment, []),
3051 null,
3052 staticKeyword,
3053 returnType], "set a(var x) {}");
3013 JUnitTestCase.assertNotNull(method.body); 3054 JUnitTestCase.assertNotNull(method.body);
3014 JUnitTestCase.assertEquals(comment, method.documentationComment); 3055 JUnitTestCase.assertEquals(comment, method.documentationComment);
3015 JUnitTestCase.assertNull(method.externalKeyword); 3056 JUnitTestCase.assertNull(method.externalKeyword);
3016 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); 3057 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword);
3017 JUnitTestCase.assertNotNull(method.name); 3058 JUnitTestCase.assertNotNull(method.name);
3018 JUnitTestCase.assertNull(method.operatorKeyword); 3059 JUnitTestCase.assertNull(method.operatorKeyword);
3019 JUnitTestCase.assertNotNull(method.parameters); 3060 JUnitTestCase.assertNotNull(method.parameters);
3020 JUnitTestCase.assertNotNull(method.propertyKeyword); 3061 JUnitTestCase.assertNotNull(method.propertyKeyword);
3021 JUnitTestCase.assertEquals(returnType, method.returnType); 3062 JUnitTestCase.assertEquals(returnType, method.returnType);
3022 } 3063 }
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
4262 runJUnitTest(__test, __test.test_parseClassDeclaration_extendsAndWith); 4303 runJUnitTest(__test, __test.test_parseClassDeclaration_extendsAndWith);
4263 }); 4304 });
4264 _ut.test('test_parseClassDeclaration_extendsAndWithAndImplements', () { 4305 _ut.test('test_parseClassDeclaration_extendsAndWithAndImplements', () {
4265 final __test = new SimpleParserTest(); 4306 final __test = new SimpleParserTest();
4266 runJUnitTest(__test, __test.test_parseClassDeclaration_extendsAndWithAnd Implements); 4307 runJUnitTest(__test, __test.test_parseClassDeclaration_extendsAndWithAnd Implements);
4267 }); 4308 });
4268 _ut.test('test_parseClassDeclaration_implements', () { 4309 _ut.test('test_parseClassDeclaration_implements', () {
4269 final __test = new SimpleParserTest(); 4310 final __test = new SimpleParserTest();
4270 runJUnitTest(__test, __test.test_parseClassDeclaration_implements); 4311 runJUnitTest(__test, __test.test_parseClassDeclaration_implements);
4271 }); 4312 });
4313 _ut.test('test_parseClassDeclaration_native', () {
4314 final __test = new SimpleParserTest();
4315 runJUnitTest(__test, __test.test_parseClassDeclaration_native);
4316 });
4272 _ut.test('test_parseClassDeclaration_nonEmpty', () { 4317 _ut.test('test_parseClassDeclaration_nonEmpty', () {
4273 final __test = new SimpleParserTest(); 4318 final __test = new SimpleParserTest();
4274 runJUnitTest(__test, __test.test_parseClassDeclaration_nonEmpty); 4319 runJUnitTest(__test, __test.test_parseClassDeclaration_nonEmpty);
4275 }); 4320 });
4276 _ut.test('test_parseClassDeclaration_typeParameters', () { 4321 _ut.test('test_parseClassDeclaration_typeParameters', () {
4277 final __test = new SimpleParserTest(); 4322 final __test = new SimpleParserTest();
4278 runJUnitTest(__test, __test.test_parseClassDeclaration_typeParameters); 4323 runJUnitTest(__test, __test.test_parseClassDeclaration_typeParameters);
4279 }); 4324 });
4280 _ut.test('test_parseClassMember_constructor_withInitializers', () { 4325 _ut.test('test_parseClassMember_constructor_withInitializers', () {
4281 final __test = new SimpleParserTest(); 4326 final __test = new SimpleParserTest();
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
4570 runJUnitTest(__test, __test.test_parseCompilationUnitMember_typedef_clas s_noImplements); 4615 runJUnitTest(__test, __test.test_parseCompilationUnitMember_typedef_clas s_noImplements);
4571 }); 4616 });
4572 _ut.test('test_parseCompilationUnitMember_typedef_function', () { 4617 _ut.test('test_parseCompilationUnitMember_typedef_function', () {
4573 final __test = new SimpleParserTest(); 4618 final __test = new SimpleParserTest();
4574 runJUnitTest(__test, __test.test_parseCompilationUnitMember_typedef_func tion); 4619 runJUnitTest(__test, __test.test_parseCompilationUnitMember_typedef_func tion);
4575 }); 4620 });
4576 _ut.test('test_parseCompilationUnitMember_variable', () { 4621 _ut.test('test_parseCompilationUnitMember_variable', () {
4577 final __test = new SimpleParserTest(); 4622 final __test = new SimpleParserTest();
4578 runJUnitTest(__test, __test.test_parseCompilationUnitMember_variable); 4623 runJUnitTest(__test, __test.test_parseCompilationUnitMember_variable);
4579 }); 4624 });
4625 _ut.test('test_parseCompilationUnitMember_variableGet', () {
4626 final __test = new SimpleParserTest();
4627 runJUnitTest(__test, __test.test_parseCompilationUnitMember_variableGet) ;
4628 });
4629 _ut.test('test_parseCompilationUnitMember_variableSet', () {
4630 final __test = new SimpleParserTest();
4631 runJUnitTest(__test, __test.test_parseCompilationUnitMember_variableSet) ;
4632 });
4580 _ut.test('test_parseCompilationUnit_abstractAsPrefix_parameterized', () { 4633 _ut.test('test_parseCompilationUnit_abstractAsPrefix_parameterized', () {
4581 final __test = new SimpleParserTest(); 4634 final __test = new SimpleParserTest();
4582 runJUnitTest(__test, __test.test_parseCompilationUnit_abstractAsPrefix_p arameterized); 4635 runJUnitTest(__test, __test.test_parseCompilationUnit_abstractAsPrefix_p arameterized);
4583 }); 4636 });
4584 _ut.test('test_parseCompilationUnit_directives_multiple', () { 4637 _ut.test('test_parseCompilationUnit_directives_multiple', () {
4585 final __test = new SimpleParserTest(); 4638 final __test = new SimpleParserTest();
4586 runJUnitTest(__test, __test.test_parseCompilationUnit_directives_multipl e); 4639 runJUnitTest(__test, __test.test_parseCompilationUnit_directives_multipl e);
4587 }); 4640 });
4588 _ut.test('test_parseCompilationUnit_directives_single', () { 4641 _ut.test('test_parseCompilationUnit_directives_single', () {
4589 final __test = new SimpleParserTest(); 4642 final __test = new SimpleParserTest();
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
6046 IndexExpression index = lhs as IndexExpression; 6099 IndexExpression index = lhs as IndexExpression;
6047 JUnitTestCase.assertTrue(index.isCascaded); 6100 JUnitTestCase.assertTrue(index.isCascaded);
6048 JUnitTestCase.assertSame(target, index.realTarget); 6101 JUnitTestCase.assertSame(target, index.realTarget);
6049 } 6102 }
6050 } 6103 }
6051 void test_conditionalExpression_precedence_logicalOrExpression() { 6104 void test_conditionalExpression_precedence_logicalOrExpression() {
6052 ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z", []); 6105 ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z", []);
6053 EngineTestCase.assertInstanceOf(BinaryExpression, expression.condition); 6106 EngineTestCase.assertInstanceOf(BinaryExpression, expression.condition);
6054 } 6107 }
6055 void test_constructor_initializer_withParenthesizedExpression() { 6108 void test_constructor_initializer_withParenthesizedExpression() {
6056 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr eateSource(["class C {", " C() :", " this.a = (b == null ? c : d) {", " }", "}"]), []); 6109 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr eateSource([
6110 "class C {",
6111 " C() :",
6112 " this.a = (b == null ? c : d) {",
6113 " }",
6114 "}"]), []);
6057 NodeList<CompilationUnitMember> declarations = unit.declarations; 6115 NodeList<CompilationUnitMember> declarations = unit.declarations;
6058 EngineTestCase.assertSize(1, declarations); 6116 EngineTestCase.assertSize(1, declarations);
6059 } 6117 }
6060 void test_equalityExpression_normal() { 6118 void test_equalityExpression_normal() {
6061 BinaryExpression expression = ParserTestCase.parseExpression("x == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 6119 BinaryExpression expression = ParserTestCase.parseExpression("x == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
6062 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6120 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6063 } 6121 }
6064 void test_equalityExpression_precedence_relational_left() { 6122 void test_equalityExpression_precedence_relational_left() {
6065 BinaryExpression expression = ParserTestCase.parseExpression("x is y == z", []); 6123 BinaryExpression expression = ParserTestCase.parseExpression("x is y == z", []);
6066 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand); 6124 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand);
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
6645 _ut.group('ParserTestCase', () { 6703 _ut.group('ParserTestCase', () {
6646 }); 6704 });
6647 } 6705 }
6648 } 6706 }
6649 /** 6707 /**
6650 * The class `RecoveryParserTest` defines parser tests that test the parsing of invalid code 6708 * The class `RecoveryParserTest` defines parser tests that test the parsing of invalid code
6651 * sequences to ensure that the correct recovery steps are taken in the parser. 6709 * sequences to ensure that the correct recovery steps are taken in the parser.
6652 */ 6710 */
6653 class RecoveryParserTest extends ParserTestCase { 6711 class RecoveryParserTest extends ParserTestCase {
6654 void fail_incomplete_returnType() { 6712 void fail_incomplete_returnType() {
6655 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;", "}"]), []); 6713 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource([
6714 "Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {",
6715 " if (map == null) return null;",
6716 " Map<Symbol, dynamic> result = new Map<Symbol, dynamic>();",
6717 " map.forEach((name, value) {",
6718 " result[new Symbol(name)] = value;",
6719 " });",
6720 " return result;",
6721 "}"]), []);
6656 } 6722 }
6657 void test_additiveExpression_missing_LHS() { 6723 void test_additiveExpression_missing_LHS() {
6658 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE rrorCode.MISSING_IDENTIFIER]); 6724 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6659 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6725 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6660 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6726 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6661 } 6727 }
6662 void test_additiveExpression_missing_LHS_RHS() { 6728 void test_additiveExpression_missing_LHS_RHS() {
6663 BinaryExpression expression = ParserTestCase.parseExpression("+", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6729 BinaryExpression expression = ParserTestCase.parseExpression("+", [
6730 ParserErrorCode.MISSING_IDENTIFIER,
6731 ParserErrorCode.MISSING_IDENTIFIER]);
6664 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6732 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6665 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6733 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6666 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6734 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6667 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6735 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6668 } 6736 }
6669 void test_additiveExpression_missing_RHS() { 6737 void test_additiveExpression_missing_RHS() {
6670 BinaryExpression expression = ParserTestCase.parseExpression("x +", [ParserE rrorCode.MISSING_IDENTIFIER]); 6738 BinaryExpression expression = ParserTestCase.parseExpression("x +", [ParserE rrorCode.MISSING_IDENTIFIER]);
6671 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6739 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6672 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6740 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6673 } 6741 }
6674 void test_additiveExpression_missing_RHS_super() { 6742 void test_additiveExpression_missing_RHS_super() {
6675 BinaryExpression expression = ParserTestCase.parseExpression("super +", [Par serErrorCode.MISSING_IDENTIFIER]); 6743 BinaryExpression expression = ParserTestCase.parseExpression("super +", [Par serErrorCode.MISSING_IDENTIFIER]);
6676 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6744 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6677 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6745 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6678 } 6746 }
6679 void test_additiveExpression_precedence_multiplicative_left() { 6747 void test_additiveExpression_precedence_multiplicative_left() {
6680 BinaryExpression expression = ParserTestCase.parseExpression("* +", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]); 6748 BinaryExpression expression = ParserTestCase.parseExpression("* +", [
6749 ParserErrorCode.MISSING_IDENTIFIER,
6750 ParserErrorCode.MISSING_IDENTIFIER,
6751 ParserErrorCode.MISSING_IDENTIFIER]);
6681 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6752 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6682 } 6753 }
6683 void test_additiveExpression_precedence_multiplicative_right() { 6754 void test_additiveExpression_precedence_multiplicative_right() {
6684 BinaryExpression expression = ParserTestCase.parseExpression("+ *", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]); 6755 BinaryExpression expression = ParserTestCase.parseExpression("+ *", [
6756 ParserErrorCode.MISSING_IDENTIFIER,
6757 ParserErrorCode.MISSING_IDENTIFIER,
6758 ParserErrorCode.MISSING_IDENTIFIER]);
6685 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6759 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6686 } 6760 }
6687 void test_additiveExpression_super() { 6761 void test_additiveExpression_super() {
6688 BinaryExpression expression = ParserTestCase.parseExpression("super + +", [P arserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6762 BinaryExpression expression = ParserTestCase.parseExpression("super + +", [
6763 ParserErrorCode.MISSING_IDENTIFIER,
6764 ParserErrorCode.MISSING_IDENTIFIER]);
6689 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6765 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6690 } 6766 }
6691 void test_assignmentExpression_missing_compound1() { 6767 void test_assignmentExpression_missing_compound1() {
6692 AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]); 6768 AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
6693 Expression syntheticExpression = expression.leftHandSide; 6769 Expression syntheticExpression = expression.leftHandSide;
6694 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 6770 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
6695 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 6771 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic);
6696 } 6772 }
6697 void test_assignmentExpression_missing_compound2() { 6773 void test_assignmentExpression_missing_compound2() {
6698 AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]); 6774 AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
(...skipping 16 matching lines...) Expand all
6715 AssignmentExpression expression = ParserTestCase.parseExpression("x =", [Par serErrorCode.MISSING_IDENTIFIER]); 6791 AssignmentExpression expression = ParserTestCase.parseExpression("x =", [Par serErrorCode.MISSING_IDENTIFIER]);
6716 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide); 6792 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide);
6717 JUnitTestCase.assertTrue(expression.rightHandSide.isSynthetic); 6793 JUnitTestCase.assertTrue(expression.rightHandSide.isSynthetic);
6718 } 6794 }
6719 void test_bitwiseAndExpression_missing_LHS() { 6795 void test_bitwiseAndExpression_missing_LHS() {
6720 BinaryExpression expression = ParserTestCase.parseExpression("& y", [ParserE rrorCode.MISSING_IDENTIFIER]); 6796 BinaryExpression expression = ParserTestCase.parseExpression("& y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6721 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6797 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6722 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6798 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6723 } 6799 }
6724 void test_bitwiseAndExpression_missing_LHS_RHS() { 6800 void test_bitwiseAndExpression_missing_LHS_RHS() {
6725 BinaryExpression expression = ParserTestCase.parseExpression("&", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6801 BinaryExpression expression = ParserTestCase.parseExpression("&", [
6802 ParserErrorCode.MISSING_IDENTIFIER,
6803 ParserErrorCode.MISSING_IDENTIFIER]);
6726 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6804 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6727 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6805 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6728 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6806 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6729 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6807 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6730 } 6808 }
6731 void test_bitwiseAndExpression_missing_RHS() { 6809 void test_bitwiseAndExpression_missing_RHS() {
6732 BinaryExpression expression = ParserTestCase.parseExpression("x &", [ParserE rrorCode.MISSING_IDENTIFIER]); 6810 BinaryExpression expression = ParserTestCase.parseExpression("x &", [ParserE rrorCode.MISSING_IDENTIFIER]);
6733 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6811 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6734 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6812 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6735 } 6813 }
6736 void test_bitwiseAndExpression_missing_RHS_super() { 6814 void test_bitwiseAndExpression_missing_RHS_super() {
6737 BinaryExpression expression = ParserTestCase.parseExpression("super &", [Par serErrorCode.MISSING_IDENTIFIER]); 6815 BinaryExpression expression = ParserTestCase.parseExpression("super &", [Par serErrorCode.MISSING_IDENTIFIER]);
6738 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6816 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6739 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6817 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6740 } 6818 }
6741 void test_bitwiseAndExpression_precedence_equality_left() { 6819 void test_bitwiseAndExpression_precedence_equality_left() {
6742 BinaryExpression expression = ParserTestCase.parseExpression("== &", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]); 6820 BinaryExpression expression = ParserTestCase.parseExpression("== &", [
6821 ParserErrorCode.MISSING_IDENTIFIER,
6822 ParserErrorCode.MISSING_IDENTIFIER,
6823 ParserErrorCode.MISSING_IDENTIFIER]);
6743 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6824 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6744 } 6825 }
6745 void test_bitwiseAndExpression_precedence_equality_right() { 6826 void test_bitwiseAndExpression_precedence_equality_right() {
6746 BinaryExpression expression = ParserTestCase.parseExpression("& ==", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]); 6827 BinaryExpression expression = ParserTestCase.parseExpression("& ==", [
6828 ParserErrorCode.MISSING_IDENTIFIER,
6829 ParserErrorCode.MISSING_IDENTIFIER,
6830 ParserErrorCode.MISSING_IDENTIFIER]);
6747 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6831 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6748 } 6832 }
6749 void test_bitwiseAndExpression_super() { 6833 void test_bitwiseAndExpression_super() {
6750 BinaryExpression expression = ParserTestCase.parseExpression("super & &", [ ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6834 BinaryExpression expression = ParserTestCase.parseExpression("super & &", [
6835 ParserErrorCode.MISSING_IDENTIFIER,
6836 ParserErrorCode.MISSING_IDENTIFIER]);
6751 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6837 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6752 } 6838 }
6753 void test_bitwiseOrExpression_missing_LHS() { 6839 void test_bitwiseOrExpression_missing_LHS() {
6754 BinaryExpression expression = ParserTestCase.parseExpression("| y", [ParserE rrorCode.MISSING_IDENTIFIER]); 6840 BinaryExpression expression = ParserTestCase.parseExpression("| y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6755 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6841 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6756 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6842 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6757 } 6843 }
6758 void test_bitwiseOrExpression_missing_LHS_RHS() { 6844 void test_bitwiseOrExpression_missing_LHS_RHS() {
6759 BinaryExpression expression = ParserTestCase.parseExpression("|", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6845 BinaryExpression expression = ParserTestCase.parseExpression("|", [
6846 ParserErrorCode.MISSING_IDENTIFIER,
6847 ParserErrorCode.MISSING_IDENTIFIER]);
6760 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6848 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6761 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6849 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6762 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6850 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6763 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6851 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6764 } 6852 }
6765 void test_bitwiseOrExpression_missing_RHS() { 6853 void test_bitwiseOrExpression_missing_RHS() {
6766 BinaryExpression expression = ParserTestCase.parseExpression("x |", [ParserE rrorCode.MISSING_IDENTIFIER]); 6854 BinaryExpression expression = ParserTestCase.parseExpression("x |", [ParserE rrorCode.MISSING_IDENTIFIER]);
6767 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6855 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6768 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6856 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6769 } 6857 }
6770 void test_bitwiseOrExpression_missing_RHS_super() { 6858 void test_bitwiseOrExpression_missing_RHS_super() {
6771 BinaryExpression expression = ParserTestCase.parseExpression("super |", [Par serErrorCode.MISSING_IDENTIFIER]); 6859 BinaryExpression expression = ParserTestCase.parseExpression("super |", [Par serErrorCode.MISSING_IDENTIFIER]);
6772 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6860 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6773 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6861 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6774 } 6862 }
6775 void test_bitwiseOrExpression_precedence_xor_left() { 6863 void test_bitwiseOrExpression_precedence_xor_left() {
6776 BinaryExpression expression = ParserTestCase.parseExpression("^ |", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]); 6864 BinaryExpression expression = ParserTestCase.parseExpression("^ |", [
6865 ParserErrorCode.MISSING_IDENTIFIER,
6866 ParserErrorCode.MISSING_IDENTIFIER,
6867 ParserErrorCode.MISSING_IDENTIFIER]);
6777 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6868 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6778 } 6869 }
6779 void test_bitwiseOrExpression_precedence_xor_right() { 6870 void test_bitwiseOrExpression_precedence_xor_right() {
6780 BinaryExpression expression = ParserTestCase.parseExpression("| ^", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]); 6871 BinaryExpression expression = ParserTestCase.parseExpression("| ^", [
6872 ParserErrorCode.MISSING_IDENTIFIER,
6873 ParserErrorCode.MISSING_IDENTIFIER,
6874 ParserErrorCode.MISSING_IDENTIFIER]);
6781 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6875 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6782 } 6876 }
6783 void test_bitwiseOrExpression_super() { 6877 void test_bitwiseOrExpression_super() {
6784 BinaryExpression expression = ParserTestCase.parseExpression("super | |", [ ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6878 BinaryExpression expression = ParserTestCase.parseExpression("super | |", [
6879 ParserErrorCode.MISSING_IDENTIFIER,
6880 ParserErrorCode.MISSING_IDENTIFIER]);
6785 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6881 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6786 } 6882 }
6787 void test_bitwiseXorExpression_missing_LHS() { 6883 void test_bitwiseXorExpression_missing_LHS() {
6788 BinaryExpression expression = ParserTestCase.parseExpression("^ y", [ParserE rrorCode.MISSING_IDENTIFIER]); 6884 BinaryExpression expression = ParserTestCase.parseExpression("^ y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6789 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6885 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6790 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6886 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6791 } 6887 }
6792 void test_bitwiseXorExpression_missing_LHS_RHS() { 6888 void test_bitwiseXorExpression_missing_LHS_RHS() {
6793 BinaryExpression expression = ParserTestCase.parseExpression("^", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6889 BinaryExpression expression = ParserTestCase.parseExpression("^", [
6890 ParserErrorCode.MISSING_IDENTIFIER,
6891 ParserErrorCode.MISSING_IDENTIFIER]);
6794 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6892 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6795 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6893 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6796 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6894 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6797 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6895 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6798 } 6896 }
6799 void test_bitwiseXorExpression_missing_RHS() { 6897 void test_bitwiseXorExpression_missing_RHS() {
6800 BinaryExpression expression = ParserTestCase.parseExpression("x ^", [ParserE rrorCode.MISSING_IDENTIFIER]); 6898 BinaryExpression expression = ParserTestCase.parseExpression("x ^", [ParserE rrorCode.MISSING_IDENTIFIER]);
6801 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6899 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6802 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6900 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6803 } 6901 }
6804 void test_bitwiseXorExpression_missing_RHS_super() { 6902 void test_bitwiseXorExpression_missing_RHS_super() {
6805 BinaryExpression expression = ParserTestCase.parseExpression("super ^", [Par serErrorCode.MISSING_IDENTIFIER]); 6903 BinaryExpression expression = ParserTestCase.parseExpression("super ^", [Par serErrorCode.MISSING_IDENTIFIER]);
6806 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6904 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6807 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6905 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6808 } 6906 }
6809 void test_bitwiseXorExpression_precedence_and_left() { 6907 void test_bitwiseXorExpression_precedence_and_left() {
6810 BinaryExpression expression = ParserTestCase.parseExpression("& ^", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]); 6908 BinaryExpression expression = ParserTestCase.parseExpression("& ^", [
6909 ParserErrorCode.MISSING_IDENTIFIER,
6910 ParserErrorCode.MISSING_IDENTIFIER,
6911 ParserErrorCode.MISSING_IDENTIFIER]);
6811 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6912 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6812 } 6913 }
6813 void test_bitwiseXorExpression_precedence_and_right() { 6914 void test_bitwiseXorExpression_precedence_and_right() {
6814 BinaryExpression expression = ParserTestCase.parseExpression("^ &", [ParserE rrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode .MISSING_IDENTIFIER]); 6915 BinaryExpression expression = ParserTestCase.parseExpression("^ &", [
6916 ParserErrorCode.MISSING_IDENTIFIER,
6917 ParserErrorCode.MISSING_IDENTIFIER,
6918 ParserErrorCode.MISSING_IDENTIFIER]);
6815 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6919 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6816 } 6920 }
6817 void test_bitwiseXorExpression_super() { 6921 void test_bitwiseXorExpression_super() {
6818 BinaryExpression expression = ParserTestCase.parseExpression("super ^ ^", [ ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6922 BinaryExpression expression = ParserTestCase.parseExpression("super ^ ^", [
6923 ParserErrorCode.MISSING_IDENTIFIER,
6924 ParserErrorCode.MISSING_IDENTIFIER]);
6819 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6925 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6820 } 6926 }
6821 void test_classTypeAlias_withBody() { 6927 void test_classTypeAlias_withBody() {
6822 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource(["class A {} ", "typedef B = Object with A {}"]), [ParserErrorCode.EXPECTED_TOKEN]); 6928 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource(["class A {} ", "typedef B = Object with A {}"]), [ParserErrorCode.EXPECTED_TOKEN]);
6823 } 6929 }
6824 void test_conditionalExpression_missingElse() { 6930 void test_conditionalExpression_missingElse() {
6825 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]); 6931 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]);
6826 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.elseExpression) ; 6932 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.elseExpression) ;
6827 JUnitTestCase.assertTrue(expression.elseExpression.isSynthetic); 6933 JUnitTestCase.assertTrue(expression.elseExpression.isSynthetic);
6828 } 6934 }
6829 void test_conditionalExpression_missingThen() { 6935 void test_conditionalExpression_missingThen() {
6830 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? : z", [ParserErrorCode.MISSING_IDENTIFIER]); 6936 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? : z", [ParserErrorCode.MISSING_IDENTIFIER]);
6831 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.thenExpression) ; 6937 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.thenExpression) ;
6832 JUnitTestCase.assertTrue(expression.thenExpression.isSynthetic); 6938 JUnitTestCase.assertTrue(expression.thenExpression.isSynthetic);
6833 } 6939 }
6834 void test_equalityExpression_missing_LHS() { 6940 void test_equalityExpression_missing_LHS() {
6835 BinaryExpression expression = ParserTestCase.parseExpression("== y", [Parser ErrorCode.MISSING_IDENTIFIER]); 6941 BinaryExpression expression = ParserTestCase.parseExpression("== y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6836 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6942 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6837 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6943 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6838 } 6944 }
6839 void test_equalityExpression_missing_LHS_RHS() { 6945 void test_equalityExpression_missing_LHS_RHS() {
6840 BinaryExpression expression = ParserTestCase.parseExpression("==", [ParserEr rorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 6946 BinaryExpression expression = ParserTestCase.parseExpression("==", [
6947 ParserErrorCode.MISSING_IDENTIFIER,
6948 ParserErrorCode.MISSING_IDENTIFIER]);
6841 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6949 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6842 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 6950 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6843 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6951 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6844 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6952 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6845 } 6953 }
6846 void test_equalityExpression_missing_RHS() { 6954 void test_equalityExpression_missing_RHS() {
6847 BinaryExpression expression = ParserTestCase.parseExpression("x ==", [Parser ErrorCode.MISSING_IDENTIFIER]); 6955 BinaryExpression expression = ParserTestCase.parseExpression("x ==", [Parser ErrorCode.MISSING_IDENTIFIER]);
6848 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6956 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6849 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6957 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6850 } 6958 }
6851 void test_equalityExpression_missing_RHS_super() { 6959 void test_equalityExpression_missing_RHS_super() {
6852 BinaryExpression expression = ParserTestCase.parseExpression("super ==", [Pa rserErrorCode.MISSING_IDENTIFIER]); 6960 BinaryExpression expression = ParserTestCase.parseExpression("super ==", [Pa rserErrorCode.MISSING_IDENTIFIER]);
6853 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 6961 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6854 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 6962 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6855 } 6963 }
6856 void test_equalityExpression_precedence_relational_left() { 6964 void test_equalityExpression_precedence_relational_left() {
6857 BinaryExpression expression = ParserTestCase.parseExpression("is ==", [Parse rErrorCode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCo de.MISSING_IDENTIFIER]); 6965 BinaryExpression expression = ParserTestCase.parseExpression("is ==", [
6966 ParserErrorCode.EXPECTED_TYPE_NAME,
6967 ParserErrorCode.MISSING_IDENTIFIER,
6968 ParserErrorCode.MISSING_IDENTIFIER]);
6858 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand); 6969 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand);
6859 } 6970 }
6860 void test_equalityExpression_precedence_relational_right() { 6971 void test_equalityExpression_precedence_relational_right() {
6861 BinaryExpression expression = ParserTestCase.parseExpression("== is", [Parse rErrorCode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCo de.MISSING_IDENTIFIER]); 6972 BinaryExpression expression = ParserTestCase.parseExpression("== is", [
6973 ParserErrorCode.EXPECTED_TYPE_NAME,
6974 ParserErrorCode.MISSING_IDENTIFIER,
6975 ParserErrorCode.MISSING_IDENTIFIER]);
6862 EngineTestCase.assertInstanceOf(IsExpression, expression.rightOperand); 6976 EngineTestCase.assertInstanceOf(IsExpression, expression.rightOperand);
6863 } 6977 }
6864 void test_equalityExpression_super() { 6978 void test_equalityExpression_super() {
6865 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, Parser ErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 6979 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [
6980 ParserErrorCode.MISSING_IDENTIFIER,
6981 ParserErrorCode.MISSING_IDENTIFIER,
6982 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
6866 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6983 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6867 } 6984 }
6868 void test_expressionList_multiple_end() { 6985 void test_expressionList_multiple_end() {
6869 List<Expression> result = ParserTestCase.parse5("parseExpressionList", ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]); 6986 List<Expression> result = ParserTestCase.parse5("parseExpressionList", ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]);
6870 EngineTestCase.assertSize(4, result); 6987 EngineTestCase.assertSize(4, result);
6871 Expression syntheticExpression = result[0]; 6988 Expression syntheticExpression = result[0];
6872 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 6989 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
6873 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 6990 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic);
6874 } 6991 }
6875 void test_expressionList_multiple_middle() { 6992 void test_expressionList_multiple_middle() {
(...skipping 15 matching lines...) Expand all
6891 NodeList<CompilationUnitMember> declarations = unit.declarations; 7008 NodeList<CompilationUnitMember> declarations = unit.declarations;
6892 EngineTestCase.assertSize(1, declarations); 7009 EngineTestCase.assertSize(1, declarations);
6893 CompilationUnitMember member = declarations[0]; 7010 CompilationUnitMember member = declarations[0];
6894 EngineTestCase.assertInstanceOf(TopLevelVariableDeclaration, member); 7011 EngineTestCase.assertInstanceOf(TopLevelVariableDeclaration, member);
6895 NodeList<VariableDeclaration> variables = ((member as TopLevelVariableDeclar ation)).variables.variables; 7012 NodeList<VariableDeclaration> variables = ((member as TopLevelVariableDeclar ation)).variables.variables;
6896 EngineTestCase.assertSize(1, variables); 7013 EngineTestCase.assertSize(1, variables);
6897 SimpleIdentifier name = variables[0].name; 7014 SimpleIdentifier name = variables[0].name;
6898 JUnitTestCase.assertTrue(name.isSynthetic); 7015 JUnitTestCase.assertTrue(name.isSynthetic);
6899 } 7016 }
6900 void test_isExpression_noType() { 7017 void test_isExpression_noType() {
6901 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]); 7018 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T exte nds Foo> {m(x){if (x is ) return;if (x is !)}}", [
7019 ParserErrorCode.EXPECTED_TYPE_NAME,
7020 ParserErrorCode.EXPECTED_TYPE_NAME,
7021 ParserErrorCode.MISSING_STATEMENT]);
6902 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration; 7022 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
6903 MethodDeclaration method = declaration.members[0] as MethodDeclaration; 7023 MethodDeclaration method = declaration.members[0] as MethodDeclaration;
6904 BlockFunctionBody body = method.body as BlockFunctionBody; 7024 BlockFunctionBody body = method.body as BlockFunctionBody;
6905 IfStatement ifStatement = body.block.statements[1] as IfStatement; 7025 IfStatement ifStatement = body.block.statements[1] as IfStatement;
6906 IsExpression expression = ifStatement.condition as IsExpression; 7026 IsExpression expression = ifStatement.condition as IsExpression;
6907 JUnitTestCase.assertNotNull(expression.expression); 7027 JUnitTestCase.assertNotNull(expression.expression);
6908 JUnitTestCase.assertNotNull(expression.isOperator); 7028 JUnitTestCase.assertNotNull(expression.isOperator);
6909 JUnitTestCase.assertNotNull(expression.notOperator); 7029 JUnitTestCase.assertNotNull(expression.notOperator);
6910 TypeName type = expression.type; 7030 TypeName type = expression.type;
6911 JUnitTestCase.assertNotNull(type); 7031 JUnitTestCase.assertNotNull(type);
6912 JUnitTestCase.assertTrue(type.name.isSynthetic); 7032 JUnitTestCase.assertTrue(type.name.isSynthetic);
6913 EngineTestCase.assertInstanceOf(EmptyStatement, ifStatement.thenStatement); 7033 EngineTestCase.assertInstanceOf(EmptyStatement, ifStatement.thenStatement);
6914 } 7034 }
6915 void test_logicalAndExpression_missing_LHS() { 7035 void test_logicalAndExpression_missing_LHS() {
6916 BinaryExpression expression = ParserTestCase.parseExpression("&& y", [Parser ErrorCode.MISSING_IDENTIFIER]); 7036 BinaryExpression expression = ParserTestCase.parseExpression("&& y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6917 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 7037 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6918 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 7038 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6919 } 7039 }
6920 void test_logicalAndExpression_missing_LHS_RHS() { 7040 void test_logicalAndExpression_missing_LHS_RHS() {
6921 BinaryExpression expression = ParserTestCase.parseExpression("&&", [ParserEr rorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 7041 BinaryExpression expression = ParserTestCase.parseExpression("&&", [
7042 ParserErrorCode.MISSING_IDENTIFIER,
7043 ParserErrorCode.MISSING_IDENTIFIER]);
6922 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 7044 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6923 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 7045 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6924 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7046 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6925 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7047 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6926 } 7048 }
6927 void test_logicalAndExpression_missing_RHS() { 7049 void test_logicalAndExpression_missing_RHS() {
6928 BinaryExpression expression = ParserTestCase.parseExpression("x &&", [Parser ErrorCode.MISSING_IDENTIFIER]); 7050 BinaryExpression expression = ParserTestCase.parseExpression("x &&", [Parser ErrorCode.MISSING_IDENTIFIER]);
6929 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7051 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6930 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7052 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6931 } 7053 }
6932 void test_logicalAndExpression_precedence_bitwiseOr_left() { 7054 void test_logicalAndExpression_precedence_bitwiseOr_left() {
6933 BinaryExpression expression = ParserTestCase.parseExpression("| &&", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]); 7055 BinaryExpression expression = ParserTestCase.parseExpression("| &&", [
7056 ParserErrorCode.MISSING_IDENTIFIER,
7057 ParserErrorCode.MISSING_IDENTIFIER,
7058 ParserErrorCode.MISSING_IDENTIFIER]);
6934 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 7059 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6935 } 7060 }
6936 void test_logicalAndExpression_precedence_bitwiseOr_right() { 7061 void test_logicalAndExpression_precedence_bitwiseOr_right() {
6937 BinaryExpression expression = ParserTestCase.parseExpression("&& |", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]); 7062 BinaryExpression expression = ParserTestCase.parseExpression("&& |", [
7063 ParserErrorCode.MISSING_IDENTIFIER,
7064 ParserErrorCode.MISSING_IDENTIFIER,
7065 ParserErrorCode.MISSING_IDENTIFIER]);
6938 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 7066 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6939 } 7067 }
6940 void test_logicalOrExpression_missing_LHS() { 7068 void test_logicalOrExpression_missing_LHS() {
6941 BinaryExpression expression = ParserTestCase.parseExpression("|| y", [Parser ErrorCode.MISSING_IDENTIFIER]); 7069 BinaryExpression expression = ParserTestCase.parseExpression("|| y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6942 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 7070 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6943 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 7071 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6944 } 7072 }
6945 void test_logicalOrExpression_missing_LHS_RHS() { 7073 void test_logicalOrExpression_missing_LHS_RHS() {
6946 BinaryExpression expression = ParserTestCase.parseExpression("||", [ParserEr rorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 7074 BinaryExpression expression = ParserTestCase.parseExpression("||", [
7075 ParserErrorCode.MISSING_IDENTIFIER,
7076 ParserErrorCode.MISSING_IDENTIFIER]);
6947 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 7077 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6948 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 7078 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6949 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7079 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6950 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7080 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6951 } 7081 }
6952 void test_logicalOrExpression_missing_RHS() { 7082 void test_logicalOrExpression_missing_RHS() {
6953 BinaryExpression expression = ParserTestCase.parseExpression("x ||", [Parser ErrorCode.MISSING_IDENTIFIER]); 7083 BinaryExpression expression = ParserTestCase.parseExpression("x ||", [Parser ErrorCode.MISSING_IDENTIFIER]);
6954 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7084 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6955 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7085 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6956 } 7086 }
6957 void test_logicalOrExpression_precedence_logicalAnd_left() { 7087 void test_logicalOrExpression_precedence_logicalAnd_left() {
6958 BinaryExpression expression = ParserTestCase.parseExpression("&& ||", [Parse rErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCo de.MISSING_IDENTIFIER]); 7088 BinaryExpression expression = ParserTestCase.parseExpression("&& ||", [
7089 ParserErrorCode.MISSING_IDENTIFIER,
7090 ParserErrorCode.MISSING_IDENTIFIER,
7091 ParserErrorCode.MISSING_IDENTIFIER]);
6959 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 7092 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6960 } 7093 }
6961 void test_logicalOrExpression_precedence_logicalAnd_right() { 7094 void test_logicalOrExpression_precedence_logicalAnd_right() {
6962 BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [Parse rErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCo de.MISSING_IDENTIFIER]); 7095 BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [
7096 ParserErrorCode.MISSING_IDENTIFIER,
7097 ParserErrorCode.MISSING_IDENTIFIER,
7098 ParserErrorCode.MISSING_IDENTIFIER]);
6963 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 7099 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6964 } 7100 }
6965 void test_multiplicativeExpression_missing_LHS() { 7101 void test_multiplicativeExpression_missing_LHS() {
6966 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]); 7102 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]);
6967 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 7103 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6968 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 7104 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6969 } 7105 }
6970 void test_multiplicativeExpression_missing_LHS_RHS() { 7106 void test_multiplicativeExpression_missing_LHS_RHS() {
6971 BinaryExpression expression = ParserTestCase.parseExpression("*", [ParserErr orCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 7107 BinaryExpression expression = ParserTestCase.parseExpression("*", [
7108 ParserErrorCode.MISSING_IDENTIFIER,
7109 ParserErrorCode.MISSING_IDENTIFIER]);
6972 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 7110 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6973 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 7111 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
6974 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7112 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6975 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7113 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6976 } 7114 }
6977 void test_multiplicativeExpression_missing_RHS() { 7115 void test_multiplicativeExpression_missing_RHS() {
6978 BinaryExpression expression = ParserTestCase.parseExpression("x *", [ParserE rrorCode.MISSING_IDENTIFIER]); 7116 BinaryExpression expression = ParserTestCase.parseExpression("x *", [ParserE rrorCode.MISSING_IDENTIFIER]);
6979 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7117 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6980 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7118 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6981 } 7119 }
6982 void test_multiplicativeExpression_missing_RHS_super() { 7120 void test_multiplicativeExpression_missing_RHS_super() {
6983 BinaryExpression expression = ParserTestCase.parseExpression("super *", [Par serErrorCode.MISSING_IDENTIFIER]); 7121 BinaryExpression expression = ParserTestCase.parseExpression("super *", [Par serErrorCode.MISSING_IDENTIFIER]);
6984 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7122 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
6985 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7123 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
6986 } 7124 }
6987 void test_multiplicativeExpression_precedence_unary_left() { 7125 void test_multiplicativeExpression_precedence_unary_left() {
6988 BinaryExpression expression = ParserTestCase.parseExpression("-x *", [Parser ErrorCode.MISSING_IDENTIFIER]); 7126 BinaryExpression expression = ParserTestCase.parseExpression("-x *", [Parser ErrorCode.MISSING_IDENTIFIER]);
6989 EngineTestCase.assertInstanceOf(PrefixExpression, expression.leftOperand); 7127 EngineTestCase.assertInstanceOf(PrefixExpression, expression.leftOperand);
6990 } 7128 }
6991 void test_multiplicativeExpression_precedence_unary_right() { 7129 void test_multiplicativeExpression_precedence_unary_right() {
6992 BinaryExpression expression = ParserTestCase.parseExpression("* -y", [Parser ErrorCode.MISSING_IDENTIFIER]); 7130 BinaryExpression expression = ParserTestCase.parseExpression("* -y", [Parser ErrorCode.MISSING_IDENTIFIER]);
6993 EngineTestCase.assertInstanceOf(PrefixExpression, expression.rightOperand); 7131 EngineTestCase.assertInstanceOf(PrefixExpression, expression.rightOperand);
6994 } 7132 }
6995 void test_multiplicativeExpression_super() { 7133 void test_multiplicativeExpression_super() {
6996 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, Parser ErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 7134 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [
7135 ParserErrorCode.MISSING_IDENTIFIER,
7136 ParserErrorCode.MISSING_IDENTIFIER,
7137 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
6997 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 7138 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6998 } 7139 }
6999 void test_prefixExpression_missing_operand_minus() { 7140 void test_prefixExpression_missing_operand_minus() {
7000 PrefixExpression expression = ParserTestCase.parseExpression("-", [ParserErr orCode.MISSING_IDENTIFIER]); 7141 PrefixExpression expression = ParserTestCase.parseExpression("-", [ParserErr orCode.MISSING_IDENTIFIER]);
7001 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.operand); 7142 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.operand);
7002 JUnitTestCase.assertTrue(expression.operand.isSynthetic); 7143 JUnitTestCase.assertTrue(expression.operand.isSynthetic);
7003 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 7144 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type);
7004 } 7145 }
7005 void test_relationalExpression_missing_LHS() { 7146 void test_relationalExpression_missing_LHS() {
7006 IsExpression expression = ParserTestCase.parseExpression("is y", [ParserErro rCode.MISSING_IDENTIFIER]); 7147 IsExpression expression = ParserTestCase.parseExpression("is y", [ParserErro rCode.MISSING_IDENTIFIER]);
7007 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression); 7148 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression);
7008 JUnitTestCase.assertTrue(expression.expression.isSynthetic); 7149 JUnitTestCase.assertTrue(expression.expression.isSynthetic);
7009 } 7150 }
7010 void test_relationalExpression_missing_LHS_RHS() { 7151 void test_relationalExpression_missing_LHS_RHS() {
7011 IsExpression expression = ParserTestCase.parseExpression("is", [ParserErrorC ode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER]); 7152 IsExpression expression = ParserTestCase.parseExpression("is", [
7153 ParserErrorCode.EXPECTED_TYPE_NAME,
7154 ParserErrorCode.MISSING_IDENTIFIER]);
7012 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression); 7155 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression);
7013 JUnitTestCase.assertTrue(expression.expression.isSynthetic); 7156 JUnitTestCase.assertTrue(expression.expression.isSynthetic);
7014 EngineTestCase.assertInstanceOf(TypeName, expression.type); 7157 EngineTestCase.assertInstanceOf(TypeName, expression.type);
7015 JUnitTestCase.assertTrue(expression.type.isSynthetic); 7158 JUnitTestCase.assertTrue(expression.type.isSynthetic);
7016 } 7159 }
7017 void test_relationalExpression_missing_RHS() { 7160 void test_relationalExpression_missing_RHS() {
7018 IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErro rCode.EXPECTED_TYPE_NAME]); 7161 IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErro rCode.EXPECTED_TYPE_NAME]);
7019 EngineTestCase.assertInstanceOf(TypeName, expression.type); 7162 EngineTestCase.assertInstanceOf(TypeName, expression.type);
7020 JUnitTestCase.assertTrue(expression.type.isSynthetic); 7163 JUnitTestCase.assertTrue(expression.type.isSynthetic);
7021 } 7164 }
7022 void test_relationalExpression_precedence_shift_right() { 7165 void test_relationalExpression_precedence_shift_right() {
7023 IsExpression expression = ParserTestCase.parseExpression("<< is", [ParserErr orCode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.M ISSING_IDENTIFIER]); 7166 IsExpression expression = ParserTestCase.parseExpression("<< is", [
7167 ParserErrorCode.EXPECTED_TYPE_NAME,
7168 ParserErrorCode.MISSING_IDENTIFIER,
7169 ParserErrorCode.MISSING_IDENTIFIER]);
7024 EngineTestCase.assertInstanceOf(BinaryExpression, expression.expression); 7170 EngineTestCase.assertInstanceOf(BinaryExpression, expression.expression);
7025 } 7171 }
7026 void test_shiftExpression_missing_LHS() { 7172 void test_shiftExpression_missing_LHS() {
7027 BinaryExpression expression = ParserTestCase.parseExpression("<< y", [Parser ErrorCode.MISSING_IDENTIFIER]); 7173 BinaryExpression expression = ParserTestCase.parseExpression("<< y", [Parser ErrorCode.MISSING_IDENTIFIER]);
7028 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 7174 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7029 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 7175 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7030 } 7176 }
7031 void test_shiftExpression_missing_LHS_RHS() { 7177 void test_shiftExpression_missing_LHS_RHS() {
7032 BinaryExpression expression = ParserTestCase.parseExpression("<<", [ParserEr rorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 7178 BinaryExpression expression = ParserTestCase.parseExpression("<<", [
7179 ParserErrorCode.MISSING_IDENTIFIER,
7180 ParserErrorCode.MISSING_IDENTIFIER]);
7033 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 7181 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7034 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 7182 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7035 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7183 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7036 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7184 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7037 } 7185 }
7038 void test_shiftExpression_missing_RHS() { 7186 void test_shiftExpression_missing_RHS() {
7039 BinaryExpression expression = ParserTestCase.parseExpression("x <<", [Parser ErrorCode.MISSING_IDENTIFIER]); 7187 BinaryExpression expression = ParserTestCase.parseExpression("x <<", [Parser ErrorCode.MISSING_IDENTIFIER]);
7040 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7188 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7041 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7189 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7042 } 7190 }
7043 void test_shiftExpression_missing_RHS_super() { 7191 void test_shiftExpression_missing_RHS_super() {
7044 BinaryExpression expression = ParserTestCase.parseExpression("super <<", [Pa rserErrorCode.MISSING_IDENTIFIER]); 7192 BinaryExpression expression = ParserTestCase.parseExpression("super <<", [Pa rserErrorCode.MISSING_IDENTIFIER]);
7045 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 7193 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7046 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 7194 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7047 } 7195 }
7048 void test_shiftExpression_precedence_unary_left() { 7196 void test_shiftExpression_precedence_unary_left() {
7049 BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]); 7197 BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [
7198 ParserErrorCode.MISSING_IDENTIFIER,
7199 ParserErrorCode.MISSING_IDENTIFIER,
7200 ParserErrorCode.MISSING_IDENTIFIER]);
7050 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 7201 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7051 } 7202 }
7052 void test_shiftExpression_precedence_unary_right() { 7203 void test_shiftExpression_precedence_unary_right() {
7053 BinaryExpression expression = ParserTestCase.parseExpression("<< +", [Parser ErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCod e.MISSING_IDENTIFIER]); 7204 BinaryExpression expression = ParserTestCase.parseExpression("<< +", [
7205 ParserErrorCode.MISSING_IDENTIFIER,
7206 ParserErrorCode.MISSING_IDENTIFIER,
7207 ParserErrorCode.MISSING_IDENTIFIER]);
7054 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 7208 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
7055 } 7209 }
7056 void test_shiftExpression_super() { 7210 void test_shiftExpression_super() {
7057 BinaryExpression expression = ParserTestCase.parseExpression("super << <<", [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]); 7211 BinaryExpression expression = ParserTestCase.parseExpression("super << <<", [
7212 ParserErrorCode.MISSING_IDENTIFIER,
7213 ParserErrorCode.MISSING_IDENTIFIER]);
7058 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 7214 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7059 } 7215 }
7060 void test_typedef_eof() { 7216 void test_typedef_eof() {
7061 CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [Par serErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]); 7217 CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [
7218 ParserErrorCode.EXPECTED_TOKEN,
7219 ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
7062 NodeList<CompilationUnitMember> declarations = unit.declarations; 7220 NodeList<CompilationUnitMember> declarations = unit.declarations;
7063 EngineTestCase.assertSize(1, declarations); 7221 EngineTestCase.assertSize(1, declarations);
7064 CompilationUnitMember member = declarations[0]; 7222 CompilationUnitMember member = declarations[0];
7065 EngineTestCase.assertInstanceOf(FunctionTypeAlias, member); 7223 EngineTestCase.assertInstanceOf(FunctionTypeAlias, member);
7066 } 7224 }
7067 static dartSuite() { 7225 static dartSuite() {
7068 _ut.group('RecoveryParserTest', () { 7226 _ut.group('RecoveryParserTest', () {
7069 _ut.test('test_additiveExpression_missing_LHS', () { 7227 _ut.test('test_additiveExpression_missing_LHS', () {
7070 final __test = new RecoveryParserTest(); 7228 final __test = new RecoveryParserTest();
7071 runJUnitTest(__test, __test.test_additiveExpression_missing_LHS); 7229 runJUnitTest(__test, __test.test_additiveExpression_missing_LHS);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
7414 void fail_missingFunctionParameters_local_nonVoid_expression() { 7572 void fail_missingFunctionParameters_local_nonVoid_expression() {
7415 ParserTestCase.parseStatement("int f => x;", [ParserErrorCode.MISSING_FUNCTI ON_PARAMETERS]); 7573 ParserTestCase.parseStatement("int f => x;", [ParserErrorCode.MISSING_FUNCTI ON_PARAMETERS]);
7416 } 7574 }
7417 void fail_namedFunctionExpression() { 7575 void fail_namedFunctionExpression() {
7418 Expression expression = ParserTestCase.parse5("parsePrimaryExpression", "f() {}", [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]); 7576 Expression expression = ParserTestCase.parse5("parsePrimaryExpression", "f() {}", [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
7419 EngineTestCase.assertInstanceOf(FunctionExpression, expression); 7577 EngineTestCase.assertInstanceOf(FunctionExpression, expression);
7420 } 7578 }
7421 void fail_unexpectedToken_invalidPostfixExpression() { 7579 void fail_unexpectedToken_invalidPostfixExpression() {
7422 ParserTestCase.parseExpression("f()++", [ParserErrorCode.UNEXPECTED_TOKEN]); 7580 ParserTestCase.parseExpression("f()++", [ParserErrorCode.UNEXPECTED_TOKEN]);
7423 } 7581 }
7582 void fail_varAndType_local() {
7583 ParserTestCase.parseStatement("var int x;", [ParserErrorCode.VAR_AND_TYPE]);
7584 }
7585 void fail_varAndType_parameter() {
7586 ParserTestCase.parse5("parseFormalParameterList", "(var int x)", [ParserErro rCode.VAR_AND_TYPE]);
7587 }
7424 void fail_voidVariable_initializer() { 7588 void fail_voidVariable_initializer() {
7425 ParserTestCase.parseStatement("void x = 0;", [ParserErrorCode.VOID_VARIABLE] ); 7589 ParserTestCase.parseStatement("void x = 0;", [ParserErrorCode.VOID_VARIABLE] );
7426 } 7590 }
7427 void fail_voidVariable_noInitializer() { 7591 void fail_voidVariable_noInitializer() {
7428 ParserTestCase.parseStatement("void x;", [ParserErrorCode.VOID_VARIABLE]); 7592 ParserTestCase.parseStatement("void x;", [ParserErrorCode.VOID_VARIABLE]);
7429 } 7593 }
7430 void test_abstractClassMember_constructor() { 7594 void test_abstractClassMember_constructor() {
7431 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C.c();", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 7595 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C.c();", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
7432 } 7596 }
7433 void test_abstractClassMember_field() { 7597 void test_abstractClassMember_field() {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
7705 void test_functionTypedParameter_final() { 7869 void test_functionTypedParameter_final() {
7706 ParserTestCase.parseCompilationUnit("void f(final x()) {}", [ParserErrorCode .FUNCTION_TYPED_PARAMETER_VAR]); 7870 ParserTestCase.parseCompilationUnit("void f(final x()) {}", [ParserErrorCode .FUNCTION_TYPED_PARAMETER_VAR]);
7707 } 7871 }
7708 void test_functionTypedParameter_var() { 7872 void test_functionTypedParameter_var() {
7709 ParserTestCase.parseCompilationUnit("void f(var x()) {}", [ParserErrorCode.F UNCTION_TYPED_PARAMETER_VAR]); 7873 ParserTestCase.parseCompilationUnit("void f(var x()) {}", [ParserErrorCode.F UNCTION_TYPED_PARAMETER_VAR]);
7710 } 7874 }
7711 void test_getterWithParameters() { 7875 void test_getterWithParameters() {
7712 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int get x() {}", [ParserErrorCode.GETTER_WITH_PARAMETERS]); 7876 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int get x() {}", [ParserErrorCode.GETTER_WITH_PARAMETERS]);
7713 } 7877 }
7714 void test_illegalAssignmentToNonAssignable_superAssigned() { 7878 void test_illegalAssignmentToNonAssignable_superAssigned() {
7715 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.MISSING_ASSIGN ABLE_SELECTOR, ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]); 7879 ParserTestCase.parseExpression("super = x;", [
7880 ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR,
7881 ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
7716 } 7882 }
7717 void test_implementsBeforeExtends() { 7883 void test_implementsBeforeExtends() {
7718 ParserTestCase.parseCompilationUnit("class A implements B extends C {}", [Pa rserErrorCode.IMPLEMENTS_BEFORE_EXTENDS]); 7884 ParserTestCase.parseCompilationUnit("class A implements B extends C {}", [Pa rserErrorCode.IMPLEMENTS_BEFORE_EXTENDS]);
7719 } 7885 }
7720 void test_implementsBeforeWith() { 7886 void test_implementsBeforeWith() {
7721 ParserTestCase.parseCompilationUnit("class A extends B implements C with D { }", [ParserErrorCode.IMPLEMENTS_BEFORE_WITH]); 7887 ParserTestCase.parseCompilationUnit("class A extends B implements C with D { }", [ParserErrorCode.IMPLEMENTS_BEFORE_WITH]);
7722 } 7888 }
7723 void test_importDirectiveAfterPartDirective() { 7889 void test_importDirectiveAfterPartDirective() {
7724 ParserTestCase.parseCompilationUnit("part 'a.dart'; import 'b.dart';", [Pars erErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]); 7890 ParserTestCase.parseCompilationUnit("part 'a.dart'; import 'b.dart';", [Pars erErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]);
7725 } 7891 }
(...skipping 27 matching lines...) Expand all
7753 void test_invalidUnicodeEscape_invalidDigit() { 7919 void test_invalidUnicodeEscape_invalidDigit() {
7754 ParserTestCase.parse5("parseStringLiteral", "'\\u0 a'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]); 7920 ParserTestCase.parse5("parseStringLiteral", "'\\u0 a'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]);
7755 } 7921 }
7756 void test_invalidUnicodeEscape_tooFewDigits_fixed() { 7922 void test_invalidUnicodeEscape_tooFewDigits_fixed() {
7757 ParserTestCase.parse5("parseStringLiteral", "'\\u04'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]); 7923 ParserTestCase.parse5("parseStringLiteral", "'\\u04'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]);
7758 } 7924 }
7759 void test_invalidUnicodeEscape_tooFewDigits_variable() { 7925 void test_invalidUnicodeEscape_tooFewDigits_variable() {
7760 ParserTestCase.parse5("parseStringLiteral", "'\\u{}'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]); 7926 ParserTestCase.parse5("parseStringLiteral", "'\\u{}'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]);
7761 } 7927 }
7762 void test_invalidUnicodeEscape_tooManyDigits_variable() { 7928 void test_invalidUnicodeEscape_tooManyDigits_variable() {
7763 ParserTestCase.parse5("parseStringLiteral", "'\\u{12345678}'", [ParserErrorC ode.INVALID_UNICODE_ESCAPE, ParserErrorCode.INVALID_CODE_POINT]); 7929 ParserTestCase.parse5("parseStringLiteral", "'\\u{12345678}'", [
7930 ParserErrorCode.INVALID_UNICODE_ESCAPE,
7931 ParserErrorCode.INVALID_CODE_POINT]);
7764 } 7932 }
7765 void test_libraryDirectiveNotFirst() { 7933 void test_libraryDirectiveNotFirst() {
7766 ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;", [ParserEr rorCode.LIBRARY_DIRECTIVE_NOT_FIRST]); 7934 ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;", [ParserEr rorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
7767 } 7935 }
7768 void test_libraryDirectiveNotFirst_afterPart() { 7936 void test_libraryDirectiveNotFirst_afterPart() {
7769 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part 'a.dart';\n library l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]); 7937 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part 'a.dart';\n library l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
7770 JUnitTestCase.assertNotNull(unit); 7938 JUnitTestCase.assertNotNull(unit);
7771 } 7939 }
7772 void test_localFunctionDeclarationModifier_abstract() { 7940 void test_localFunctionDeclarationModifier_abstract() {
7773 ParserTestCase.parseStatement("abstract f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]); 7941 ParserTestCase.parseStatement("abstract f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
7949 } 8117 }
7950 void test_optionalAfterNormalParameters_positional() { 8118 void test_optionalAfterNormalParameters_positional() {
7951 ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]); 8119 ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]);
7952 } 8120 }
7953 void test_positionalAfterNamedArgument() { 8121 void test_positionalAfterNamedArgument() {
7954 ParserTestCase.parse5("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POS ITIONAL_AFTER_NAMED_ARGUMENT]); 8122 ParserTestCase.parse5("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POS ITIONAL_AFTER_NAMED_ARGUMENT]);
7955 } 8123 }
7956 void test_positionalParameterOutsideGroup() { 8124 void test_positionalParameterOutsideGroup() {
7957 ParserTestCase.parse5("parseFormalParameterList", "(a, b = 0)", [ParserError Code.POSITIONAL_PARAMETER_OUTSIDE_GROUP]); 8125 ParserTestCase.parse5("parseFormalParameterList", "(a, b = 0)", [ParserError Code.POSITIONAL_PARAMETER_OUTSIDE_GROUP]);
7958 } 8126 }
8127 void test_redirectionInNonFactoryConstructor() {
8128 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "C() = D;", [Parse rErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR]);
8129 }
7959 void test_staticAfterConst() { 8130 void test_staticAfterConst() {
7960 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final static int f;", [ParserErrorCode.STATIC_AFTER_FINAL]); 8131 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final static int f;", [ParserErrorCode.STATIC_AFTER_FINAL]);
7961 } 8132 }
7962 void test_staticAfterFinal() { 8133 void test_staticAfterFinal() {
7963 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const static int f;", [ParserErrorCode.STATIC_AFTER_CONST]); 8134 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const static int f;", [ParserErrorCode.STATIC_AFTER_CONST]);
7964 } 8135 }
7965 void test_staticAfterVar() { 8136 void test_staticAfterVar() {
7966 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var static f;", [ ParserErrorCode.STATIC_AFTER_VAR]); 8137 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var static f;", [ ParserErrorCode.STATIC_AFTER_VAR]);
7967 } 8138 }
7968 void test_staticConstructor() { 8139 void test_staticConstructor() {
(...skipping 20 matching lines...) Expand all
7989 void test_staticTopLevelDeclaration_typedef() { 8160 void test_staticTopLevelDeclaration_typedef() {
7990 ParserTestCase.parseCompilationUnit("static typedef F();", [ParserErrorCode. STATIC_TOP_LEVEL_DECLARATION]); 8161 ParserTestCase.parseCompilationUnit("static typedef F();", [ParserErrorCode. STATIC_TOP_LEVEL_DECLARATION]);
7991 } 8162 }
7992 void test_staticTopLevelDeclaration_variable() { 8163 void test_staticTopLevelDeclaration_variable() {
7993 ParserTestCase.parseCompilationUnit("static var x;", [ParserErrorCode.STATIC _TOP_LEVEL_DECLARATION]); 8164 ParserTestCase.parseCompilationUnit("static var x;", [ParserErrorCode.STATIC _TOP_LEVEL_DECLARATION]);
7994 } 8165 }
7995 void test_switchHasCaseAfterDefaultCase() { 8166 void test_switchHasCaseAfterDefaultCase() {
7996 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]); 8167 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
7997 } 8168 }
7998 void test_switchHasCaseAfterDefaultCase_repeated() { 8169 void test_switchHasCaseAfterDefaultCase_repeated() {
7999 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]); 8170 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1; case 2: return 2;}", [
8171 ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE,
8172 ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
8000 } 8173 }
8001 void test_switchHasMultipleDefaultCases() { 8174 void test_switchHasMultipleDefaultCases() {
8002 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1;}", [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]); 8175 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1;}", [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
8003 } 8176 }
8004 void test_switchHasMultipleDefaultCases_repeated() { 8177 void test_switchHasMultipleDefaultCases_repeated() {
8005 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1; default: return 2;}", [ParserErrorCode.SWITCH_HAS_MULTIPLE_ DEFAULT_CASES, ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]); 8178 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1; default: return 2;}", [
8179 ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
8180 ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
8006 } 8181 }
8007 void test_topLevelOperator_withoutType() { 8182 void test_topLevelOperator_withoutType() {
8008 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_LEVEL _OPERATOR]); 8183 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_LEVEL _OPERATOR]);
8009 } 8184 }
8010 void test_topLevelOperator_withType() { 8185 void test_topLevelOperator_withType() {
8011 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "bool operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_ LEVEL_OPERATOR]); 8186 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "bool operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_ LEVEL_OPERATOR]);
8012 } 8187 }
8013 void test_topLevelOperator_withVoid() { 8188 void test_topLevelOperator_withVoid() {
8014 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_ LEVEL_OPERATOR]); 8189 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_ LEVEL_OPERATOR]);
8015 } 8190 }
8016 void test_unexpectedTerminatorForParameterGroup_named() { 8191 void test_unexpectedTerminatorForParameterGroup_named() {
8017 ParserTestCase.parse5("parseFormalParameterList", "(a, b})", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]); 8192 ParserTestCase.parse5("parseFormalParameterList", "(a, b})", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
8018 } 8193 }
8019 void test_unexpectedTerminatorForParameterGroup_optional() { 8194 void test_unexpectedTerminatorForParameterGroup_optional() {
8020 ParserTestCase.parse5("parseFormalParameterList", "(a, b])", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]); 8195 ParserTestCase.parse5("parseFormalParameterList", "(a, b])", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
8021 } 8196 }
8022 void test_unexpectedToken_semicolonBetweenClassMembers() { 8197 void test_unexpectedToken_semicolonBetweenClassMembers() {
8023 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]) ; 8198 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]) ;
8024 } 8199 }
8025 void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() { 8200 void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() {
8026 ParserTestCase.parseCompilationUnit("int x; ; int y;", [ParserErrorCode.UNEX PECTED_TOKEN]); 8201 ParserTestCase.parseCompilationUnit("int x; ; int y;", [ParserErrorCode.UNEX PECTED_TOKEN]);
8027 } 8202 }
8028 void test_useOfUnaryPlusOperator() { 8203 void test_useOfUnaryPlusOperator() {
8029 SimpleIdentifier expression = ParserTestCase.parse5("parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]); 8204 SimpleIdentifier expression = ParserTestCase.parse5("parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]);
8030 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression); 8205 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression);
8031 JUnitTestCase.assertTrue(expression.isSynthetic); 8206 JUnitTestCase.assertTrue(expression.isSynthetic);
8032 } 8207 }
8208 void test_varAndType_field() {
8209 ParserTestCase.parseCompilationUnit("class C { var int x; }", [ParserErrorCo de.VAR_AND_TYPE]);
8210 }
8211 void test_varAndType_topLevelVariable() {
8212 ParserTestCase.parseCompilationUnit("var int x;", [ParserErrorCode.VAR_AND_T YPE]);
8213 }
8033 void test_varAsTypeName_as() { 8214 void test_varAsTypeName_as() {
8034 ParserTestCase.parseExpression("x as var", [ParserErrorCode.VAR_AS_TYPE_NAME ]); 8215 ParserTestCase.parseExpression("x as var", [ParserErrorCode.VAR_AS_TYPE_NAME ]);
8035 } 8216 }
8036 void test_varClass() { 8217 void test_varClass() {
8037 ParserTestCase.parseCompilationUnit("var class C {}", [ParserErrorCode.VAR_C LASS]); 8218 ParserTestCase.parseCompilationUnit("var class C {}", [ParserErrorCode.VAR_C LASS]);
8038 } 8219 }
8039 void test_varReturnType() { 8220 void test_varReturnType() {
8040 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var m() {}", [Par serErrorCode.VAR_RETURN_TYPE]); 8221 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var m() {}", [Par serErrorCode.VAR_RETURN_TYPE]);
8041 } 8222 }
8042 void test_varTypedef() { 8223 void test_varTypedef() {
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
8752 runJUnitTest(__test, __test.test_optionalAfterNormalParameters_positiona l); 8933 runJUnitTest(__test, __test.test_optionalAfterNormalParameters_positiona l);
8753 }); 8934 });
8754 _ut.test('test_positionalAfterNamedArgument', () { 8935 _ut.test('test_positionalAfterNamedArgument', () {
8755 final __test = new ErrorParserTest(); 8936 final __test = new ErrorParserTest();
8756 runJUnitTest(__test, __test.test_positionalAfterNamedArgument); 8937 runJUnitTest(__test, __test.test_positionalAfterNamedArgument);
8757 }); 8938 });
8758 _ut.test('test_positionalParameterOutsideGroup', () { 8939 _ut.test('test_positionalParameterOutsideGroup', () {
8759 final __test = new ErrorParserTest(); 8940 final __test = new ErrorParserTest();
8760 runJUnitTest(__test, __test.test_positionalParameterOutsideGroup); 8941 runJUnitTest(__test, __test.test_positionalParameterOutsideGroup);
8761 }); 8942 });
8943 _ut.test('test_redirectionInNonFactoryConstructor', () {
8944 final __test = new ErrorParserTest();
8945 runJUnitTest(__test, __test.test_redirectionInNonFactoryConstructor);
8946 });
8762 _ut.test('test_staticAfterConst', () { 8947 _ut.test('test_staticAfterConst', () {
8763 final __test = new ErrorParserTest(); 8948 final __test = new ErrorParserTest();
8764 runJUnitTest(__test, __test.test_staticAfterConst); 8949 runJUnitTest(__test, __test.test_staticAfterConst);
8765 }); 8950 });
8766 _ut.test('test_staticAfterFinal', () { 8951 _ut.test('test_staticAfterFinal', () {
8767 final __test = new ErrorParserTest(); 8952 final __test = new ErrorParserTest();
8768 runJUnitTest(__test, __test.test_staticAfterFinal); 8953 runJUnitTest(__test, __test.test_staticAfterFinal);
8769 }); 8954 });
8770 _ut.test('test_staticAfterVar', () { 8955 _ut.test('test_staticAfterVar', () {
8771 final __test = new ErrorParserTest(); 8956 final __test = new ErrorParserTest();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
8848 runJUnitTest(__test, __test.test_unexpectedToken_semicolonBetweenClassMe mbers); 9033 runJUnitTest(__test, __test.test_unexpectedToken_semicolonBetweenClassMe mbers);
8849 }); 9034 });
8850 _ut.test('test_unexpectedToken_semicolonBetweenCompilationUnitMembers', () { 9035 _ut.test('test_unexpectedToken_semicolonBetweenCompilationUnitMembers', () {
8851 final __test = new ErrorParserTest(); 9036 final __test = new ErrorParserTest();
8852 runJUnitTest(__test, __test.test_unexpectedToken_semicolonBetweenCompila tionUnitMembers); 9037 runJUnitTest(__test, __test.test_unexpectedToken_semicolonBetweenCompila tionUnitMembers);
8853 }); 9038 });
8854 _ut.test('test_useOfUnaryPlusOperator', () { 9039 _ut.test('test_useOfUnaryPlusOperator', () {
8855 final __test = new ErrorParserTest(); 9040 final __test = new ErrorParserTest();
8856 runJUnitTest(__test, __test.test_useOfUnaryPlusOperator); 9041 runJUnitTest(__test, __test.test_useOfUnaryPlusOperator);
8857 }); 9042 });
9043 _ut.test('test_varAndType_field', () {
9044 final __test = new ErrorParserTest();
9045 runJUnitTest(__test, __test.test_varAndType_field);
9046 });
9047 _ut.test('test_varAndType_topLevelVariable', () {
9048 final __test = new ErrorParserTest();
9049 runJUnitTest(__test, __test.test_varAndType_topLevelVariable);
9050 });
8858 _ut.test('test_varAsTypeName_as', () { 9051 _ut.test('test_varAsTypeName_as', () {
8859 final __test = new ErrorParserTest(); 9052 final __test = new ErrorParserTest();
8860 runJUnitTest(__test, __test.test_varAsTypeName_as); 9053 runJUnitTest(__test, __test.test_varAsTypeName_as);
8861 }); 9054 });
8862 _ut.test('test_varClass', () { 9055 _ut.test('test_varClass', () {
8863 final __test = new ErrorParserTest(); 9056 final __test = new ErrorParserTest();
8864 runJUnitTest(__test, __test.test_varClass); 9057 runJUnitTest(__test, __test.test_varClass);
8865 }); 9058 });
8866 _ut.test('test_varReturnType', () { 9059 _ut.test('test_varReturnType', () {
8867 final __test = new ErrorParserTest(); 9060 final __test = new ErrorParserTest();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
8935 'getCodeBlockRanges_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.getCodeBlockRanges(arg0)), 9128 'getCodeBlockRanges_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.getCodeBlockRanges(arg0)),
8936 'getEndToken_1': new MethodTrampoline(1, (Parser target, arg0) => target.getEn dToken(arg0)), 9129 'getEndToken_1': new MethodTrampoline(1, (Parser target, arg0) => target.getEn dToken(arg0)),
8937 'hasReturnTypeInTypeAlias_0': new MethodTrampoline(0, (Parser target) => targe t.hasReturnTypeInTypeAlias()), 9130 'hasReturnTypeInTypeAlias_0': new MethodTrampoline(0, (Parser target) => targe t.hasReturnTypeInTypeAlias()),
8938 'isFunctionDeclaration_0': new MethodTrampoline(0, (Parser target) => target.i sFunctionDeclaration()), 9131 'isFunctionDeclaration_0': new MethodTrampoline(0, (Parser target) => target.i sFunctionDeclaration()),
8939 'isFunctionExpression_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.isFunctionExpression(arg0)), 9132 'isFunctionExpression_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.isFunctionExpression(arg0)),
8940 'isHexDigit_1': new MethodTrampoline(1, (Parser target, arg0) => target.isHexD igit(arg0)), 9133 'isHexDigit_1': new MethodTrampoline(1, (Parser target, arg0) => target.isHexD igit(arg0)),
8941 'isInitializedVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => target.isInitializedVariableDeclaration()), 9134 'isInitializedVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => target.isInitializedVariableDeclaration()),
8942 'isLinkText_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target. isLinkText(arg0, arg1)), 9135 'isLinkText_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target. isLinkText(arg0, arg1)),
8943 'isOperator_1': new MethodTrampoline(1, (Parser target, arg0) => target.isOper ator(arg0)), 9136 'isOperator_1': new MethodTrampoline(1, (Parser target, arg0) => target.isOper ator(arg0)),
8944 'isSwitchMember_0': new MethodTrampoline(0, (Parser target) => target.isSwitch Member()), 9137 'isSwitchMember_0': new MethodTrampoline(0, (Parser target) => target.isSwitch Member()),
9138 'isTypedIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => target .isTypedIdentifier(arg0)),
8945 'lexicallyFirst_1': new MethodTrampoline(1, (Parser target, arg0) => target.le xicallyFirst(arg0)), 9139 'lexicallyFirst_1': new MethodTrampoline(1, (Parser target, arg0) => target.le xicallyFirst(arg0)),
8946 'matches_1': new MethodTrampoline(1, (Parser target, arg0) => target.matches(a rg0)), 9140 'matches_1': new MethodTrampoline(1, (Parser target, arg0) => target.matches(a rg0)),
8947 'matches_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.mat ches3(arg0, arg1)), 9141 'matches_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.mat ches3(arg0, arg1)),
8948 'matchesAny_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target. matchesAny(arg0, arg1)), 9142 'matchesAny_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target. matchesAny(arg0, arg1)),
8949 'matchesIdentifier_0': new MethodTrampoline(0, (Parser target) => target.match esIdentifier()), 9143 'matchesIdentifier_0': new MethodTrampoline(0, (Parser target) => target.match esIdentifier()),
8950 'matchesIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => target .matchesIdentifier2(arg0)), 9144 'matchesIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => target .matchesIdentifier2(arg0)),
8951 'optional_1': new MethodTrampoline(1, (Parser target, arg0) => target.optional (arg0)), 9145 'optional_1': new MethodTrampoline(1, (Parser target, arg0) => target.optional (arg0)),
8952 'parseAdditiveExpression_0': new MethodTrampoline(0, (Parser target) => target .parseAdditiveExpression()), 9146 'parseAdditiveExpression_0': new MethodTrampoline(0, (Parser target) => target .parseAdditiveExpression()),
8953 'parseAnnotation_0': new MethodTrampoline(0, (Parser target) => target.parseAn notation()), 9147 'parseAnnotation_0': new MethodTrampoline(0, (Parser target) => target.parseAn notation()),
8954 'parseArgument_0': new MethodTrampoline(0, (Parser target) => target.parseArgu ment()), 9148 'parseArgument_0': new MethodTrampoline(0, (Parser target) => target.parseArgu ment()),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
9012 'parseListLiteral_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => t arget.parseListLiteral(arg0, arg1)), 9206 'parseListLiteral_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => t arget.parseListLiteral(arg0, arg1)),
9013 'parseListOrMapLiteral_1': new MethodTrampoline(1, (Parser target, arg0) => ta rget.parseListOrMapLiteral(arg0)), 9207 'parseListOrMapLiteral_1': new MethodTrampoline(1, (Parser target, arg0) => ta rget.parseListOrMapLiteral(arg0)),
9014 'parseLogicalAndExpression_0': new MethodTrampoline(0, (Parser target) => targ et.parseLogicalAndExpression()), 9208 'parseLogicalAndExpression_0': new MethodTrampoline(0, (Parser target) => targ et.parseLogicalAndExpression()),
9015 'parseLogicalOrExpression_0': new MethodTrampoline(0, (Parser target) => targe t.parseLogicalOrExpression()), 9209 'parseLogicalOrExpression_0': new MethodTrampoline(0, (Parser target) => targe t.parseLogicalOrExpression()),
9016 'parseMapLiteral_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => ta rget.parseMapLiteral(arg0, arg1)), 9210 'parseMapLiteral_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => ta rget.parseMapLiteral(arg0, arg1)),
9017 'parseMapLiteralEntry_0': new MethodTrampoline(0, (Parser target) => target.pa rseMapLiteralEntry()), 9211 'parseMapLiteralEntry_0': new MethodTrampoline(0, (Parser target) => target.pa rseMapLiteralEntry()),
9018 'parseMethodDeclaration_4': new MethodTrampoline(4, (Parser target, arg0, arg1 , arg2, arg3) => target.parseMethodDeclaration(arg0, arg1, arg2, arg3)), 9212 'parseMethodDeclaration_4': new MethodTrampoline(4, (Parser target, arg0, arg1 , arg2, arg3) => target.parseMethodDeclaration(arg0, arg1, arg2, arg3)),
9019 'parseMethodDeclaration_6': new MethodTrampoline(6, (Parser target, arg0, arg1 , arg2, arg3, arg4, arg5) => target.parseMethodDeclaration2(arg0, arg1, arg2, ar g3, arg4, arg5)), 9213 'parseMethodDeclaration_6': new MethodTrampoline(6, (Parser target, arg0, arg1 , arg2, arg3, arg4, arg5) => target.parseMethodDeclaration2(arg0, arg1, arg2, ar g3, arg4, arg5)),
9020 'parseModifiers_0': new MethodTrampoline(0, (Parser target) => target.parseMod ifiers()), 9214 'parseModifiers_0': new MethodTrampoline(0, (Parser target) => target.parseMod ifiers()),
9021 'parseMultiplicativeExpression_0': new MethodTrampoline(0, (Parser target) => target.parseMultiplicativeExpression()), 9215 'parseMultiplicativeExpression_0': new MethodTrampoline(0, (Parser target) => target.parseMultiplicativeExpression()),
9216 'parseNativeClause_0': new MethodTrampoline(0, (Parser target) => target.parse NativeClause()),
9022 'parseNewExpression_0': new MethodTrampoline(0, (Parser target) => target.pars eNewExpression()), 9217 'parseNewExpression_0': new MethodTrampoline(0, (Parser target) => target.pars eNewExpression()),
9023 'parseNonLabeledStatement_0': new MethodTrampoline(0, (Parser target) => targe t.parseNonLabeledStatement()), 9218 'parseNonLabeledStatement_0': new MethodTrampoline(0, (Parser target) => targe t.parseNonLabeledStatement()),
9024 'parseNormalFormalParameter_0': new MethodTrampoline(0, (Parser target) => tar get.parseNormalFormalParameter()), 9219 'parseNormalFormalParameter_0': new MethodTrampoline(0, (Parser target) => tar get.parseNormalFormalParameter()),
9025 'parseOperator_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) = > target.parseOperator(arg0, arg1, arg2)), 9220 'parseOperator_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) = > target.parseOperator(arg0, arg1, arg2)),
9026 'parseOptionalReturnType_0': new MethodTrampoline(0, (Parser target) => target .parseOptionalReturnType()), 9221 'parseOptionalReturnType_0': new MethodTrampoline(0, (Parser target) => target .parseOptionalReturnType()),
9027 'parsePartDirective_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.parsePartDirective(arg0)), 9222 'parsePartDirective_1': new MethodTrampoline(1, (Parser target, arg0) => targe t.parsePartDirective(arg0)),
9028 'parsePostfixExpression_0': new MethodTrampoline(0, (Parser target) => target. parsePostfixExpression()), 9223 'parsePostfixExpression_0': new MethodTrampoline(0, (Parser target) => target. parsePostfixExpression()),
9029 'parsePrefixedIdentifier_0': new MethodTrampoline(0, (Parser target) => target .parsePrefixedIdentifier()), 9224 'parsePrefixedIdentifier_0': new MethodTrampoline(0, (Parser target) => target .parsePrefixedIdentifier()),
9030 'parsePrimaryExpression_0': new MethodTrampoline(0, (Parser target) => target. parsePrimaryExpression()), 9225 'parsePrimaryExpression_0': new MethodTrampoline(0, (Parser target) => target. parsePrimaryExpression()),
9031 'parseRedirectingConstructorInvocation_0': new MethodTrampoline(0, (Parser tar get) => target.parseRedirectingConstructorInvocation()), 9226 'parseRedirectingConstructorInvocation_0': new MethodTrampoline(0, (Parser tar get) => target.parseRedirectingConstructorInvocation()),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
9086 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), 9281 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelFunction(arg0)),
9087 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), 9282 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelVariable(arg0)),
9088 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTypedef(arg0)),}; 9283 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTypedef(arg0)),};
9089 9284
9090 9285
9091 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj ects, Token tokenStream) { 9286 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj ects, Token tokenStream) {
9092 parser.currentToken = tokenStream; 9287 parser.currentToken = tokenStream;
9093 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length} ']; 9288 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length} '];
9094 return method.invoke(parser, objects); 9289 return method.invoke(parser, objects);
9095 } 9290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698