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

Unified Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 1024313002: Make helper methods in ParserTestCase non-static. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/ast_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 22df3afc9f628cb55891714e5bff1a06c64c8a4e..a89539e14d7406fee3f91691c96b427d4f52b841 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -125,13 +125,13 @@ class AstValidator extends UnifyingAstVisitor<Object> {
@reflectiveTest
class ComplexParserTest extends ParserTestCase {
void test_additiveExpression_normal() {
- BinaryExpression expression = ParserTestCase.parseExpression("x + y - z");
+ BinaryExpression expression = parseExpression("x + y - z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_additiveExpression_noSpaces() {
- BinaryExpression expression = ParserTestCase.parseExpression("i+1");
+ BinaryExpression expression = parseExpression("i+1");
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral,
@@ -139,34 +139,31 @@ class ComplexParserTest extends ParserTestCase {
}
void test_additiveExpression_precedence_multiplicative_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("x * y + z");
+ BinaryExpression expression = parseExpression("x * y + z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_additiveExpression_precedence_multiplicative_left_withSuper() {
- BinaryExpression expression =
- ParserTestCase.parseExpression("super * y - z");
+ BinaryExpression expression = parseExpression("super * y - z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_additiveExpression_precedence_multiplicative_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x + y * z");
+ BinaryExpression expression = parseExpression("x + y * z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.rightOperand);
}
void test_additiveExpression_super() {
- BinaryExpression expression =
- ParserTestCase.parseExpression("super + y - z");
+ BinaryExpression expression = parseExpression("super + y - z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_assignableExpression_arguments_normal_chain() {
- PropertyAccess propertyAccess1 =
- ParserTestCase.parseExpression("a(b)(c).d(e).f");
+ PropertyAccess propertyAccess1 = parseExpression("a(b)(c).d(e).f");
expect(propertyAccess1.propertyName.name, "f");
//
// a(b)(c).d(e)
@@ -200,8 +197,7 @@ class ComplexParserTest extends ParserTestCase {
}
void test_assignmentExpression_compound() {
- AssignmentExpression expression =
- ParserTestCase.parseExpression("x = y = 0");
+ AssignmentExpression expression = parseExpression("x = y = 0");
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftHandSide);
EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression,
@@ -209,8 +205,7 @@ class ComplexParserTest extends ParserTestCase {
}
void test_assignmentExpression_indexExpression() {
- AssignmentExpression expression =
- ParserTestCase.parseExpression("x[1] = 0");
+ AssignmentExpression expression = parseExpression("x[1] = 0");
EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression,
IndexExpression, expression.leftHandSide);
EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral,
@@ -218,7 +213,7 @@ class ComplexParserTest extends ParserTestCase {
}
void test_assignmentExpression_prefixedIdentifier() {
- AssignmentExpression expression = ParserTestCase.parseExpression("x.y = 0");
+ AssignmentExpression expression = parseExpression("x.y = 0");
EngineTestCase.assertInstanceOf((obj) => obj is PrefixedIdentifier,
PrefixedIdentifier, expression.leftHandSide);
EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral,
@@ -226,8 +221,7 @@ class ComplexParserTest extends ParserTestCase {
}
void test_assignmentExpression_propertyAccess() {
- AssignmentExpression expression =
- ParserTestCase.parseExpression("super.y = 0");
+ AssignmentExpression expression = parseExpression("super.y = 0");
EngineTestCase.assertInstanceOf((obj) => obj is PropertyAccess,
PropertyAccess, expression.leftHandSide);
EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral,
@@ -235,83 +229,80 @@ class ComplexParserTest extends ParserTestCase {
}
void test_bitwiseAndExpression_normal() {
- BinaryExpression expression = ParserTestCase.parseExpression("x & y & z");
+ BinaryExpression expression = parseExpression("x & y & z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_bitwiseAndExpression_precedence_equality_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("x == y && z");
+ BinaryExpression expression = parseExpression("x == y && z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_bitwiseAndExpression_precedence_equality_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x && y == z");
+ BinaryExpression expression = parseExpression("x && y == z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.rightOperand);
}
void test_bitwiseAndExpression_super() {
- BinaryExpression expression =
- ParserTestCase.parseExpression("super & y & z");
+ BinaryExpression expression = parseExpression("super & y & z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_bitwiseOrExpression_normal() {
- BinaryExpression expression = ParserTestCase.parseExpression("x | y | z");
+ BinaryExpression expression = parseExpression("x | y | z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_bitwiseOrExpression_precedence_xor_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("x ^ y | z");
+ BinaryExpression expression = parseExpression("x ^ y | z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_bitwiseOrExpression_precedence_xor_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x | y ^ z");
+ BinaryExpression expression = parseExpression("x | y ^ z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.rightOperand);
}
void test_bitwiseOrExpression_super() {
- BinaryExpression expression =
- ParserTestCase.parseExpression("super | y | z");
+ BinaryExpression expression = parseExpression("super | y | z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_bitwiseXorExpression_normal() {
- BinaryExpression expression = ParserTestCase.parseExpression("x ^ y ^ z");
+ BinaryExpression expression = parseExpression("x ^ y ^ z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_bitwiseXorExpression_precedence_and_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("x & y ^ z");
+ BinaryExpression expression = parseExpression("x & y ^ z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_bitwiseXorExpression_precedence_and_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x ^ y & z");
+ BinaryExpression expression = parseExpression("x ^ y & z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.rightOperand);
}
void test_bitwiseXorExpression_super() {
- BinaryExpression expression =
- ParserTestCase.parseExpression("super ^ y ^ z");
+ BinaryExpression expression = parseExpression("super ^ y ^ z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_cascade_withAssignment() {
CascadeExpression cascade =
- ParserTestCase.parseExpression("new Map()..[3] = 4 ..[0] = 11;");
+ parseExpression("new Map()..[3] = 4 ..[0] = 11;");
Expression target = cascade.target;
for (Expression section in cascade.cascadeSections) {
EngineTestCase.assertInstanceOf(
@@ -326,8 +317,7 @@ class ComplexParserTest extends ParserTestCase {
}
void test_conditionalExpression_precedence_logicalOrExpression() {
- ConditionalExpression expression =
- ParserTestCase.parseExpression("a | b ? y : z");
+ ConditionalExpression expression = parseExpression("a | b ? y : z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.condition);
}
@@ -344,65 +334,63 @@ class C {
}
void test_equalityExpression_normal() {
- BinaryExpression expression = ParserTestCase.parseExpression(
+ BinaryExpression expression = parseExpression(
"x == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_equalityExpression_precedence_relational_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("x is y == z");
+ BinaryExpression expression = parseExpression("x is y == z");
EngineTestCase.assertInstanceOf(
(obj) => obj is IsExpression, IsExpression, expression.leftOperand);
}
void test_equalityExpression_precedence_relational_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x == y is z");
+ BinaryExpression expression = parseExpression("x == y is z");
EngineTestCase.assertInstanceOf(
(obj) => obj is IsExpression, IsExpression, expression.rightOperand);
}
void test_equalityExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "super == y != z", [
- ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND
- ]);
+ BinaryExpression expression = parseExpression("super == y != z",
+ [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_logicalAndExpression() {
- BinaryExpression expression = ParserTestCase.parseExpression("x && y && z");
+ BinaryExpression expression = parseExpression("x && y && z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_logicalAndExpression_precedence_bitwiseOr_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("x | y < z");
+ BinaryExpression expression = parseExpression("x | y < z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_logicalAndExpression_precedence_bitwiseOr_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x < y | z");
+ BinaryExpression expression = parseExpression("x < y | z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.rightOperand);
}
void test_logicalOrExpression() {
- BinaryExpression expression = ParserTestCase.parseExpression("x || y || z");
+ BinaryExpression expression = parseExpression("x || y || z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_logicalOrExpression_precedence_logicalAnd_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("x && y || z");
+ BinaryExpression expression = parseExpression("x && y || z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_logicalOrExpression_precedence_logicalAnd_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x || y && z");
+ BinaryExpression expression = parseExpression("x || y && z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.rightOperand);
}
@@ -416,57 +404,55 @@ class C {
}
void test_multiplicativeExpression_normal() {
- BinaryExpression expression = ParserTestCase.parseExpression("x * y / z");
+ BinaryExpression expression = parseExpression("x * y / z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_multiplicativeExpression_precedence_unary_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("-x * y");
+ BinaryExpression expression = parseExpression("-x * y");
EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression,
PrefixExpression, expression.leftOperand);
}
void test_multiplicativeExpression_precedence_unary_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x * -y");
+ BinaryExpression expression = parseExpression("x * -y");
EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression,
PrefixExpression, expression.rightOperand);
}
void test_multiplicativeExpression_super() {
- BinaryExpression expression =
- ParserTestCase.parseExpression("super * y / z");
+ BinaryExpression expression = parseExpression("super * y / z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_relationalExpression_precedence_shift_right() {
- IsExpression expression = ParserTestCase.parseExpression("x << y is z");
+ IsExpression expression = parseExpression("x << y is z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.expression);
}
void test_shiftExpression_normal() {
- BinaryExpression expression = ParserTestCase.parseExpression("x >> 4 << 3");
+ BinaryExpression expression = parseExpression("x >> 4 << 3");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_shiftExpression_precedence_additive_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("x + y << z");
+ BinaryExpression expression = parseExpression("x + y << z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
void test_shiftExpression_precedence_additive_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("x << y + z");
+ BinaryExpression expression = parseExpression("x << y + z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.rightOperand);
}
void test_shiftExpression_super() {
- BinaryExpression expression =
- ParserTestCase.parseExpression("super >> 4 << 3");
+ BinaryExpression expression = parseExpression("super >> 4 << 3");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
BinaryExpression, expression.leftOperand);
}
@@ -489,27 +475,28 @@ class ErrorParserTest extends ParserTestCase {
// literals that are being created are not always zero length (because they
// could have type parameters), which violates the contract of
// isSynthetic().
- TypedLiteral literal = ParserTestCase.parse3("parseListOrMapLiteral",
- <Object>[null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]);
+ TypedLiteral literal = parse3("parseListOrMapLiteral", <Object>[null], "1",
+ [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]);
expect(literal.isSynthetic, isTrue);
}
void fail_illegalAssignmentToNonAssignable_superAssigned() {
// TODO(brianwilkerson) When this test starts to pass, remove the test
// test_illegalAssignmentToNonAssignable_superAssigned.
- ParserTestCase.parseExpression(
+ parseExpression(
"super = x;", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
void fail_invalidCommentReference__new_nonIdentifier() {
// This test fails because the method parseCommentReference returns null.
- ParserTestCase.parse3("parseCommentReference", <Object>["new 42", 0], "", [
- ParserErrorCode.INVALID_COMMENT_REFERENCE
- ]);
+ parse3("parseCommentReference", <Object>[
+ "new 42",
+ 0
+ ], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
}
void fail_invalidCommentReference__new_tooMuch() {
- ParserTestCase.parse3("parseCommentReference", <Object>[
+ parse3("parseCommentReference", <Object>[
"new a.b.c.d",
0
], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
@@ -517,24 +504,25 @@ class ErrorParserTest extends ParserTestCase {
void fail_invalidCommentReference__nonNew_nonIdentifier() {
// This test fails because the method parseCommentReference returns null.
- ParserTestCase.parse3("parseCommentReference", <Object>["42", 0], "", [
- ParserErrorCode.INVALID_COMMENT_REFERENCE
- ]);
+ parse3("parseCommentReference", <Object>[
+ "42",
+ 0
+ ], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
}
void fail_invalidCommentReference__nonNew_tooMuch() {
- ParserTestCase.parse3("parseCommentReference", <Object>["a.b.c.d", 0], "", [
- ParserErrorCode.INVALID_COMMENT_REFERENCE
- ]);
+ parse3("parseCommentReference", <Object>[
+ "a.b.c.d",
+ 0
+ ], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
}
void fail_missingClosingParenthesis() {
// It is possible that it is not possible to generate this error (that it's
// being reported in code that cannot actually be reached), but that hasn't
// been proven yet.
- ParserTestCase.parse4("parseFormalParameterList", "(int a, int b ;", [
- ParserErrorCode.MISSING_CLOSING_PARENTHESIS
- ]);
+ parse4("parseFormalParameterList", "(int a, int b ;",
+ [ParserErrorCode.MISSING_CLOSING_PARENTHESIS]);
}
void fail_missingFunctionParameters_local_nonVoid_block() {
@@ -554,8 +542,8 @@ class ErrorParserTest extends ParserTestCase {
}
void fail_namedFunctionExpression() {
- Expression expression = ParserTestCase.parse4("parsePrimaryExpression",
- "f() {}", [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
+ Expression expression = parse4("parsePrimaryExpression", "f() {}",
+ [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
EngineTestCase.assertInstanceOf(
(obj) => obj is FunctionExpression, FunctionExpression, expression);
}
@@ -563,7 +551,7 @@ class ErrorParserTest extends ParserTestCase {
void fail_unexpectedToken_invalidPostfixExpression() {
// Note: this might not be the right error to produce, but some error should
// be produced
- ParserTestCase.parseExpression("f()++", [ParserErrorCode.UNEXPECTED_TOKEN]);
+ parseExpression("f()++", [ParserErrorCode.UNEXPECTED_TOKEN]);
}
void fail_varAndType_local() {
@@ -575,39 +563,33 @@ class ErrorParserTest extends ParserTestCase {
void fail_varAndType_parameter() {
// This is currently reporting EXPECTED_TOKEN for a missing semicolon, but
// this would be a better error message.
- ParserTestCase.parse4("parseFormalParameterList", "(var int x)", [
- ParserErrorCode.VAR_AND_TYPE
- ]);
+ parse4("parseFormalParameterList", "(var int x)",
+ [ParserErrorCode.VAR_AND_TYPE]);
}
void test_abstractClassMember_constructor() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "abstract C.c();", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
+ parse3("parseClassMember", <Object>["C"], "abstract C.c();",
+ [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
}
void test_abstractClassMember_field() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "abstract C f;", [
- ParserErrorCode.ABSTRACT_CLASS_MEMBER
- ]);
+ parse3("parseClassMember", <Object>["C"], "abstract C f;",
+ [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
}
void test_abstractClassMember_getter() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "abstract get m;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
+ parse3("parseClassMember", <Object>["C"], "abstract get m;",
+ [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
}
void test_abstractClassMember_method() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "abstract m();", [
- ParserErrorCode.ABSTRACT_CLASS_MEMBER
- ]);
+ parse3("parseClassMember", <Object>["C"], "abstract m();",
+ [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
}
void test_abstractClassMember_setter() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "abstract set m(v);", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
+ parse3("parseClassMember", <Object>["C"], "abstract set m(v);",
+ [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
}
void test_abstractEnum() {
@@ -641,62 +623,54 @@ class ErrorParserTest extends ParserTestCase {
}
void test_annotationOnEnumConstant_first() {
- ParserTestCase.parseCompilationUnit("enum E { @override C }", [
- ParserErrorCode.ANNOTATION_ON_ENUM_CONSTANT
- ]);
+ ParserTestCase.parseCompilationUnit("enum E { @override C }",
+ [ParserErrorCode.ANNOTATION_ON_ENUM_CONSTANT]);
}
void test_annotationOnEnumConstant_middle() {
- ParserTestCase.parseCompilationUnit("enum E { C, @override D, E }", [
- ParserErrorCode.ANNOTATION_ON_ENUM_CONSTANT
- ]);
+ ParserTestCase.parseCompilationUnit("enum E { C, @override D, E }",
+ [ParserErrorCode.ANNOTATION_ON_ENUM_CONSTANT]);
}
void test_assertDoesNotTakeAssignment() {
- ParserTestCase.parse4("parseAssertStatement", "assert(b = true);", [
- ParserErrorCode.ASSERT_DOES_NOT_TAKE_ASSIGNMENT
- ]);
+ parse4("parseAssertStatement", "assert(b = true);",
+ [ParserErrorCode.ASSERT_DOES_NOT_TAKE_ASSIGNMENT]);
}
void test_assertDoesNotTakeCascades() {
- ParserTestCase.parse4("parseAssertStatement", "assert(new A()..m());", [
- ParserErrorCode.ASSERT_DOES_NOT_TAKE_CASCADE
- ]);
+ parse4("parseAssertStatement", "assert(new A()..m());",
+ [ParserErrorCode.ASSERT_DOES_NOT_TAKE_CASCADE]);
}
void test_assertDoesNotTakeRethrow() {
- ParserTestCase.parse4("parseAssertStatement", "assert(rethrow);", [
- ParserErrorCode.ASSERT_DOES_NOT_TAKE_RETHROW
- ]);
+ parse4("parseAssertStatement", "assert(rethrow);",
+ [ParserErrorCode.ASSERT_DOES_NOT_TAKE_RETHROW]);
}
void test_assertDoesNotTakeThrow() {
- ParserTestCase.parse4("parseAssertStatement", "assert(throw x);", [
- ParserErrorCode.ASSERT_DOES_NOT_TAKE_THROW
- ]);
+ parse4("parseAssertStatement", "assert(throw x);",
+ [ParserErrorCode.ASSERT_DOES_NOT_TAKE_THROW]);
}
void test_breakOutsideOfLoop_breakInDoStatement() {
- ParserTestCase.parse4("parseDoStatement", "do {break;} while (x);");
+ parse4("parseDoStatement", "do {break;} while (x);");
}
void test_breakOutsideOfLoop_breakInForStatement() {
- ParserTestCase.parse4("parseForStatement", "for (; x;) {break;}");
+ parse4("parseForStatement", "for (; x;) {break;}");
}
void test_breakOutsideOfLoop_breakInIfStatement() {
- ParserTestCase.parse4("parseIfStatement", "if (x) {break;}", [
- ParserErrorCode.BREAK_OUTSIDE_OF_LOOP
- ]);
+ parse4("parseIfStatement", "if (x) {break;}",
+ [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
}
void test_breakOutsideOfLoop_breakInSwitchStatement() {
- ParserTestCase.parse4(
- "parseSwitchStatement", "switch (x) {case 1: break;}");
+ parse4("parseSwitchStatement", "switch (x) {case 1: break;}");
}
void test_breakOutsideOfLoop_breakInWhileStatement() {
- ParserTestCase.parse4("parseWhileStatement", "while (x) {break;}");
+ parse4("parseWhileStatement", "while (x) {break;}");
}
void test_breakOutsideOfLoop_functionExpression_inALoop() {
@@ -721,9 +695,8 @@ class ErrorParserTest extends ParserTestCase {
void test_classTypeAlias_abstractAfterEq() {
// This syntax has been removed from the language in favor of
// "abstract class A = B with C;" (issue 18098).
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "class A = abstract B with C;", [
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "class A = abstract B with C;", [
ParserErrorCode.EXPECTED_TOKEN,
ParserErrorCode.EXPECTED_TOKEN
]);
@@ -735,15 +708,13 @@ class ErrorParserTest extends ParserTestCase {
}
void test_constAndFinal() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "const final int x;", [ParserErrorCode.CONST_AND_FINAL]);
+ parse3("parseClassMember", <Object>["C"], "const final int x;",
+ [ParserErrorCode.CONST_AND_FINAL]);
}
void test_constAndVar() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "const var x;", [
- ParserErrorCode.CONST_AND_VAR
- ]);
+ parse3("parseClassMember", <Object>["C"], "const var x;",
+ [ParserErrorCode.CONST_AND_VAR]);
}
void test_constClass() {
@@ -752,9 +723,8 @@ class ErrorParserTest extends ParserTestCase {
}
void test_constConstructorWithBody() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "const C() {}", [
- ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY
- ]);
+ parse3("parseClassMember", <Object>["C"], "const C() {}",
+ [ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY]);
}
void test_constEnum() {
@@ -763,27 +733,23 @@ class ErrorParserTest extends ParserTestCase {
}
void test_constFactory() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "const factory C() {}", [ParserErrorCode.CONST_FACTORY]);
+ parse3("parseClassMember", <Object>["C"], "const factory C() {}",
+ [ParserErrorCode.CONST_FACTORY]);
}
void test_constMethod() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "const int m() {}", [ParserErrorCode.CONST_METHOD]);
+ parse3("parseClassMember", <Object>["C"], "const int m() {}",
+ [ParserErrorCode.CONST_METHOD]);
}
void test_constructorWithReturnType() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "C C() {}", [
- ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE
- ]);
+ parse3("parseClassMember", <Object>["C"], "C C() {}",
+ [ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]);
}
void test_constructorWithReturnType_var() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "var C() {}", [
- ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE
- ]);
+ parse3("parseClassMember", <Object>["C"], "var C() {}",
+ [ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]);
}
void test_constTypedef() {
@@ -792,32 +758,29 @@ class ErrorParserTest extends ParserTestCase {
}
void test_continueOutsideOfLoop_continueInDoStatement() {
- ParserTestCase.parse4("parseDoStatement", "do {continue;} while (x);");
+ parse4("parseDoStatement", "do {continue;} while (x);");
}
void test_continueOutsideOfLoop_continueInForStatement() {
- ParserTestCase.parse4("parseForStatement", "for (; x;) {continue;}");
+ parse4("parseForStatement", "for (; x;) {continue;}");
}
void test_continueOutsideOfLoop_continueInIfStatement() {
- ParserTestCase.parse4("parseIfStatement", "if (x) {continue;}", [
- ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP
- ]);
+ parse4("parseIfStatement", "if (x) {continue;}",
+ [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
}
void test_continueOutsideOfLoop_continueInSwitchStatement() {
- ParserTestCase.parse4(
- "parseSwitchStatement", "switch (x) {case 1: continue a;}");
+ parse4("parseSwitchStatement", "switch (x) {case 1: continue a;}");
}
void test_continueOutsideOfLoop_continueInWhileStatement() {
- ParserTestCase.parse4("parseWhileStatement", "while (x) {continue;}");
+ parse4("parseWhileStatement", "while (x) {continue;}");
}
void test_continueOutsideOfLoop_functionExpression_inALoop() {
- ParserTestCase.parseStatement("for(; x;) {() {continue;};}", [
- ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP
- ]);
+ ParserTestCase.parseStatement("for(; x;) {() {continue;};}",
+ [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
}
void test_continueOutsideOfLoop_functionExpression_withALoop() {
@@ -825,19 +788,16 @@ class ErrorParserTest extends ParserTestCase {
}
void test_continueWithoutLabelInCase_error() {
- ParserTestCase.parse4("parseSwitchStatement",
- "switch (x) {case 1: continue;}", [
- ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE
- ]);
+ parse4("parseSwitchStatement", "switch (x) {case 1: continue;}",
+ [ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE]);
}
void test_continueWithoutLabelInCase_noError() {
- ParserTestCase.parse4(
- "parseSwitchStatement", "switch (x) {case 1: continue a;}");
+ parse4("parseSwitchStatement", "switch (x) {case 1: continue a;}");
}
void test_continueWithoutLabelInCase_noError_switchInLoop() {
- ParserTestCase.parse4(
+ parse4(
"parseWhileStatement", "while (a) { switch (b) {default: continue;}}");
}
@@ -847,74 +807,63 @@ class ErrorParserTest extends ParserTestCase {
}
void test_deprecatedClassTypeAlias_withGeneric() {
- ParserTestCase.parseCompilationUnit("typedef C<T> = S<T> with M;", [
- ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS
- ]);
+ ParserTestCase.parseCompilationUnit("typedef C<T> = S<T> with M;",
+ [ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]);
}
void test_directiveAfterDeclaration_classBeforeDirective() {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(
- "class Foo{} library l;", [
- ParserErrorCode.DIRECTIVE_AFTER_DECLARATION
- ]);
+ "class Foo{} library l;",
+ [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
expect(unit, isNotNull);
}
void test_directiveAfterDeclaration_classBetweenDirectives() {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(
- "library l;\nclass Foo{}\npart 'a.dart';", [
- ParserErrorCode.DIRECTIVE_AFTER_DECLARATION
- ]);
+ "library l;\nclass Foo{}\npart 'a.dart';",
+ [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
expect(unit, isNotNull);
}
void test_duplicatedModifier_const() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "const const m;", [
- ParserErrorCode.DUPLICATED_MODIFIER
- ]);
+ parse3("parseClassMember", <Object>["C"], "const const m;",
+ [ParserErrorCode.DUPLICATED_MODIFIER]);
}
void test_duplicatedModifier_external() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external external f();", [ParserErrorCode.DUPLICATED_MODIFIER]);
+ parse3("parseClassMember", <Object>["C"], "external external f();",
+ [ParserErrorCode.DUPLICATED_MODIFIER]);
}
void test_duplicatedModifier_factory() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "factory factory C() {}", [ParserErrorCode.DUPLICATED_MODIFIER]);
+ parse3("parseClassMember", <Object>["C"], "factory factory C() {}",
+ [ParserErrorCode.DUPLICATED_MODIFIER]);
}
void test_duplicatedModifier_final() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "final final m;", [
- ParserErrorCode.DUPLICATED_MODIFIER
- ]);
+ parse3("parseClassMember", <Object>["C"], "final final m;",
+ [ParserErrorCode.DUPLICATED_MODIFIER]);
}
void test_duplicatedModifier_static() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "static static var m;", [ParserErrorCode.DUPLICATED_MODIFIER]);
+ parse3("parseClassMember", <Object>["C"], "static static var m;",
+ [ParserErrorCode.DUPLICATED_MODIFIER]);
}
void test_duplicatedModifier_var() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "var var m;", [
- ParserErrorCode.DUPLICATED_MODIFIER
- ]);
+ parse3("parseClassMember", <Object>["C"], "var var m;",
+ [ParserErrorCode.DUPLICATED_MODIFIER]);
}
void test_duplicateLabelInSwitchStatement() {
- ParserTestCase.parse4("parseSwitchStatement",
- "switch (e) {l1: case 0: break; l1: case 1: break;}", [
- ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT
- ]);
+ parse4("parseSwitchStatement",
+ "switch (e) {l1: case 0: break; l1: case 1: break;}",
+ [ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT]);
}
void test_emptyEnumBody() {
- ParserTestCase.parse3("parseEnumDeclaration", <Object>[
- emptyCommentAndMetadata()
- ], "enum E {}", [ParserErrorCode.EMPTY_ENUM_BODY]);
+ parse3("parseEnumDeclaration", <Object>[emptyCommentAndMetadata()],
+ "enum E {}", [ParserErrorCode.EMPTY_ENUM_BODY]);
}
void test_enumInClass() {
@@ -928,72 +877,64 @@ class Foo {
}
void test_equalityCannotBeEqualityOperand_eq_eq() {
- ParserTestCase.parseExpression(
+ parseExpression(
"1 == 2 == 3", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
}
void test_equalityCannotBeEqualityOperand_eq_neq() {
- ParserTestCase.parseExpression(
+ parseExpression(
"1 == 2 != 3", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
}
void test_equalityCannotBeEqualityOperand_neq_eq() {
- ParserTestCase.parseExpression(
+ parseExpression(
"1 != 2 == 3", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
}
void test_expectedCaseOrDefault() {
- ParserTestCase.parse4("parseSwitchStatement", "switch (e) {break;}", [
- ParserErrorCode.EXPECTED_CASE_OR_DEFAULT
- ]);
+ parse4("parseSwitchStatement", "switch (e) {break;}",
+ [ParserErrorCode.EXPECTED_CASE_OR_DEFAULT]);
}
void test_expectedClassMember_inClass_afterType() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "heart 2 heart", [
- ParserErrorCode.EXPECTED_CLASS_MEMBER
- ]);
+ parse3("parseClassMember", <Object>["C"], "heart 2 heart",
+ [ParserErrorCode.EXPECTED_CLASS_MEMBER]);
}
void test_expectedClassMember_inClass_beforeType() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "4 score", [
- ParserErrorCode.EXPECTED_CLASS_MEMBER
- ]);
+ parse3("parseClassMember", <Object>["C"], "4 score",
+ [ParserErrorCode.EXPECTED_CLASS_MEMBER]);
}
void test_expectedExecutable_inClass_afterVoid() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "void 2 void", [
- ParserErrorCode.EXPECTED_EXECUTABLE
- ]);
+ parse3("parseClassMember", <Object>["C"], "void 2 void",
+ [ParserErrorCode.EXPECTED_EXECUTABLE]);
}
void test_expectedExecutable_topLevel_afterType() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "heart 2 heart", [ParserErrorCode.EXPECTED_EXECUTABLE]);
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "heart 2 heart", [ParserErrorCode.EXPECTED_EXECUTABLE]);
}
void test_expectedExecutable_topLevel_afterVoid() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "void 2 void", [ParserErrorCode.EXPECTED_EXECUTABLE]);
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "void 2 void", [ParserErrorCode.EXPECTED_EXECUTABLE]);
}
void test_expectedExecutable_topLevel_beforeType() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "4 score", [ParserErrorCode.EXPECTED_EXECUTABLE]);
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "4 score", [ParserErrorCode.EXPECTED_EXECUTABLE]);
}
void test_expectedExecutable_topLevel_eof() {
- ParserTestCase.parse2("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "x", [
+ parse2("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "x", [
new AnalysisError.con2(null, 0, 1, ParserErrorCode.EXPECTED_EXECUTABLE)
]);
}
void test_expectedInterpolationIdentifier() {
- ParserTestCase.parse4(
+ parse4(
"parseStringLiteral", "'\$x\$'", [ParserErrorCode.MISSING_IDENTIFIER]);
}
@@ -1001,20 +942,19 @@ class Foo {
// The scanner inserts an empty string token between the two $'s; we need to
// make sure that the MISSING_IDENTIFIER error that is generated has a
// nonzero width so that it will show up in the editor UI.
- ParserTestCase.parse2("parseStringLiteral", <Object>[], "'\$\$foo'", [
+ parse2("parseStringLiteral", <Object>[], "'\$\$foo'", [
new AnalysisError.con2(null, 2, 1, ParserErrorCode.MISSING_IDENTIFIER)
]);
}
void test_expectedStringLiteral() {
- StringLiteral expression = ParserTestCase.parse4(
+ StringLiteral expression = parse4(
"parseStringLiteral", "1", [ParserErrorCode.EXPECTED_STRING_LITERAL]);
expect(expression.isSynthetic, isTrue);
}
void test_expectedToken_commaMissingInArgumentList() {
- ParserTestCase.parse4(
- "parseArgumentList", "(x, y z)", [ParserErrorCode.EXPECTED_TOKEN]);
+ parse4("parseArgumentList", "(x, y z)", [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_expectedToken_parseStatement_afterVoid() {
@@ -1026,7 +966,7 @@ class Foo {
void test_expectedToken_semicolonAfterClass() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
- ParserTestCase.parse3("parseClassTypeAlias", <Object>[
+ parse3("parseClassTypeAlias", <Object>[
emptyCommentAndMetadata(),
null,
token
@@ -1061,32 +1001,27 @@ class Foo {
}
void test_expectedTypeName_is() {
- ParserTestCase.parseExpression(
- "x is", [ParserErrorCode.EXPECTED_TYPE_NAME]);
+ parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]);
}
void test_exportDirectiveAfterPartDirective() {
- ParserTestCase.parseCompilationUnit("part 'a.dart'; export 'b.dart';", [
- ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE
- ]);
+ ParserTestCase.parseCompilationUnit("part 'a.dart'; export 'b.dart';",
+ [ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]);
}
void test_externalAfterConst() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "const external C();", [ParserErrorCode.EXTERNAL_AFTER_CONST]);
+ parse3("parseClassMember", <Object>["C"], "const external C();",
+ [ParserErrorCode.EXTERNAL_AFTER_CONST]);
}
void test_externalAfterFactory() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "factory external C();", [ParserErrorCode.EXTERNAL_AFTER_FACTORY]);
+ parse3("parseClassMember", <Object>["C"], "factory external C();",
+ [ParserErrorCode.EXTERNAL_AFTER_FACTORY]);
}
void test_externalAfterStatic() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "static external int m();", [ParserErrorCode.EXTERNAL_AFTER_STATIC]);
+ parse3("parseClassMember", <Object>["C"], "static external int m();",
+ [ParserErrorCode.EXTERNAL_AFTER_STATIC]);
}
void test_externalClass() {
@@ -1095,17 +1030,13 @@ class Foo {
}
void test_externalConstructorWithBody_factory() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external factory C() {}", [
- ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY
- ]);
+ parse3("parseClassMember", <Object>["C"], "external factory C() {}",
+ [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
}
void test_externalConstructorWithBody_named() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external C.c() {}", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
+ parse3("parseClassMember", <Object>["C"], "external C.c() {}",
+ [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
}
void test_externalEnum() {
@@ -1114,61 +1045,49 @@ class Foo {
}
void test_externalField_const() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external const A f;", [ParserErrorCode.EXTERNAL_FIELD]);
+ parse3("parseClassMember", <Object>["C"], "external const A f;",
+ [ParserErrorCode.EXTERNAL_FIELD]);
}
void test_externalField_final() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external final A f;", [ParserErrorCode.EXTERNAL_FIELD]);
+ parse3("parseClassMember", <Object>["C"], "external final A f;",
+ [ParserErrorCode.EXTERNAL_FIELD]);
}
void test_externalField_static() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external static A f;", [ParserErrorCode.EXTERNAL_FIELD]);
+ parse3("parseClassMember", <Object>["C"], "external static A f;",
+ [ParserErrorCode.EXTERNAL_FIELD]);
}
void test_externalField_typed() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "external A f;", [
- ParserErrorCode.EXTERNAL_FIELD
- ]);
+ parse3("parseClassMember", <Object>["C"], "external A f;",
+ [ParserErrorCode.EXTERNAL_FIELD]);
}
void test_externalField_untyped() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external var f;", [ParserErrorCode.EXTERNAL_FIELD]);
+ parse3("parseClassMember", <Object>["C"], "external var f;",
+ [ParserErrorCode.EXTERNAL_FIELD]);
}
void test_externalGetterWithBody() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external int get x {}", [ParserErrorCode.EXTERNAL_GETTER_WITH_BODY]);
+ parse3("parseClassMember", <Object>["C"], "external int get x {}",
+ [ParserErrorCode.EXTERNAL_GETTER_WITH_BODY]);
}
void test_externalMethodWithBody() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external m() {}", [ParserErrorCode.EXTERNAL_METHOD_WITH_BODY]);
+ parse3("parseClassMember", <Object>["C"], "external m() {}",
+ [ParserErrorCode.EXTERNAL_METHOD_WITH_BODY]);
}
void test_externalOperatorWithBody() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external operator +(int value) {}", [
- ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY
- ]);
+ parse3("parseClassMember", <Object>["C"],
+ "external operator +(int value) {}",
+ [ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY]);
}
void test_externalSetterWithBody() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "external set x(int value) {}", [
- ParserErrorCode.EXTERNAL_SETTER_WITH_BODY
- ]);
+ parse3("parseClassMember", <Object>["C"], "external set x(int value) {}",
+ [ParserErrorCode.EXTERNAL_SETTER_WITH_BODY]);
}
void test_externalTypedef() {
@@ -1182,32 +1101,28 @@ class Foo {
}
void test_factoryTopLevelDeclaration_typedef() {
- ParserTestCase.parseCompilationUnit("factory typedef F();", [
- ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION
- ]);
+ ParserTestCase.parseCompilationUnit("factory typedef F();",
+ [ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION]);
}
void test_factoryWithInitializers() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "factory C() : x = 3 {}", [ParserErrorCode.FACTORY_WITH_INITIALIZERS]);
+ parse3("parseClassMember", <Object>["C"], "factory C() : x = 3 {}",
+ [ParserErrorCode.FACTORY_WITH_INITIALIZERS]);
}
void test_factoryWithoutBody() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "factory C();", [
- ParserErrorCode.FACTORY_WITHOUT_BODY
- ]);
+ parse3("parseClassMember", <Object>["C"], "factory C();",
+ [ParserErrorCode.FACTORY_WITHOUT_BODY]);
}
void test_fieldInitializerOutsideConstructor() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "void m(this.x);",
+ parse3("parseClassMember", <Object>["C"], "void m(this.x);",
[ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
}
void test_finalAndVar() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "final var x;", [
- ParserErrorCode.FINAL_AND_VAR
- ]);
+ parse3("parseClassMember", <Object>["C"], "final var x;",
+ [ParserErrorCode.FINAL_AND_VAR]);
}
void test_finalClass() {
@@ -1216,9 +1131,8 @@ class Foo {
}
void test_finalConstructor() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "final C() {}", [
- ParserErrorCode.FINAL_CONSTRUCTOR
- ]);
+ parse3("parseClassMember", <Object>["C"], "final C() {}",
+ [ParserErrorCode.FINAL_CONSTRUCTOR]);
}
void test_finalEnum() {
@@ -1227,9 +1141,8 @@ class Foo {
}
void test_finalMethod() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "final int m() {}", [ParserErrorCode.FINAL_METHOD]);
+ parse3("parseClassMember", <Object>["C"], "final int m() {}",
+ [ParserErrorCode.FINAL_METHOD]);
}
void test_finalTypedef() {
@@ -1273,28 +1186,27 @@ class Foo {
}
void test_getterWithParameters() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "int get x() {}", [
- ParserErrorCode.GETTER_WITH_PARAMETERS
- ]);
+ parse3("parseClassMember", <Object>["C"], "int get x() {}",
+ [ParserErrorCode.GETTER_WITH_PARAMETERS]);
}
void test_illegalAssignmentToNonAssignable_postfix_minusMinus_literal() {
- ParserTestCase.parseExpression(
+ parseExpression(
"0--", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
void test_illegalAssignmentToNonAssignable_postfix_plusPlus_literal() {
- ParserTestCase.parseExpression(
+ parseExpression(
"0++", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
void test_illegalAssignmentToNonAssignable_postfix_plusPlus_parethesized() {
- ParserTestCase.parseExpression(
+ parseExpression(
"(x)++", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
void test_illegalAssignmentToNonAssignable_primarySelectorPostfix() {
- ParserTestCase.parseExpression(
+ parseExpression(
"x(y)(z)++", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
@@ -1304,78 +1216,69 @@ class Foo {
// remove this test (there should only be one error generated, but we're
// keeping this test until that time so that we can catch other forms of
// regressions).
- ParserTestCase.parseExpression("super = x;", [
+ parseExpression("super = x;", [
ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR,
ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE
]);
}
void test_implementsBeforeExtends() {
- ParserTestCase.parseCompilationUnit("class A implements B extends C {}", [
- ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS
- ]);
+ ParserTestCase.parseCompilationUnit("class A implements B extends C {}",
+ [ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS]);
}
void test_implementsBeforeWith() {
ParserTestCase.parseCompilationUnit(
- "class A extends B implements C with D {}", [
- ParserErrorCode.IMPLEMENTS_BEFORE_WITH
- ]);
+ "class A extends B implements C with D {}",
+ [ParserErrorCode.IMPLEMENTS_BEFORE_WITH]);
}
void test_importDirectiveAfterPartDirective() {
- ParserTestCase.parseCompilationUnit("part 'a.dart'; import 'b.dart';", [
- ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE
- ]);
+ ParserTestCase.parseCompilationUnit("part 'a.dart'; import 'b.dart';",
+ [ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]);
}
void test_initializedVariableInForEach() {
- ParserTestCase.parse4("parseForStatement", "for (int a = 0 in foo) {}", [
- ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH
- ]);
+ parse4("parseForStatement", "for (int a = 0 in foo) {}",
+ [ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH]);
}
void test_invalidAwaitInFor() {
- ParserTestCase.parse4("parseForStatement", "await for (; ;) {}", [
- ParserErrorCode.INVALID_AWAIT_IN_FOR
- ]);
+ parse4("parseForStatement", "await for (; ;) {}",
+ [ParserErrorCode.INVALID_AWAIT_IN_FOR]);
}
void test_invalidCodePoint() {
- ParserTestCase.parse4("parseStringLiteral", "'\\uD900'", [
- ParserErrorCode.INVALID_CODE_POINT
- ]);
+ parse4("parseStringLiteral", "'\\uD900'",
+ [ParserErrorCode.INVALID_CODE_POINT]);
}
void test_invalidHexEscape_invalidDigit() {
- ParserTestCase.parse4(
+ parse4(
"parseStringLiteral", "'\\x0 a'", [ParserErrorCode.INVALID_HEX_ESCAPE]);
}
void test_invalidHexEscape_tooFewDigits() {
- ParserTestCase.parse4(
+ parse4(
"parseStringLiteral", "'\\x0'", [ParserErrorCode.INVALID_HEX_ESCAPE]);
}
void test_invalidInterpolationIdentifier_startWithDigit() {
- ParserTestCase.parse4(
- "parseStringLiteral", "'\$1'", [ParserErrorCode.MISSING_IDENTIFIER]);
+ parse4("parseStringLiteral", "'\$1'", [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_invalidOperator() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "void operator ===(x) {}", [ParserErrorCode.INVALID_OPERATOR]);
+ parse3("parseClassMember", <Object>["C"], "void operator ===(x) {}",
+ [ParserErrorCode.INVALID_OPERATOR]);
}
void test_invalidOperatorForSuper() {
- ParserTestCase.parse4("parseUnaryExpression", "++super", [
- ParserErrorCode.INVALID_OPERATOR_FOR_SUPER
- ]);
+ parse4("parseUnaryExpression", "++super",
+ [ParserErrorCode.INVALID_OPERATOR_FOR_SUPER]);
}
void test_invalidStarAfterAsync() {
- ParserTestCase.parse3("parseFunctionBody", <Object>[
+ parse3("parseFunctionBody", <Object>[
false,
null,
false
@@ -1383,7 +1286,7 @@ class Foo {
}
void test_invalidSync() {
- ParserTestCase.parse3("parseFunctionBody", <Object>[
+ parse3("parseFunctionBody", <Object>[
false,
null,
false
@@ -1391,72 +1294,62 @@ class Foo {
}
void test_invalidUnicodeEscape_incomplete_noDigits() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u{'", [
- ParserErrorCode.INVALID_UNICODE_ESCAPE
- ]);
+ parse4("parseStringLiteral", "'\\u{'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_incomplete_someDigits() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u{0A'", [
- ParserErrorCode.INVALID_UNICODE_ESCAPE
- ]);
+ parse4("parseStringLiteral", "'\\u{0A'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_invalidDigit() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u0 a'", [
- ParserErrorCode.INVALID_UNICODE_ESCAPE
- ]);
+ parse4("parseStringLiteral", "'\\u0 a'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooFewDigits_fixed() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u04'", [
- ParserErrorCode.INVALID_UNICODE_ESCAPE
- ]);
+ parse4("parseStringLiteral", "'\\u04'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooFewDigits_variable() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u{}'", [
- ParserErrorCode.INVALID_UNICODE_ESCAPE
- ]);
+ parse4("parseStringLiteral", "'\\u{}'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooManyDigits_variable() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u{12345678}'", [
+ parse4("parseStringLiteral", "'\\u{12345678}'", [
ParserErrorCode.INVALID_UNICODE_ESCAPE,
ParserErrorCode.INVALID_CODE_POINT
]);
}
void test_libraryDirectiveNotFirst() {
- ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;", [
- ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST
- ]);
+ ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;",
+ [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
}
void test_libraryDirectiveNotFirst_afterPart() {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(
- "part 'a.dart';\nlibrary l;", [
- ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST
- ]);
+ "part 'a.dart';\nlibrary l;",
+ [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
expect(unit, isNotNull);
}
void test_localFunctionDeclarationModifier_abstract() {
- ParserTestCase.parseStatement("abstract f() {}", [
- ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER
- ]);
+ ParserTestCase.parseStatement("abstract f() {}",
+ [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
}
void test_localFunctionDeclarationModifier_external() {
- ParserTestCase.parseStatement("external f() {}", [
- ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER
- ]);
+ ParserTestCase.parseStatement("external f() {}",
+ [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
}
void test_localFunctionDeclarationModifier_factory() {
- ParserTestCase.parseStatement("factory f() {}", [
- ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER
- ]);
+ ParserTestCase.parseStatement("factory f() {}",
+ [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
}
void test_localFunctionDeclarationModifier_static() {
@@ -1465,36 +1358,34 @@ class Foo {
}
void test_missingAssignableSelector_identifiersAssigned() {
- ParserTestCase.parseExpression("x.y = y;");
+ parseExpression("x.y = y;");
}
void test_missingAssignableSelector_prefix_minusMinus_literal() {
- ParserTestCase.parseExpression(
- "--0", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ parseExpression("--0", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
}
void test_missingAssignableSelector_prefix_plusPlus_literal() {
- ParserTestCase.parseExpression(
- "++0", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ parseExpression("++0", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
}
void test_missingAssignableSelector_selector() {
- ParserTestCase.parseExpression("x(y)(z).a++");
+ parseExpression("x(y)(z).a++");
}
void test_missingAssignableSelector_superPrimaryExpression() {
- SuperExpression expression = ParserTestCase.parse4("parsePrimaryExpression",
- "super", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ SuperExpression expression = parse4("parsePrimaryExpression", "super",
+ [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
expect(expression.superKeyword, isNotNull);
}
void test_missingAssignableSelector_superPropertyAccessAssigned() {
- ParserTestCase.parseExpression("super.x = x;");
+ parseExpression("super.x = x;");
}
void test_missingCatchOrFinally() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement",
- "try {}", [ParserErrorCode.MISSING_CATCH_OR_FINALLY]);
+ TryStatement statement = parse4("parseTryStatement", "try {}",
+ [ParserErrorCode.MISSING_CATCH_OR_FINALLY]);
expect(statement, isNotNull);
}
@@ -1504,37 +1395,32 @@ class Foo {
}
void test_missingConstFinalVarOrType_static() {
- ParserTestCase.parseCompilationUnit("class A { static f; }", [
- ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
- ]);
+ ParserTestCase.parseCompilationUnit("class A { static f; }",
+ [ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
}
void test_missingConstFinalVarOrType_topLevel() {
- ParserTestCase.parse3("parseFinalConstVarOrType", <Object>[false], "a;", [
- ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
- ]);
+ parse3("parseFinalConstVarOrType", <Object>[false], "a;",
+ [ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
}
void test_missingEnumBody() {
- ParserTestCase.parse3("parseEnumDeclaration", <Object>[
- emptyCommentAndMetadata()
- ], "enum E;", [ParserErrorCode.MISSING_ENUM_BODY]);
+ parse3("parseEnumDeclaration", <Object>[emptyCommentAndMetadata()],
+ "enum E;", [ParserErrorCode.MISSING_ENUM_BODY]);
}
void test_missingExpressionInThrow_withCascade() {
- ParserTestCase.parse4("parseThrowExpression", "throw;", [
- ParserErrorCode.MISSING_EXPRESSION_IN_THROW
- ]);
+ parse4("parseThrowExpression", "throw;",
+ [ParserErrorCode.MISSING_EXPRESSION_IN_THROW]);
}
void test_missingExpressionInThrow_withoutCascade() {
- ParserTestCase.parse4("parseThrowExpressionWithoutCascade", "throw;", [
- ParserErrorCode.MISSING_EXPRESSION_IN_THROW
- ]);
+ parse4("parseThrowExpressionWithoutCascade", "throw;",
+ [ParserErrorCode.MISSING_EXPRESSION_IN_THROW]);
}
void test_missingFunctionBody_emptyNotAllowed() {
- ParserTestCase.parse3("parseFunctionBody", <Object>[
+ parse3("parseFunctionBody", <Object>[
false,
ParserErrorCode.MISSING_FUNCTION_BODY,
false
@@ -1542,7 +1428,7 @@ class Foo {
}
void test_missingFunctionBody_invalid() {
- ParserTestCase.parse3("parseFunctionBody", <Object>[
+ parse3("parseFunctionBody", <Object>[
false,
ParserErrorCode.MISSING_FUNCTION_BODY,
false
@@ -1580,48 +1466,43 @@ class Foo {
}
void test_missingIdentifier_afterOperator() {
- ParserTestCase.parse4("parseMultiplicativeExpression", "1 *", [
- ParserErrorCode.MISSING_IDENTIFIER
- ]);
+ parse4("parseMultiplicativeExpression", "1 *",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_beforeClosingCurly() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "int}", [
+ parse3("parseClassMember", <Object>["C"], "int}", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN
]);
}
void test_missingIdentifier_functionDeclaration_returnTypeWithoutName() {
- ParserTestCase.parse4("parseFunctionDeclarationStatement", "A<T> () {}", [
- ParserErrorCode.MISSING_IDENTIFIER
- ]);
+ parse4("parseFunctionDeclarationStatement", "A<T> () {}",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_inEnum() {
- ParserTestCase.parse3("parseEnumDeclaration", <Object>[
- emptyCommentAndMetadata()
- ], "enum E {, TWO}", [ParserErrorCode.MISSING_IDENTIFIER]);
+ parse3("parseEnumDeclaration", <Object>[emptyCommentAndMetadata()],
+ "enum E {, TWO}", [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_inSymbol_afterPeriod() {
- ParserTestCase.parse4(
- "parseSymbolLiteral", "#a.", [ParserErrorCode.MISSING_IDENTIFIER]);
+ parse4("parseSymbolLiteral", "#a.", [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_inSymbol_first() {
- ParserTestCase.parse4(
- "parseSymbolLiteral", "#", [ParserErrorCode.MISSING_IDENTIFIER]);
+ parse4("parseSymbolLiteral", "#", [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_number() {
- SimpleIdentifier expression = ParserTestCase.parse4(
+ SimpleIdentifier expression = parse4(
"parseSimpleIdentifier", "1", [ParserErrorCode.MISSING_IDENTIFIER]);
expect(expression.isSynthetic, isTrue);
}
void test_missingKeywordOperator() {
- ParserTestCase.parse3("parseOperator", <Object>[
+ parse3("parseOperator", <Object>[
emptyCommentAndMetadata(),
null,
null
@@ -1629,33 +1510,28 @@ class Foo {
}
void test_missingKeywordOperator_parseClassMember() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "+() {}", [
- ParserErrorCode.MISSING_KEYWORD_OPERATOR
- ]);
+ parse3("parseClassMember", <Object>["C"], "+() {}",
+ [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
}
void test_missingKeywordOperator_parseClassMember_afterTypeName() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "int +() {}", [
- ParserErrorCode.MISSING_KEYWORD_OPERATOR
- ]);
+ parse3("parseClassMember", <Object>["C"], "int +() {}",
+ [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
}
void test_missingKeywordOperator_parseClassMember_afterVoid() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "void +() {}", [
- ParserErrorCode.MISSING_KEYWORD_OPERATOR
- ]);
+ parse3("parseClassMember", <Object>["C"], "void +() {}",
+ [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
}
void test_missingMethodParameters_void_block() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "void m {} }", [
- ParserErrorCode.MISSING_METHOD_PARAMETERS
- ]);
+ parse3("parseClassMember", <Object>["C"], "void m {} }",
+ [ParserErrorCode.MISSING_METHOD_PARAMETERS]);
}
void test_missingMethodParameters_void_expression() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "void m => null; }", [ParserErrorCode.MISSING_METHOD_PARAMETERS]);
+ parse3("parseClassMember", <Object>["C"], "void m => null; }",
+ [ParserErrorCode.MISSING_METHOD_PARAMETERS]);
}
void test_missingNameInLibraryDirective() {
@@ -1671,13 +1547,12 @@ class Foo {
}
void test_missingPrefixInDeferredImport() {
- ParserTestCase.parseCompilationUnit("import 'foo.dart' deferred;", [
- ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT
- ]);
+ ParserTestCase.parseCompilationUnit("import 'foo.dart' deferred;",
+ [ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT]);
}
void test_missingStartAfterSync() {
- ParserTestCase.parse3("parseFunctionBody", <Object>[
+ parse3("parseFunctionBody", <Object>[
false,
null,
false
@@ -1693,15 +1568,13 @@ class Foo {
}
void test_missingTerminatorForParameterGroup_named() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, {b: 0)", [
- ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP
- ]);
+ parse4("parseFormalParameterList", "(a, {b: 0)",
+ [ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
}
void test_missingTerminatorForParameterGroup_optional() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, [b = 0)", [
- ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP
- ]);
+ parse4("parseFormalParameterList", "(a, [b = 0)",
+ [ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
}
void test_missingTypedefParameters_nonVoid() {
@@ -1720,21 +1593,18 @@ class Foo {
}
void test_missingVariableInForEach() {
- ParserTestCase.parse4("parseForStatement", "for (a < b in foo) {}", [
- ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH
- ]);
+ parse4("parseForStatement", "for (a < b in foo) {}",
+ [ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH]);
}
void test_mixedParameterGroups_namedPositional() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, {b}, [c])", [
- ParserErrorCode.MIXED_PARAMETER_GROUPS
- ]);
+ parse4("parseFormalParameterList", "(a, {b}, [c])",
+ [ParserErrorCode.MIXED_PARAMETER_GROUPS]);
}
void test_mixedParameterGroups_positionalNamed() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, [b], {c})", [
- ParserErrorCode.MIXED_PARAMETER_GROUPS
- ]);
+ parse4("parseFormalParameterList", "(a, [b], {c})",
+ [ParserErrorCode.MIXED_PARAMETER_GROUPS]);
}
void test_mixin_application_lacks_with_clause() {
@@ -1743,9 +1613,8 @@ class Foo {
}
void test_multipleExtendsClauses() {
- ParserTestCase.parseCompilationUnit("class A extends B extends C {}", [
- ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES
- ]);
+ ParserTestCase.parseCompilationUnit("class A extends B extends C {}",
+ [ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES]);
}
void test_multipleImplementsClauses() {
@@ -1759,9 +1628,8 @@ class Foo {
}
void test_multipleNamedParameterGroups() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, {b}, {c})", [
- ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS
- ]);
+ parse4("parseFormalParameterList", "(a, {b}, {c})",
+ [ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS]);
}
void test_multiplePartOfDirectives() {
@@ -1770,39 +1638,33 @@ class Foo {
}
void test_multiplePositionalParameterGroups() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, [b], [c])", [
- ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS
- ]);
+ parse4("parseFormalParameterList", "(a, [b], [c])",
+ [ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS]);
}
void test_multipleVariablesInForEach() {
- ParserTestCase.parse4("parseForStatement", "for (int a, b in foo) {}", [
- ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH
- ]);
+ parse4("parseForStatement", "for (int a, b in foo) {}",
+ [ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH]);
}
void test_multipleWithClauses() {
- ParserTestCase.parseCompilationUnit("class A extends B with C with D {}", [
- ParserErrorCode.MULTIPLE_WITH_CLAUSES
- ]);
+ ParserTestCase.parseCompilationUnit("class A extends B with C with D {}",
+ [ParserErrorCode.MULTIPLE_WITH_CLAUSES]);
}
void test_namedParameterOutsideGroup() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, b : 0)", [
- ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP
- ]);
+ parse4("parseFormalParameterList", "(a, b : 0)",
+ [ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP]);
}
void test_nonConstructorFactory_field() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "factory int x;", [
- ParserErrorCode.NON_CONSTRUCTOR_FACTORY
- ]);
+ parse3("parseClassMember", <Object>["C"], "factory int x;",
+ [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
}
void test_nonConstructorFactory_method() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "factory int m() {}", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
+ parse3("parseClassMember", <Object>["C"], "factory int m() {}",
+ [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
}
void test_nonIdentifierLibraryName_library() {
@@ -1818,23 +1680,18 @@ class Foo {
}
void test_nonPartOfDirectiveInPart_after() {
- ParserTestCase.parseCompilationUnit("part of l; part 'f.dart';", [
- ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART
- ]);
+ ParserTestCase.parseCompilationUnit("part of l; part 'f.dart';",
+ [ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART]);
}
void test_nonPartOfDirectiveInPart_before() {
- ParserTestCase.parseCompilationUnit("part 'f.dart'; part of m;", [
- ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART
- ]);
+ ParserTestCase.parseCompilationUnit("part 'f.dart'; part of m;",
+ [ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART]);
}
void test_nonUserDefinableOperator() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "operator +=(int x) => x + 1;", [
- ParserErrorCode.NON_USER_DEFINABLE_OPERATOR
- ]);
+ parse3("parseClassMember", <Object>["C"], "operator +=(int x) => x + 1;",
+ [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]);
}
void test_optionalAfterNormalParameters_named() {
@@ -1848,7 +1705,7 @@ class Foo {
}
void test_parseCascadeSection_missingIdentifier() {
- MethodInvocation methodInvocation = ParserTestCase.parse4(
+ MethodInvocation methodInvocation = parse4(
"parseCascadeSection", "..()", [ParserErrorCode.MISSING_IDENTIFIER]);
expect(methodInvocation.target, isNull);
expect(methodInvocation.methodName.name, "");
@@ -1856,21 +1713,18 @@ class Foo {
}
void test_positionalAfterNamedArgument() {
- ParserTestCase.parse4("parseArgumentList", "(x: 1, 2)", [
- ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT
- ]);
+ parse4("parseArgumentList", "(x: 1, 2)",
+ [ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT]);
}
void test_positionalParameterOutsideGroup() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, b = 0)", [
- ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP
- ]);
+ parse4("parseFormalParameterList", "(a, b = 0)",
+ [ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP]);
}
void test_redirectionInNonFactoryConstructor() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "C() = D;", [
- ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR
- ]);
+ parse3("parseClassMember", <Object>["C"], "C() = D;",
+ [ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR]);
}
void test_setterInFunction_block() {
@@ -1884,53 +1738,45 @@ class Foo {
}
void test_staticAfterConst() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "final static int f;", [ParserErrorCode.STATIC_AFTER_FINAL]);
+ parse3("parseClassMember", <Object>["C"], "final static int f;",
+ [ParserErrorCode.STATIC_AFTER_FINAL]);
}
void test_staticAfterFinal() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "const static int f;", [ParserErrorCode.STATIC_AFTER_CONST]);
+ parse3("parseClassMember", <Object>["C"], "const static int f;",
+ [ParserErrorCode.STATIC_AFTER_CONST]);
}
void test_staticAfterVar() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "var static f;", [
- ParserErrorCode.STATIC_AFTER_VAR
- ]);
+ parse3("parseClassMember", <Object>["C"], "var static f;",
+ [ParserErrorCode.STATIC_AFTER_VAR]);
}
void test_staticConstructor() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "static C.m() {}", [ParserErrorCode.STATIC_CONSTRUCTOR]);
+ parse3("parseClassMember", <Object>["C"], "static C.m() {}",
+ [ParserErrorCode.STATIC_CONSTRUCTOR]);
}
void test_staticGetterWithoutBody() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "static get m;", [
- ParserErrorCode.STATIC_GETTER_WITHOUT_BODY
- ]);
+ parse3("parseClassMember", <Object>["C"], "static get m;",
+ [ParserErrorCode.STATIC_GETTER_WITHOUT_BODY]);
}
void test_staticOperator_noReturnType() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "static operator +(int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]);
+ parse3("parseClassMember", <Object>["C"],
+ "static operator +(int x) => x + 1;",
+ [ParserErrorCode.STATIC_OPERATOR]);
}
void test_staticOperator_returnType() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "static int operator +(int x) => x + 1;", [
- ParserErrorCode.STATIC_OPERATOR
- ]);
+ parse3("parseClassMember", <Object>["C"],
+ "static int operator +(int x) => x + 1;",
+ [ParserErrorCode.STATIC_OPERATOR]);
}
void test_staticSetterWithoutBody() {
- ParserTestCase.parse3("parseClassMember", <Object>[
- "C"
- ], "static set m(x);", [ParserErrorCode.STATIC_SETTER_WITHOUT_BODY]);
+ parse3("parseClassMember", <Object>["C"], "static set m(x);",
+ [ParserErrorCode.STATIC_SETTER_WITHOUT_BODY]);
}
void test_staticTopLevelDeclaration_class() {
@@ -1954,14 +1800,13 @@ class Foo {
}
void test_switchHasCaseAfterDefaultCase() {
- ParserTestCase.parse4("parseSwitchStatement",
- "switch (a) {default: return 0; case 1: return 1;}", [
- ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE
- ]);
+ parse4("parseSwitchStatement",
+ "switch (a) {default: return 0; case 1: return 1;}",
+ [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
}
void test_switchHasCaseAfterDefaultCase_repeated() {
- ParserTestCase.parse4("parseSwitchStatement",
+ parse4("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
@@ -1969,14 +1814,13 @@ class Foo {
}
void test_switchHasMultipleDefaultCases() {
- ParserTestCase.parse4("parseSwitchStatement",
- "switch (a) {default: return 0; default: return 1;}", [
- ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES
- ]);
+ parse4("parseSwitchStatement",
+ "switch (a) {default: return 0; default: return 1;}",
+ [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
}
void test_switchHasMultipleDefaultCases_repeated() {
- ParserTestCase.parse4("parseSwitchStatement",
+ parse4("parseSwitchStatement",
"switch (a) {default: return 0; default: return 1; default: return 2;}",
[
ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
@@ -1985,27 +1829,21 @@ class Foo {
}
void test_topLevelOperator_withoutType() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "operator +(bool x, bool y) => x | y;", [
- ParserErrorCode.TOP_LEVEL_OPERATOR
- ]);
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "operator +(bool x, bool y) => x | y;",
+ [ParserErrorCode.TOP_LEVEL_OPERATOR]);
}
void test_topLevelOperator_withType() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "bool operator +(bool x, bool y) => x | y;", [
- ParserErrorCode.TOP_LEVEL_OPERATOR
- ]);
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "bool operator +(bool x, bool y) => x | y;",
+ [ParserErrorCode.TOP_LEVEL_OPERATOR]);
}
void test_topLevelOperator_withVoid() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "void operator +(bool x, bool y) => x | y;", [
- ParserErrorCode.TOP_LEVEL_OPERATOR
- ]);
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "void operator +(bool x, bool y) => x | y;",
+ [ParserErrorCode.TOP_LEVEL_OPERATOR]);
}
void test_typedefInClass_withoutReturnType() {
@@ -2014,21 +1852,18 @@ class Foo {
}
void test_typedefInClass_withReturnType() {
- ParserTestCase.parseCompilationUnit("class C { typedef int F(int x); }", [
- ParserErrorCode.TYPEDEF_IN_CLASS
- ]);
+ ParserTestCase.parseCompilationUnit("class C { typedef int F(int x); }",
+ [ParserErrorCode.TYPEDEF_IN_CLASS]);
}
void test_unexpectedTerminatorForParameterGroup_named() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, b})", [
- ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP
- ]);
+ parse4("parseFormalParameterList", "(a, b})",
+ [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
}
void test_unexpectedTerminatorForParameterGroup_optional() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, b])", [
- ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP
- ]);
+ parse4("parseFormalParameterList", "(a, b])",
+ [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
}
void test_unexpectedToken_endOfFieldDeclarationStatement() {
@@ -2042,7 +1877,7 @@ class Foo {
}
void test_unexpectedToken_semicolonBetweenClassMembers() {
- ParserTestCase.parse3("parseClassDeclaration", <Object>[
+ parse3("parseClassDeclaration", <Object>[
emptyCommentAndMetadata(),
null
], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]);
@@ -2054,7 +1889,7 @@ class Foo {
}
void test_useOfUnaryPlusOperator() {
- SimpleIdentifier expression = ParserTestCase.parse4(
+ SimpleIdentifier expression = parse4(
"parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf(
(obj) => obj is SimpleIdentifier, SimpleIdentifier, expression);
@@ -2072,8 +1907,7 @@ class Foo {
}
void test_varAsTypeName_as() {
- ParserTestCase.parseExpression(
- "x as var", [ParserErrorCode.VAR_AS_TYPE_NAME]);
+ parseExpression("x as var", [ParserErrorCode.VAR_AS_TYPE_NAME]);
}
void test_varClass() {
@@ -2087,9 +1921,8 @@ class Foo {
}
void test_varReturnType() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "var m() {}", [
- ParserErrorCode.VAR_RETURN_TYPE
- ]);
+ parse3("parseClassMember", <Object>["C"], "var m() {}",
+ [ParserErrorCode.VAR_RETURN_TYPE]);
}
void test_varTypedef() {
@@ -2098,21 +1931,18 @@ class Foo {
}
void test_voidParameter() {
- ParserTestCase.parse4("parseNormalFormalParameter", "void a)", [
- ParserErrorCode.VOID_PARAMETER
- ]);
+ parse4("parseNormalFormalParameter", "void a)",
+ [ParserErrorCode.VOID_PARAMETER]);
}
void test_voidVariable_parseClassMember_initializer() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "void x = 0;", [
- ParserErrorCode.VOID_VARIABLE
- ]);
+ parse3("parseClassMember", <Object>["C"], "void x = 0;",
+ [ParserErrorCode.VOID_VARIABLE]);
}
void test_voidVariable_parseClassMember_noInitializer() {
- ParserTestCase.parse3("parseClassMember", <Object>["C"], "void x;", [
- ParserErrorCode.VOID_VARIABLE
- ]);
+ parse3("parseClassMember", <Object>["C"], "void x;",
+ [ParserErrorCode.VOID_VARIABLE]);
}
void test_voidVariable_parseCompilationUnit_initializer() {
@@ -2126,15 +1956,13 @@ class Foo {
}
void test_voidVariable_parseCompilationUnitMember_initializer() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "void a = 0;", [ParserErrorCode.VOID_VARIABLE]);
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "void a = 0;", [ParserErrorCode.VOID_VARIABLE]);
}
void test_voidVariable_parseCompilationUnitMember_noInitializer() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "void a;", [ParserErrorCode.VOID_VARIABLE]);
+ parse3("parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "void a;", [ParserErrorCode.VOID_VARIABLE]);
}
void test_voidVariable_statement_initializer() {
@@ -2157,34 +1985,30 @@ class Foo {
}
void test_withWithoutExtends() {
- ParserTestCase.parse3("parseClassDeclaration", <Object>[
+ parse3("parseClassDeclaration", <Object>[
emptyCommentAndMetadata(),
null
], "class A with B, C {}", [ParserErrorCode.WITH_WITHOUT_EXTENDS]);
}
void test_wrongSeparatorForNamedParameter() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, {b = 0})", [
- ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER
- ]);
+ parse4("parseFormalParameterList", "(a, {b = 0})",
+ [ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER]);
}
void test_wrongSeparatorForPositionalParameter() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, [b : 0])", [
- ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER
- ]);
+ parse4("parseFormalParameterList", "(a, [b : 0])",
+ [ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER]);
}
void test_wrongTerminatorForParameterGroup_named() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, {b, c])", [
- ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP
- ]);
+ parse4("parseFormalParameterList", "(a, {b, c])",
+ [ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]);
}
void test_wrongTerminatorForParameterGroup_optional() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, [b, c})", [
- ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP
- ]);
+ parse4("parseFormalParameterList", "(a, [b, c})",
+ [ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]);
}
}
@@ -2559,8 +2383,7 @@ class C {
@reflectiveTest
class NonErrorParserTest extends ParserTestCase {
void test_constFactory_external() {
- ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "external const factory C();");
+ parse("parseClassMember", <Object>["C"], "external const factory C();");
}
}
@@ -2595,22 +2418,6 @@ class ParserTestCase extends EngineTestCase {
CommentAndMetadata emptyCommentAndMetadata() =>
new CommentAndMetadata(null, null);
- @override
- void setUp() {
- super.setUp();
- parseFunctionBodies = true;
- }
-
- /**
- * Create a parser.
- *
- * @param listener the listener to be passed to the parser
- * @return the parser that was created
- */
- static Parser createParser(GatheringErrorListener listener) {
- return new Parser(null, listener);
- }
-
/**
* Invoke a method in [Parser]. The method is assumed to have the given number and type of
* parameters and will be invoked with the given arguments.
@@ -2627,7 +2434,7 @@ class ParserTestCase extends EngineTestCase {
* @throws AssertionFailedError if the result is `null` or the errors produced while
* scanning and parsing the source do not match the expected errors
*/
- static Object invokeParserMethod(String methodName, List<Object> objects,
+ Object invokeParserMethod(String methodName, List<Object> objects,
String source, GatheringErrorListener listener) {
//
// Scan the source.
@@ -2666,7 +2473,7 @@ class ParserTestCase extends EngineTestCase {
* @throws AssertionFailedError if the result is `null` or the errors produced while
* scanning and parsing the source do not match the expected errors
*/
- static Object invokeParserMethod2(
+ Object invokeParserMethod2(
String methodName, String source, GatheringErrorListener listener) =>
invokeParserMethod(methodName, _EMPTY_ARGUMENTS, source, listener);
@@ -2684,7 +2491,7 @@ class ParserTestCase extends EngineTestCase {
* @throws Exception if the method could not be invoked or throws an exception
* @throws AssertionFailedError if the result is `null` or if any errors are produced
*/
- static Object parse(String methodName, List<Object> objects, String source) =>
+ Object parse(String methodName, List<Object> objects, String source) =>
parse2(methodName, objects, source);
/**
@@ -2703,7 +2510,7 @@ class ParserTestCase extends EngineTestCase {
* @throws AssertionFailedError if the result is `null` or the errors produced while
* scanning and parsing the source do not match the expected errors
*/
- static Object parse2(String methodName, List<Object> objects, String source,
+ Object parse2(String methodName, List<Object> objects, String source,
[List<AnalysisError> errors = AnalysisError.NO_ERRORS]) {
GatheringErrorListener listener = new GatheringErrorListener();
Object result = invokeParserMethod(methodName, objects, source, listener);
@@ -2727,7 +2534,7 @@ class ParserTestCase extends EngineTestCase {
* @throws AssertionFailedError if the result is `null` or the errors produced while
* scanning and parsing the source do not match the expected errors
*/
- static Object parse3(String methodName, List<Object> objects, String source,
+ Object parse3(String methodName, List<Object> objects, String source,
[List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
GatheringErrorListener listener = new GatheringErrorListener();
Object result = invokeParserMethod(methodName, objects, source, listener);
@@ -2749,20 +2556,20 @@ class ParserTestCase extends EngineTestCase {
* @throws AssertionFailedError if the result is `null` or the errors produced while
* scanning and parsing the source do not match the expected errors
*/
- static Object parse4(String methodName, String source,
+ Object parse4(String methodName, String source,
[List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) =>
parse3(methodName, _EMPTY_ARGUMENTS, source, errorCodes);
/**
- * Parse the given source as a compilation unit.
+ * Parse the given source as an expression.
*
* @param source the source to be parsed
* @param errorCodes the error codes of the errors that are expected to be found
- * @return the compilation unit that was parsed
+ * @return the expression that was parsed
* @throws Exception if the source could not be parsed, if the compilation errors in the source do
* not match those that are expected, or if the result would have been `null`
*/
- static CompilationUnit parseCompilationUnit(String source,
+ Expression parseExpression(String source,
[List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
GatheringErrorListener listener = new GatheringErrorListener();
Scanner scanner =
@@ -2770,22 +2577,38 @@ class ParserTestCase extends EngineTestCase {
listener.setLineInfo(new TestSource(), scanner.lineStarts);
Token token = scanner.tokenize();
Parser parser = createParser(listener);
- CompilationUnit unit = parser.parseCompilationUnit(token);
- expect(unit, isNotNull);
+ Expression expression = parser.parseExpression(token);
+ expect(expression, isNotNull);
listener.assertErrorsWithCodes(errorCodes);
- return unit;
+ return expression;
+ }
+
+ @override
+ void setUp() {
+ super.setUp();
+ parseFunctionBodies = true;
}
/**
- * Parse the given source as an expression.
+ * Create a parser.
+ *
+ * @param listener the listener to be passed to the parser
+ * @return the parser that was created
+ */
+ static Parser createParser(GatheringErrorListener listener) {
+ return new Parser(null, listener);
+ }
+
+ /**
+ * Parse the given source as a compilation unit.
*
* @param source the source to be parsed
* @param errorCodes the error codes of the errors that are expected to be found
- * @return the expression that was parsed
+ * @return the compilation unit that was parsed
* @throws Exception if the source could not be parsed, if the compilation errors in the source do
* not match those that are expected, or if the result would have been `null`
*/
- static Expression parseExpression(String source,
+ static CompilationUnit parseCompilationUnit(String source,
[List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
GatheringErrorListener listener = new GatheringErrorListener();
Scanner scanner =
@@ -2793,10 +2616,10 @@ class ParserTestCase extends EngineTestCase {
listener.setLineInfo(new TestSource(), scanner.lineStarts);
Token token = scanner.tokenize();
Parser parser = createParser(listener);
- Expression expression = parser.parseExpression(token);
- expect(expression, isNotNull);
+ CompilationUnit unit = parser.parseCompilationUnit(token);
+ expect(unit, isNotNull);
listener.assertErrorsWithCodes(errorCodes);
- return expression;
+ return unit;
}
/**
@@ -2867,15 +2690,15 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_additiveExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "+ y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("+ y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_additiveExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("+", [
+ BinaryExpression expression = parseExpression("+", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -2888,23 +2711,23 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_additiveExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x +", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x +", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_additiveExpression_missing_RHS_super() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "super +", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("super +", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_additiveExpression_precedence_multiplicative_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("* +", [
+ BinaryExpression expression = parseExpression("* +", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -2914,7 +2737,7 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_additiveExpression_precedence_multiplicative_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("+ *", [
+ BinaryExpression expression = parseExpression("+ *", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -2924,7 +2747,7 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_additiveExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super + +", [
+ BinaryExpression expression = parseExpression("super + +", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -2933,8 +2756,8 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_assignmentExpression_missing_compound1() {
- AssignmentExpression expression = ParserTestCase.parseExpression(
- "= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
+ AssignmentExpression expression =
+ parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
Expression syntheticExpression = expression.leftHandSide;
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, syntheticExpression);
@@ -2942,8 +2765,8 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_assignmentExpression_missing_compound2() {
- AssignmentExpression expression = ParserTestCase.parseExpression(
- "x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
+ AssignmentExpression expression =
+ parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
Expression syntheticExpression =
(expression.rightHandSide as AssignmentExpression).leftHandSide;
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
@@ -2952,8 +2775,8 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_assignmentExpression_missing_compound3() {
- AssignmentExpression expression = ParserTestCase.parseExpression(
- "x = y =", [ParserErrorCode.MISSING_IDENTIFIER]);
+ AssignmentExpression expression =
+ parseExpression("x = y =", [ParserErrorCode.MISSING_IDENTIFIER]);
Expression syntheticExpression =
(expression.rightHandSide as AssignmentExpression).rightHandSide;
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
@@ -2962,31 +2785,31 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_assignmentExpression_missing_LHS() {
- AssignmentExpression expression = ParserTestCase.parseExpression(
- "= 0", [ParserErrorCode.MISSING_IDENTIFIER]);
+ AssignmentExpression expression =
+ parseExpression("= 0", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftHandSide);
expect(expression.leftHandSide.isSynthetic, isTrue);
}
void test_assignmentExpression_missing_RHS() {
- AssignmentExpression expression = ParserTestCase.parseExpression(
- "x =", [ParserErrorCode.MISSING_IDENTIFIER]);
+ AssignmentExpression expression =
+ parseExpression("x =", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftHandSide);
expect(expression.rightHandSide.isSynthetic, isTrue);
}
void test_bitwiseAndExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "& y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("& y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_bitwiseAndExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("&", [
+ BinaryExpression expression = parseExpression("&", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -2999,23 +2822,23 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseAndExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x &", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x &", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseAndExpression_missing_RHS_super() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "super &", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("super &", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseAndExpression_precedence_equality_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("== &&", [
+ BinaryExpression expression = parseExpression("== &&", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3025,7 +2848,7 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseAndExpression_precedence_equality_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("&& ==", [
+ BinaryExpression expression = parseExpression("&& ==", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3035,7 +2858,7 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseAndExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super & &", [
+ BinaryExpression expression = parseExpression("super & &", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3044,15 +2867,15 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseOrExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "| y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("| y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_bitwiseOrExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("|", [
+ BinaryExpression expression = parseExpression("|", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3065,23 +2888,23 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseOrExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x |", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x |", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseOrExpression_missing_RHS_super() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "super |", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("super |", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseOrExpression_precedence_xor_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("^ |", [
+ BinaryExpression expression = parseExpression("^ |", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3091,7 +2914,7 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseOrExpression_precedence_xor_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("| ^", [
+ BinaryExpression expression = parseExpression("| ^", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3101,7 +2924,7 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseOrExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super | |", [
+ BinaryExpression expression = parseExpression("super | |", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3110,15 +2933,15 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseXorExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "^ y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("^ y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_bitwiseXorExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("^", [
+ BinaryExpression expression = parseExpression("^", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3131,23 +2954,23 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseXorExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x ^", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x ^", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseXorExpression_missing_RHS_super() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "super ^", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("super ^", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseXorExpression_precedence_and_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("& ^", [
+ BinaryExpression expression = parseExpression("& ^", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3157,7 +2980,7 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseXorExpression_precedence_and_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("^ &", [
+ BinaryExpression expression = parseExpression("^ &", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3167,7 +2990,7 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_bitwiseXorExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super ^ ^", [
+ BinaryExpression expression = parseExpression("super ^ ^", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3182,35 +3005,31 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_conditionalExpression_missingElse() {
- ConditionalExpression expression = ParserTestCase.parse4(
- "parseConditionalExpression", "x ? y :", [
- ParserErrorCode.MISSING_IDENTIFIER
- ]);
+ ConditionalExpression expression = parse4("parseConditionalExpression",
+ "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.elseExpression);
expect(expression.elseExpression.isSynthetic, isTrue);
}
void test_conditionalExpression_missingThen() {
- ConditionalExpression expression = ParserTestCase.parse4(
- "parseConditionalExpression", "x ? : z", [
- ParserErrorCode.MISSING_IDENTIFIER
- ]);
+ ConditionalExpression expression = parse4("parseConditionalExpression",
+ "x ? : z", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.thenExpression);
expect(expression.thenExpression.isSynthetic, isTrue);
}
void test_equalityExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "== y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("== y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_equalityExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("==", [
+ BinaryExpression expression = parseExpression("==", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3223,23 +3042,23 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_equalityExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x ==", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x ==", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_equalityExpression_missing_RHS_super() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "super ==", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("super ==", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_equalityExpression_precedence_relational_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("is ==", [
+ BinaryExpression expression = parseExpression("is ==", [
ParserErrorCode.EXPECTED_TYPE_NAME,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3249,7 +3068,7 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_equalityExpression_precedence_relational_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("== is", [
+ BinaryExpression expression = parseExpression("== is", [
ParserErrorCode.EXPECTED_TYPE_NAME,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3259,8 +3078,7 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_equalityExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super == ==",
- [
+ BinaryExpression expression = parseExpression("super == ==", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND
@@ -3270,8 +3088,8 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_expressionList_multiple_end() {
- List<Expression> result = ParserTestCase.parse4("parseExpressionList",
- ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]);
+ List<Expression> result = parse4("parseExpressionList", ", 2, 3, 4",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
expect(result, hasLength(4));
Expression syntheticExpression = result[0];
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
@@ -3280,8 +3098,8 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_expressionList_multiple_middle() {
- List<Expression> result = ParserTestCase.parse4("parseExpressionList",
- "1, 2, , 4", [ParserErrorCode.MISSING_IDENTIFIER]);
+ List<Expression> result = parse4("parseExpressionList", "1, 2, , 4",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
expect(result, hasLength(4));
Expression syntheticExpression = result[2];
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
@@ -3290,8 +3108,8 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_expressionList_multiple_start() {
- List<Expression> result = ParserTestCase.parse4("parseExpressionList",
- "1, 2, 3,", [ParserErrorCode.MISSING_IDENTIFIER]);
+ List<Expression> result = parse4("parseExpressionList", "1, 2, 3,",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
expect(result, hasLength(4));
Expression syntheticExpression = result[3];
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
@@ -3318,27 +3136,24 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_functionExpression_named() {
- ParserTestCase.parseExpression(
- "m(f() => 0);", [ParserErrorCode.EXPECTED_TOKEN]);
+ parseExpression("m(f() => 0);", [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_incomplete_conditionalExpression() {
- ParserTestCase.parseExpression("x ? 0", [
+ parseExpression("x ? 0", [
ParserErrorCode.EXPECTED_TOKEN,
ParserErrorCode.MISSING_IDENTIFIER
]);
}
void test_incomplete_constructorInitializers_empty() {
- ParserTestCase.parse3("parseClassMember", ["C"], "C() : {}", [
- ParserErrorCode.MISSING_INITIALIZER
- ]);
+ parse3("parseClassMember", ["C"], "C() : {}",
+ [ParserErrorCode.MISSING_INITIALIZER]);
}
void test_incomplete_constructorInitializers_missingEquals() {
- ClassMember member = ParserTestCase.parse3("parseClassMember", [
- "C"
- ], "C() : x(3) {}", [ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER]);
+ ClassMember member = parse3("parseClassMember", ["C"], "C() : x(3) {}",
+ [ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER]);
expect(member, new isInstanceOf<ConstructorDeclaration>());
NodeList<ConstructorInitializer> initializers =
(member as ConstructorDeclaration).initializers;
@@ -3352,9 +3167,8 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_incomplete_constructorInitializers_variable() {
- ParserTestCase.parse3("parseClassMember", ["C"], "C() : x {}", [
- ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER
- ]);
+ parse3("parseClassMember", ["C"], "C() : x {}",
+ [ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER]);
}
void test_incomplete_topLevelFunction() {
@@ -3536,15 +3350,15 @@ class C {
}
void test_logicalAndExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "&& y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("&& y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_logicalAndExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("&&", [
+ BinaryExpression expression = parseExpression("&&", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3557,15 +3371,15 @@ class C {
}
void test_logicalAndExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x &&", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x &&", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_logicalAndExpression_precedence_bitwiseOr_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("| &&", [
+ BinaryExpression expression = parseExpression("| &&", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3575,7 +3389,7 @@ class C {
}
void test_logicalAndExpression_precedence_bitwiseOr_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("&& |", [
+ BinaryExpression expression = parseExpression("&& |", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3585,15 +3399,15 @@ class C {
}
void test_logicalOrExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "|| y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("|| y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_logicalOrExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("||", [
+ BinaryExpression expression = parseExpression("||", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3606,15 +3420,15 @@ class C {
}
void test_logicalOrExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x ||", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x ||", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_logicalOrExpression_precedence_logicalAnd_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("&& ||", [
+ BinaryExpression expression = parseExpression("&& ||", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3624,7 +3438,7 @@ class C {
}
void test_logicalOrExpression_precedence_logicalAnd_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [
+ BinaryExpression expression = parseExpression("|| &&", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3634,8 +3448,7 @@ class C {
}
void test_missing_commaInArgumentList() {
- ParserTestCase.parseExpression(
- "f(x: 1 y: 2)", [ParserErrorCode.EXPECTED_TOKEN]);
+ parseExpression("f(x: 1 y: 2)", [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_missingGet() {
@@ -3658,8 +3471,8 @@ class C {
}
void test_missingIdentifier_afterAnnotation() {
- MethodDeclaration method = ParserTestCase.parse3("parseClassMember",
- <Object>["C"], "@override }", [ParserErrorCode.EXPECTED_CLASS_MEMBER]);
+ MethodDeclaration method = parse3("parseClassMember", <Object>["C"],
+ "@override }", [ParserErrorCode.EXPECTED_CLASS_MEMBER]);
expect(method.documentationComment, isNull);
NodeList<Annotation> metadata = method.metadata;
expect(metadata, hasLength(1));
@@ -3667,15 +3480,15 @@ class C {
}
void test_multiplicativeExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "* y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("* y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_multiplicativeExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("*", [
+ BinaryExpression expression = parseExpression("*", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3688,38 +3501,37 @@ class C {
}
void test_multiplicativeExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x *", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x *", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_multiplicativeExpression_missing_RHS_super() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "super *", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("super *", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_multiplicativeExpression_precedence_unary_left() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "-x *", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("-x *", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression,
PrefixExpression, expression.leftOperand);
}
void test_multiplicativeExpression_precedence_unary_right() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "* -y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("* -y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression,
PrefixExpression, expression.rightOperand);
}
void test_multiplicativeExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super == ==",
- [
+ BinaryExpression expression = parseExpression("super == ==", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND
@@ -3729,14 +3541,13 @@ class C {
}
void test_nonStringLiteralUri_import() {
- ParserTestCase.parseCompilationUnit("import dart:io; class C {}", [
- ParserErrorCode.NON_STRING_LITERAL_AS_URI
- ]);
+ ParserTestCase.parseCompilationUnit("import dart:io; class C {}",
+ [ParserErrorCode.NON_STRING_LITERAL_AS_URI]);
}
void test_prefixExpression_missing_operand_minus() {
- PrefixExpression expression = ParserTestCase.parseExpression(
- "-", [ParserErrorCode.MISSING_IDENTIFIER]);
+ PrefixExpression expression =
+ parseExpression("-", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf(
(obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.operand);
expect(expression.operand.isSynthetic, isTrue);
@@ -3744,22 +3555,22 @@ class C {
}
void test_primaryExpression_argumentDefinitionTest() {
- Expression expression = ParserTestCase.parse4(
+ Expression expression = parse4(
"parsePrimaryExpression", "?a", [ParserErrorCode.UNEXPECTED_TOKEN]);
EngineTestCase.assertInstanceOf(
(obj) => obj is SimpleIdentifier, SimpleIdentifier, expression);
}
void test_relationalExpression_missing_LHS() {
- IsExpression expression = ParserTestCase.parseExpression(
- "is y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ IsExpression expression =
+ parseExpression("is y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.expression);
expect(expression.expression.isSynthetic, isTrue);
}
void test_relationalExpression_missing_LHS_RHS() {
- IsExpression expression = ParserTestCase.parseExpression("is", [
+ IsExpression expression = parseExpression("is", [
ParserErrorCode.EXPECTED_TYPE_NAME,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3772,15 +3583,15 @@ class C {
}
void test_relationalExpression_missing_RHS() {
- IsExpression expression = ParserTestCase.parseExpression(
- "x is", [ParserErrorCode.EXPECTED_TYPE_NAME]);
+ IsExpression expression =
+ parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]);
EngineTestCase.assertInstanceOf(
(obj) => obj is TypeName, TypeName, expression.type);
expect(expression.type.isSynthetic, isTrue);
}
void test_relationalExpression_precedence_shift_right() {
- IsExpression expression = ParserTestCase.parseExpression("<< is", [
+ IsExpression expression = parseExpression("<< is", [
ParserErrorCode.EXPECTED_TYPE_NAME,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3790,15 +3601,15 @@ class C {
}
void test_shiftExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "<< y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("<< y", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
}
void test_shiftExpression_missing_LHS_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("<<", [
+ BinaryExpression expression = parseExpression("<<", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3811,23 +3622,23 @@ class C {
}
void test_shiftExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "x <<", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("x <<", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_shiftExpression_missing_RHS_super() {
- BinaryExpression expression = ParserTestCase.parseExpression(
- "super <<", [ParserErrorCode.MISSING_IDENTIFIER]);
+ BinaryExpression expression =
+ parseExpression("super <<", [ParserErrorCode.MISSING_IDENTIFIER]);
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
SimpleIdentifier, expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_shiftExpression_precedence_unary_left() {
- BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [
+ BinaryExpression expression = parseExpression("+ <<", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3837,7 +3648,7 @@ class C {
}
void test_shiftExpression_precedence_unary_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("<< +", [
+ BinaryExpression expression = parseExpression("<< +", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
@@ -3847,8 +3658,7 @@ class C {
}
void test_shiftExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super << <<",
- [
+ BinaryExpression expression = parseExpression("super << <<", [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.MISSING_IDENTIFIER
]);
@@ -3869,7 +3679,7 @@ class C {
}
void test_unaryPlus() {
- ParserTestCase.parseExpression("+2", [ParserErrorCode.MISSING_IDENTIFIER]);
+ parseExpression("+2", [ParserErrorCode.MISSING_IDENTIFIER]);
}
}
@@ -4506,7 +4316,7 @@ class SimpleParserTest extends ParserTestCase {
// This test requires better error recovery than we currently have. In
// particular, we need to be able to distinguish between an await expression
// in the wrong context, and the use of 'await' as an identifier.
- MethodDeclaration method = ParserTestCase.parse(
+ MethodDeclaration method = parse(
"parseClassMember", <Object>["C"], "m() { return await x + await y; }");
FunctionBody body = method.body;
EngineTestCase.assertInstanceOf(
@@ -4527,7 +4337,7 @@ class SimpleParserTest extends ParserTestCase {
// This fails because we are returning null from the method and asserting
// that the return value is not null.
CommentReference reference =
- ParserTestCase.parse("parseCommentReference", <Object>["this", 5], "");
+ parse("parseCommentReference", <Object>["this", 5], "");
SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
(obj) => obj is SimpleIdentifier, SimpleIdentifier,
reference.identifier);
@@ -4617,8 +4427,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_constFactory() {
- ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "const factory C() = A;");
+ parse("parseClassMember", <Object>["C"], "const factory C() = A;");
}
void test_createSyntheticIdentifier() {
@@ -4823,8 +4632,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAdditiveExpression_normal() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseAdditiveExpression", "x + y");
+ BinaryExpression expression = parse4("parseAdditiveExpression", "x + y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS);
@@ -4833,7 +4641,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseAdditiveExpression_super() {
BinaryExpression expression =
- ParserTestCase.parse4("parseAdditiveExpression", "super + y");
+ parse4("parseAdditiveExpression", "super + y");
EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression,
SuperExpression, expression.leftOperand);
expect(expression.operator, isNotNull);
@@ -4842,7 +4650,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAnnotation_n1() {
- Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A");
+ Annotation annotation = parse4("parseAnnotation", "@A");
expect(annotation.atSign, isNotNull);
expect(annotation.name, isNotNull);
expect(annotation.period, isNull);
@@ -4851,7 +4659,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAnnotation_n1_a() {
- Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A(x,y)");
+ Annotation annotation = parse4("parseAnnotation", "@A(x,y)");
expect(annotation.atSign, isNotNull);
expect(annotation.name, isNotNull);
expect(annotation.period, isNull);
@@ -4860,7 +4668,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAnnotation_n2() {
- Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B");
+ Annotation annotation = parse4("parseAnnotation", "@A.B");
expect(annotation.atSign, isNotNull);
expect(annotation.name, isNotNull);
expect(annotation.period, isNull);
@@ -4869,8 +4677,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAnnotation_n2_a() {
- Annotation annotation =
- ParserTestCase.parse4("parseAnnotation", "@A.B(x,y)");
+ Annotation annotation = parse4("parseAnnotation", "@A.B(x,y)");
expect(annotation.atSign, isNotNull);
expect(annotation.name, isNotNull);
expect(annotation.period, isNull);
@@ -4879,7 +4686,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAnnotation_n3() {
- Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B.C");
+ Annotation annotation = parse4("parseAnnotation", "@A.B.C");
expect(annotation.atSign, isNotNull);
expect(annotation.name, isNotNull);
expect(annotation.period, isNotNull);
@@ -4888,8 +4695,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAnnotation_n3_a() {
- Annotation annotation =
- ParserTestCase.parse4("parseAnnotation", "@A.B.C(x,y)");
+ Annotation annotation = parse4("parseAnnotation", "@A.B.C(x,y)");
expect(annotation.atSign, isNotNull);
expect(annotation.name, isNotNull);
expect(annotation.period, isNotNull);
@@ -4898,7 +4704,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseArgument_named() {
- NamedExpression expression = ParserTestCase.parse4("parseArgument", "n: x");
+ NamedExpression expression = parse4("parseArgument", "n: x");
Label name = expression.name;
expect(name, isNotNull);
expect(name.label, isNotNull);
@@ -4908,42 +4714,37 @@ class SimpleParserTest extends ParserTestCase {
void test_parseArgument_unnamed() {
String lexeme = "x";
- SimpleIdentifier identifier =
- ParserTestCase.parse4("parseArgument", lexeme);
+ SimpleIdentifier identifier = parse4("parseArgument", lexeme);
expect(identifier.name, lexeme);
}
void test_parseArgumentList_empty() {
- ArgumentList argumentList =
- ParserTestCase.parse4("parseArgumentList", "()");
+ ArgumentList argumentList = parse4("parseArgumentList", "()");
NodeList<Expression> arguments = argumentList.arguments;
expect(arguments, hasLength(0));
}
void test_parseArgumentList_mixed() {
ArgumentList argumentList =
- ParserTestCase.parse4("parseArgumentList", "(w, x, y: y, z: z)");
+ parse4("parseArgumentList", "(w, x, y: y, z: z)");
NodeList<Expression> arguments = argumentList.arguments;
expect(arguments, hasLength(4));
}
void test_parseArgumentList_noNamed() {
- ArgumentList argumentList =
- ParserTestCase.parse4("parseArgumentList", "(x, y, z)");
+ ArgumentList argumentList = parse4("parseArgumentList", "(x, y, z)");
NodeList<Expression> arguments = argumentList.arguments;
expect(arguments, hasLength(3));
}
void test_parseArgumentList_onlyNamed() {
- ArgumentList argumentList =
- ParserTestCase.parse4("parseArgumentList", "(x: x, y: y)");
+ ArgumentList argumentList = parse4("parseArgumentList", "(x: x, y: y)");
NodeList<Expression> arguments = argumentList.arguments;
expect(arguments, hasLength(2));
}
void test_parseAssertStatement() {
- AssertStatement statement =
- ParserTestCase.parse4("parseAssertStatement", "assert (x);");
+ AssertStatement statement = parse4("parseAssertStatement", "assert (x);");
expect(statement.assertKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -4952,8 +4753,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_expression_args_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse(
- "parseAssignableExpression", <Object>[false], "(x)(y).z");
+ PropertyAccess propertyAccess =
+ parse("parseAssignableExpression", <Object>[false], "(x)(y).z");
FunctionExpressionInvocation invocation =
propertyAccess.target as FunctionExpressionInvocation;
expect(invocation.function, isNotNull);
@@ -4965,16 +4766,16 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_expression_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse(
- "parseAssignableExpression", <Object>[false], "(x).y");
+ PropertyAccess propertyAccess =
+ parse("parseAssignableExpression", <Object>[false], "(x).y");
expect(propertyAccess.target, isNotNull);
expect(propertyAccess.operator, isNotNull);
expect(propertyAccess.propertyName, isNotNull);
}
void test_parseAssignableExpression_expression_index() {
- IndexExpression expression = ParserTestCase.parse(
- "parseAssignableExpression", <Object>[false], "(x)[y]");
+ IndexExpression expression =
+ parse("parseAssignableExpression", <Object>[false], "(x)[y]");
expect(expression.target, isNotNull);
expect(expression.leftBracket, isNotNull);
expect(expression.index, isNotNull);
@@ -4983,13 +4784,13 @@ class SimpleParserTest extends ParserTestCase {
void test_parseAssignableExpression_identifier() {
SimpleIdentifier identifier =
- ParserTestCase.parse("parseAssignableExpression", <Object>[false], "x");
+ parse("parseAssignableExpression", <Object>[false], "x");
expect(identifier, isNotNull);
}
void test_parseAssignableExpression_identifier_args_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse(
- "parseAssignableExpression", <Object>[false], "x(y).z");
+ PropertyAccess propertyAccess =
+ parse("parseAssignableExpression", <Object>[false], "x(y).z");
MethodInvocation invocation = propertyAccess.target as MethodInvocation;
expect(invocation.methodName.name, "x");
ArgumentList argumentList = invocation.argumentList;
@@ -5000,16 +4801,16 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_identifier_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse(
- "parseAssignableExpression", <Object>[false], "x.y");
+ PropertyAccess propertyAccess =
+ parse("parseAssignableExpression", <Object>[false], "x.y");
expect(propertyAccess.target, isNotNull);
expect(propertyAccess.operator, isNotNull);
expect(propertyAccess.propertyName, isNotNull);
}
void test_parseAssignableExpression_identifier_index() {
- IndexExpression expression = ParserTestCase.parse(
- "parseAssignableExpression", <Object>[false], "x[y]");
+ IndexExpression expression =
+ parse("parseAssignableExpression", <Object>[false], "x[y]");
expect(expression.target, isNotNull);
expect(expression.leftBracket, isNotNull);
expect(expression.index, isNotNull);
@@ -5017,8 +4818,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_super_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse(
- "parseAssignableExpression", <Object>[false], "super.y");
+ PropertyAccess propertyAccess =
+ parse("parseAssignableExpression", <Object>[false], "super.y");
EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression,
SuperExpression, propertyAccess.target);
expect(propertyAccess.operator, isNotNull);
@@ -5026,8 +4827,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_super_index() {
- IndexExpression expression = ParserTestCase.parse(
- "parseAssignableExpression", <Object>[false], "super[y]");
+ IndexExpression expression =
+ parse("parseAssignableExpression", <Object>[false], "super[y]");
EngineTestCase.assertInstanceOf(
(obj) => obj is SuperExpression, SuperExpression, expression.target);
expect(expression.leftBracket, isNotNull);
@@ -5036,36 +4837,37 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableSelector_dot() {
- PropertyAccess selector = ParserTestCase.parse(
- "parseAssignableSelector", <Object>[null, true], ".x");
+ PropertyAccess selector =
+ parse("parseAssignableSelector", <Object>[null, true], ".x");
expect(selector.operator, isNotNull);
expect(selector.propertyName, isNotNull);
}
void test_parseAssignableSelector_index() {
- IndexExpression selector = ParserTestCase.parse(
- "parseAssignableSelector", <Object>[null, true], "[x]");
+ IndexExpression selector =
+ parse("parseAssignableSelector", <Object>[null, true], "[x]");
expect(selector.leftBracket, isNotNull);
expect(selector.index, isNotNull);
expect(selector.rightBracket, isNotNull);
}
void test_parseAssignableSelector_none() {
- SimpleIdentifier selector = ParserTestCase.parse("parseAssignableSelector",
- <Object>[new SimpleIdentifier(null), true], ";");
+ SimpleIdentifier selector = parse("parseAssignableSelector", <Object>[
+ new SimpleIdentifier(null),
+ true
+ ], ";");
expect(selector, isNotNull);
}
void test_parseAwaitExpression() {
- AwaitExpression expression =
- ParserTestCase.parse4("parseAwaitExpression", "await x;");
+ AwaitExpression expression = parse4("parseAwaitExpression", "await x;");
expect(expression.awaitKeyword, isNotNull);
expect(expression.expression, isNotNull);
}
void test_parseAwaitExpression_asStatement_inAsync() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "m() async { await x; }");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "m() async { await x; }");
FunctionBody body = method.body;
EngineTestCase.assertInstanceOf(
(obj) => obj is BlockFunctionBody, BlockFunctionBody, body);
@@ -5080,8 +4882,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAwaitExpression_asStatement_inSync() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "m() { await x; }");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "m() { await x; }");
FunctionBody body = method.body;
EngineTestCase.assertInstanceOf(
(obj) => obj is BlockFunctionBody, BlockFunctionBody, body);
@@ -5092,8 +4894,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseBitwiseAndExpression_normal() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseBitwiseAndExpression", "x & y");
+ BinaryExpression expression = parse4("parseBitwiseAndExpression", "x & y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.AMPERSAND);
@@ -5102,7 +4903,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseBitwiseAndExpression_super() {
BinaryExpression expression =
- ParserTestCase.parse4("parseBitwiseAndExpression", "super & y");
+ parse4("parseBitwiseAndExpression", "super & y");
EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression,
SuperExpression, expression.leftOperand);
expect(expression.operator, isNotNull);
@@ -5111,8 +4912,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseBitwiseOrExpression_normal() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseBitwiseOrExpression", "x | y");
+ BinaryExpression expression = parse4("parseBitwiseOrExpression", "x | y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.BAR);
@@ -5121,7 +4921,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseBitwiseOrExpression_super() {
BinaryExpression expression =
- ParserTestCase.parse4("parseBitwiseOrExpression", "super | y");
+ parse4("parseBitwiseOrExpression", "super | y");
EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression,
SuperExpression, expression.leftOperand);
expect(expression.operator, isNotNull);
@@ -5130,8 +4930,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseBitwiseXorExpression_normal() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseBitwiseXorExpression", "x ^ y");
+ BinaryExpression expression = parse4("parseBitwiseXorExpression", "x ^ y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.CARET);
@@ -5140,7 +4939,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseBitwiseXorExpression_super() {
BinaryExpression expression =
- ParserTestCase.parse4("parseBitwiseXorExpression", "super ^ y");
+ parse4("parseBitwiseXorExpression", "super ^ y");
EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression,
SuperExpression, expression.leftOperand);
expect(expression.operator, isNotNull);
@@ -5149,38 +4948,36 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseBlock_empty() {
- Block block = ParserTestCase.parse4("parseBlock", "{}");
+ Block block = parse4("parseBlock", "{}");
expect(block.leftBracket, isNotNull);
expect(block.statements, hasLength(0));
expect(block.rightBracket, isNotNull);
}
void test_parseBlock_nonEmpty() {
- Block block = ParserTestCase.parse4("parseBlock", "{;}");
+ Block block = parse4("parseBlock", "{;}");
expect(block.leftBracket, isNotNull);
expect(block.statements, hasLength(1));
expect(block.rightBracket, isNotNull);
}
void test_parseBreakStatement_label() {
- BreakStatement statement =
- ParserTestCase.parse4("parseBreakStatement", "break foo;");
+ BreakStatement statement = parse4("parseBreakStatement", "break foo;");
expect(statement.breakKeyword, isNotNull);
expect(statement.label, isNotNull);
expect(statement.semicolon, isNotNull);
}
void test_parseBreakStatement_noLabel() {
- BreakStatement statement = ParserTestCase.parse4("parseBreakStatement",
- "break;", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
+ BreakStatement statement = parse4("parseBreakStatement", "break;",
+ [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
expect(statement.breakKeyword, isNotNull);
expect(statement.label, isNull);
expect(statement.semicolon, isNotNull);
}
void test_parseCascadeSection_i() {
- IndexExpression section =
- ParserTestCase.parse4("parseCascadeSection", "..[i]");
+ IndexExpression section = parse4("parseCascadeSection", "..[i]");
expect(section.target, isNull);
expect(section.leftBracket, isNotNull);
expect(section.index, isNotNull);
@@ -5189,15 +4986,14 @@ class SimpleParserTest extends ParserTestCase {
void test_parseCascadeSection_ia() {
FunctionExpressionInvocation section =
- ParserTestCase.parse4("parseCascadeSection", "..[i](b)");
+ parse4("parseCascadeSection", "..[i](b)");
EngineTestCase.assertInstanceOf(
(obj) => obj is IndexExpression, IndexExpression, section.function);
expect(section.argumentList, isNotNull);
}
void test_parseCascadeSection_ii() {
- MethodInvocation section =
- ParserTestCase.parse4("parseCascadeSection", "..a(b).c(d)");
+ MethodInvocation section = parse4("parseCascadeSection", "..a(b).c(d)");
EngineTestCase.assertInstanceOf(
(obj) => obj is MethodInvocation, MethodInvocation, section.target);
expect(section.period, isNotNull);
@@ -5207,16 +5003,14 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCascadeSection_p() {
- PropertyAccess section =
- ParserTestCase.parse4("parseCascadeSection", "..a");
+ PropertyAccess section = parse4("parseCascadeSection", "..a");
expect(section.target, isNull);
expect(section.operator, isNotNull);
expect(section.propertyName, isNotNull);
}
void test_parseCascadeSection_p_assign() {
- AssignmentExpression section =
- ParserTestCase.parse4("parseCascadeSection", "..a = 3");
+ AssignmentExpression section = parse4("parseCascadeSection", "..a = 3");
expect(section.leftHandSide, isNotNull);
expect(section.operator, isNotNull);
Expression rhs = section.rightHandSide;
@@ -5225,25 +5019,23 @@ class SimpleParserTest extends ParserTestCase {
void test_parseCascadeSection_p_assign_withCascade() {
AssignmentExpression section =
- ParserTestCase.parse4("parseCascadeSection", "..a = 3..m()");
+ parse4("parseCascadeSection", "..a = 3..m()");
expect(section.leftHandSide, isNotNull);
expect(section.operator, isNotNull);
Expression rhs = section.rightHandSide;
- EngineTestCase
- .assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiteral, rhs);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IntegerLiteral, IntegerLiteral, rhs);
}
void test_parseCascadeSection_p_builtIn() {
- PropertyAccess section =
- ParserTestCase.parse4("parseCascadeSection", "..as");
+ PropertyAccess section = parse4("parseCascadeSection", "..as");
expect(section.target, isNull);
expect(section.operator, isNotNull);
expect(section.propertyName, isNotNull);
}
void test_parseCascadeSection_pa() {
- MethodInvocation section =
- ParserTestCase.parse4("parseCascadeSection", "..a(b)");
+ MethodInvocation section = parse4("parseCascadeSection", "..a(b)");
expect(section.target, isNull);
expect(section.period, isNotNull);
expect(section.methodName, isNotNull);
@@ -5253,7 +5045,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseCascadeSection_paa() {
FunctionExpressionInvocation section =
- ParserTestCase.parse4("parseCascadeSection", "..a(b)(c)");
+ parse4("parseCascadeSection", "..a(b)(c)");
EngineTestCase.assertInstanceOf(
(obj) => obj is MethodInvocation, MethodInvocation, section.function);
expect(section.argumentList, isNotNull);
@@ -5262,7 +5054,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseCascadeSection_paapaa() {
FunctionExpressionInvocation section =
- ParserTestCase.parse4("parseCascadeSection", "..a(b)(c).d(e)(f)");
+ parse4("parseCascadeSection", "..a(b)(c).d(e)(f)");
EngineTestCase.assertInstanceOf(
(obj) => obj is MethodInvocation, MethodInvocation, section.function);
expect(section.argumentList, isNotNull);
@@ -5270,16 +5062,14 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCascadeSection_pap() {
- PropertyAccess section =
- ParserTestCase.parse4("parseCascadeSection", "..a(b).c");
+ PropertyAccess section = parse4("parseCascadeSection", "..a(b).c");
expect(section.target, isNotNull);
expect(section.operator, isNotNull);
expect(section.propertyName, isNotNull);
}
void test_parseClassDeclaration_abstract() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
emptyCommentAndMetadata(),
TokenFactory.tokenFromKeyword(Keyword.ABSTRACT)
], "class A {}");
@@ -5296,8 +5086,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_empty() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[emptyCommentAndMetadata(), null], "class A {}");
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
+ emptyCommentAndMetadata(),
+ null
+ ], "class A {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNull);
@@ -5311,8 +5103,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_extends() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[emptyCommentAndMetadata(), null], "class A extends B {}");
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
+ emptyCommentAndMetadata(),
+ null
+ ], "class A extends B {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNotNull);
@@ -5326,8 +5120,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_extendsAndImplements() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
emptyCommentAndMetadata(),
null
], "class A extends B implements C {}");
@@ -5344,8 +5137,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_extendsAndWith() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
emptyCommentAndMetadata(),
null
], "class A extends B with C {}");
@@ -5363,8 +5155,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_extendsAndWithAndImplements() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
emptyCommentAndMetadata(),
null
], "class A extends B with C implements D {}");
@@ -5382,8 +5173,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_implements() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[emptyCommentAndMetadata(), null], "class A implements C {}");
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
+ emptyCommentAndMetadata(),
+ null
+ ], "class A implements C {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNull);
@@ -5397,8 +5190,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_native() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
emptyCommentAndMetadata(),
null
], "class A native 'nativeValue' {}");
@@ -5411,8 +5203,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_nonEmpty() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[emptyCommentAndMetadata(), null], "class A {var f;}");
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
+ emptyCommentAndMetadata(),
+ null
+ ], "class A {var f;}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNull);
@@ -5426,8 +5220,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_typeAlias_implementsC() {
- ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration",
- <Object>[
+ ClassTypeAlias typeAlias = parse("parseClassDeclaration", <Object>[
emptyCommentAndMetadata(),
null
], "class A = Object with B implements C;");
@@ -5442,8 +5235,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_typeAlias_withB() {
- ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration",
- <Object>[emptyCommentAndMetadata(), null], "class A = Object with B;");
+ ClassTypeAlias typeAlias = parse("parseClassDeclaration", <Object>[
+ emptyCommentAndMetadata(),
+ null
+ ], "class A = Object with B;");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
@@ -5455,8 +5250,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_typeParameters() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration",
- <Object>[emptyCommentAndMetadata(), null], "class A<B> {}");
+ ClassDeclaration declaration = parse("parseClassDeclaration", <Object>[
+ emptyCommentAndMetadata(),
+ null
+ ], "class A<B> {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNull);
@@ -5473,10 +5270,8 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassMember_constructor_withInitializers() {
// TODO(brianwilkerson) Test other kinds of class members: fields, getters
// and setters.
- ConstructorDeclaration constructor = ParserTestCase.parse(
- "parseClassMember", <Object>[
- "C"
- ], "C(_, _\$, this.__) : _a = _ + _\$ {}");
+ ConstructorDeclaration constructor = parse("parseClassMember",
+ <Object>["C"], "C(_, _\$, this.__) : _a = _ + _\$ {}");
expect(constructor.body, isNotNull);
expect(constructor.separator, isNotNull);
expect(constructor.externalKeyword, isNull);
@@ -5490,8 +5285,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_field_instance_prefixedType() {
- FieldDeclaration field =
- ParserTestCase.parse("parseClassMember", <Object>["C"], "p.A f;");
+ FieldDeclaration field = parse("parseClassMember", <Object>["C"], "p.A f;");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -5505,7 +5299,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassMember_field_namedGet() {
FieldDeclaration field =
- ParserTestCase.parse("parseClassMember", <Object>["C"], "var get;");
+ parse("parseClassMember", <Object>["C"], "var get;");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -5518,8 +5312,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_field_namedOperator() {
- FieldDeclaration field = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "var operator;");
+ FieldDeclaration field =
+ parse("parseClassMember", <Object>["C"], "var operator;");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -5532,8 +5326,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_field_namedOperator_withAssignment() {
- FieldDeclaration field = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "var operator = (5);");
+ FieldDeclaration field =
+ parse("parseClassMember", <Object>["C"], "var operator = (5);");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -5548,7 +5342,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassMember_field_namedSet() {
FieldDeclaration field =
- ParserTestCase.parse("parseClassMember", <Object>["C"], "var set;");
+ parse("parseClassMember", <Object>["C"], "var set;");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -5561,8 +5355,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_getter_void() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "void get g {}");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "void get g {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5574,8 +5368,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_external() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "external m();");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "external m();");
expect(method.body, isNotNull);
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNotNull);
@@ -5588,8 +5382,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_external_withTypeAndArgs() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "external int m(int a);");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "external int m(int a);");
expect(method.body, isNotNull);
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNotNull);
@@ -5603,7 +5397,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassMember_method_get_noType() {
MethodDeclaration method =
- ParserTestCase.parse("parseClassMember", <Object>["C"], "get() {}");
+ parse("parseClassMember", <Object>["C"], "get() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5617,7 +5411,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassMember_method_get_type() {
MethodDeclaration method =
- ParserTestCase.parse("parseClassMember", <Object>["C"], "int get() {}");
+ parse("parseClassMember", <Object>["C"], "int get() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5630,8 +5424,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_get_void() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "void get() {}");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "void get() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5644,8 +5438,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_operator_noType() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "operator() {}");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "operator() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5658,8 +5452,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_operator_type() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "int operator() {}");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "int operator() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5672,8 +5466,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_operator_void() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "void operator() {}");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "void operator() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5687,7 +5481,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassMember_method_returnType_parameterized() {
MethodDeclaration method =
- ParserTestCase.parse("parseClassMember", <Object>["C"], "p.A m() {}");
+ parse("parseClassMember", <Object>["C"], "p.A m() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5701,7 +5495,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassMember_method_set_noType() {
MethodDeclaration method =
- ParserTestCase.parse("parseClassMember", <Object>["C"], "set() {}");
+ parse("parseClassMember", <Object>["C"], "set() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5715,7 +5509,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassMember_method_set_type() {
MethodDeclaration method =
- ParserTestCase.parse("parseClassMember", <Object>["C"], "int set() {}");
+ parse("parseClassMember", <Object>["C"], "int set() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5728,8 +5522,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_set_void() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "void set() {}");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "void set() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5742,8 +5536,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_operator_index() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "int operator [](int i) {}");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "int operator [](int i) {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5756,8 +5550,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_operator_indexAssign() {
- MethodDeclaration method = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "int operator []=(int i) {}");
+ MethodDeclaration method =
+ parse("parseClassMember", <Object>["C"], "int operator []=(int i) {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -5770,8 +5564,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_redirectingFactory_const() {
- ConstructorDeclaration constructor = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "const factory C() = B;");
+ ConstructorDeclaration constructor =
+ parse("parseClassMember", <Object>["C"], "const factory C() = B;");
expect(constructor.externalKeyword, isNull);
expect(constructor.constKeyword, isNotNull);
expect(constructor.factoryKeyword, isNotNull);
@@ -5786,8 +5580,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_redirectingFactory_nonConst() {
- ConstructorDeclaration constructor = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "factory C() = B;");
+ ConstructorDeclaration constructor =
+ parse("parseClassMember", <Object>["C"], "factory C() = B;");
expect(constructor.externalKeyword, isNull);
expect(constructor.constKeyword, isNull);
expect(constructor.factoryKeyword, isNotNull);
@@ -5804,8 +5598,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassTypeAlias_abstract() {
Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS);
Token abstractToken = TokenFactory.tokenFromKeyword(Keyword.ABSTRACT);
- ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias",
- <Object>[
+ ClassTypeAlias classTypeAlias = parse("parseClassTypeAlias", <Object>[
emptyCommentAndMetadata(),
abstractToken,
classToken
@@ -5822,8 +5615,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassTypeAlias_implements() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
- ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias",
- <Object>[
+ ClassTypeAlias classTypeAlias = parse("parseClassTypeAlias", <Object>[
emptyCommentAndMetadata(),
null,
token
@@ -5840,8 +5632,11 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassTypeAlias_with() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
- ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias",
- <Object>[emptyCommentAndMetadata(), null, token], "A = B with C;");
+ ClassTypeAlias classTypeAlias = parse("parseClassTypeAlias", <Object>[
+ emptyCommentAndMetadata(),
+ null,
+ token
+ ], "A = B with C;");
expect(classTypeAlias.typedefKeyword, isNotNull);
expect(classTypeAlias.name.name, "A");
expect(classTypeAlias.equals, isNotNull);
@@ -5854,8 +5649,7 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassTypeAlias_with_implements() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
- ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias",
- <Object>[
+ ClassTypeAlias classTypeAlias = parse("parseClassTypeAlias", <Object>[
emptyCommentAndMetadata(),
null,
token
@@ -5871,24 +5665,21 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCombinator_hide() {
- HideCombinator combinator =
- ParserTestCase.parse4('parseCombinator', 'hide a;');
+ HideCombinator combinator = parse4('parseCombinator', 'hide a;');
expect(combinator, new isInstanceOf<HideCombinator>());
expect(combinator.keyword, isNotNull);
expect(combinator.hiddenNames, hasLength(1));
}
void test_parseCombinator_show() {
- ShowCombinator combinator =
- ParserTestCase.parse4('parseCombinator', 'show a;');
+ ShowCombinator combinator = parse4('parseCombinator', 'show a;');
expect(combinator, new isInstanceOf<ShowCombinator>());
expect(combinator.keyword, isNotNull);
expect(combinator.shownNames, hasLength(1));
}
void test_parseCombinators_h() {
- List<Combinator> combinators =
- ParserTestCase.parse4("parseCombinators", "hide a;");
+ List<Combinator> combinators = parse4("parseCombinators", "hide a;");
expect(combinators, hasLength(1));
HideCombinator combinator = combinators[0] as HideCombinator;
expect(combinator, isNotNull);
@@ -5897,8 +5688,7 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCombinators_hs() {
- List<Combinator> combinators =
- ParserTestCase.parse4("parseCombinators", "hide a show b;");
+ List<Combinator> combinators = parse4("parseCombinators", "hide a show b;");
expect(combinators, hasLength(2));
HideCombinator hideCombinator = combinators[0] as HideCombinator;
expect(hideCombinator, isNotNull);
@@ -5911,14 +5701,13 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCombinators_hshs() {
- List<Combinator> combinators = ParserTestCase.parse4(
- "parseCombinators", "hide a show b hide c show d;");
+ List<Combinator> combinators =
+ parse4("parseCombinators", "hide a show b hide c show d;");
expect(combinators, hasLength(4));
}
void test_parseCombinators_s() {
- List<Combinator> combinators =
- ParserTestCase.parse4("parseCombinators", "show a;");
+ List<Combinator> combinators = parse4("parseCombinators", "show a;");
expect(combinators, hasLength(1));
ShowCombinator combinator = combinators[0] as ShowCombinator;
expect(combinator, isNotNull);
@@ -5928,70 +5717,70 @@ class SimpleParserTest extends ParserTestCase {
void test_parseCommentAndMetadata_c() {
CommentAndMetadata commentAndMetadata =
- ParserTestCase.parse4("parseCommentAndMetadata", "/** 1 */ void");
+ parse4("parseCommentAndMetadata", "/** 1 */ void");
expect(commentAndMetadata.comment, isNotNull);
expect(commentAndMetadata.metadata, hasLength(0));
}
void test_parseCommentAndMetadata_cmc() {
- CommentAndMetadata commentAndMetadata = ParserTestCase.parse4(
- "parseCommentAndMetadata", "/** 1 */ @A /** 2 */ void");
+ CommentAndMetadata commentAndMetadata =
+ parse4("parseCommentAndMetadata", "/** 1 */ @A /** 2 */ void");
expect(commentAndMetadata.comment, isNotNull);
expect(commentAndMetadata.metadata, hasLength(1));
}
void test_parseCommentAndMetadata_cmcm() {
- CommentAndMetadata commentAndMetadata = ParserTestCase.parse4(
- "parseCommentAndMetadata", "/** 1 */ @A /** 2 */ @B void");
+ CommentAndMetadata commentAndMetadata =
+ parse4("parseCommentAndMetadata", "/** 1 */ @A /** 2 */ @B void");
expect(commentAndMetadata.comment, isNotNull);
expect(commentAndMetadata.metadata, hasLength(2));
}
void test_parseCommentAndMetadata_cmm() {
CommentAndMetadata commentAndMetadata =
- ParserTestCase.parse4("parseCommentAndMetadata", "/** 1 */ @A @B void");
+ parse4("parseCommentAndMetadata", "/** 1 */ @A @B void");
expect(commentAndMetadata.comment, isNotNull);
expect(commentAndMetadata.metadata, hasLength(2));
}
void test_parseCommentAndMetadata_m() {
CommentAndMetadata commentAndMetadata =
- ParserTestCase.parse4("parseCommentAndMetadata", "@A void");
+ parse4("parseCommentAndMetadata", "@A void");
expect(commentAndMetadata.comment, isNull);
expect(commentAndMetadata.metadata, hasLength(1));
}
void test_parseCommentAndMetadata_mcm() {
CommentAndMetadata commentAndMetadata =
- ParserTestCase.parse4("parseCommentAndMetadata", "@A /** 1 */ @B void");
+ parse4("parseCommentAndMetadata", "@A /** 1 */ @B void");
expect(commentAndMetadata.comment, isNotNull);
expect(commentAndMetadata.metadata, hasLength(2));
}
void test_parseCommentAndMetadata_mcmc() {
- CommentAndMetadata commentAndMetadata = ParserTestCase.parse4(
- "parseCommentAndMetadata", "@A /** 1 */ @B /** 2 */ void");
+ CommentAndMetadata commentAndMetadata =
+ parse4("parseCommentAndMetadata", "@A /** 1 */ @B /** 2 */ void");
expect(commentAndMetadata.comment, isNotNull);
expect(commentAndMetadata.metadata, hasLength(2));
}
void test_parseCommentAndMetadata_mm() {
CommentAndMetadata commentAndMetadata =
- ParserTestCase.parse4("parseCommentAndMetadata", "@A @B(x) void");
+ parse4("parseCommentAndMetadata", "@A @B(x) void");
expect(commentAndMetadata.comment, isNull);
expect(commentAndMetadata.metadata, hasLength(2));
}
void test_parseCommentAndMetadata_none() {
CommentAndMetadata commentAndMetadata =
- ParserTestCase.parse4("parseCommentAndMetadata", "void");
+ parse4("parseCommentAndMetadata", "void");
expect(commentAndMetadata.comment, isNull);
expect(commentAndMetadata.metadata, hasLength(0));
}
void test_parseCommentAndMetadata_singleLine() {
- CommentAndMetadata commentAndMetadata = ParserTestCase.parse4(
- "parseCommentAndMetadata", r'''
+ CommentAndMetadata commentAndMetadata = parse4("parseCommentAndMetadata",
+ r'''
/// 1
/// 2
void''');
@@ -6000,8 +5789,8 @@ void''');
}
void test_parseCommentReference_new_prefixed() {
- CommentReference reference = ParserTestCase.parse(
- "parseCommentReference", <Object>["new a.b", 7], "");
+ CommentReference reference =
+ parse("parseCommentReference", <Object>["new a.b", 7], "");
PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(
(obj) => obj is PrefixedIdentifier, PrefixedIdentifier,
reference.identifier);
@@ -6018,7 +5807,7 @@ void''');
void test_parseCommentReference_new_simple() {
CommentReference reference =
- ParserTestCase.parse("parseCommentReference", <Object>["new a", 5], "");
+ parse("parseCommentReference", <Object>["new a", 5], "");
SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
(obj) => obj is SimpleIdentifier, SimpleIdentifier,
reference.identifier);
@@ -6029,7 +5818,7 @@ void''');
void test_parseCommentReference_prefixed() {
CommentReference reference =
- ParserTestCase.parse("parseCommentReference", <Object>["a.b", 7], "");
+ parse("parseCommentReference", <Object>["a.b", 7], "");
PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(
(obj) => obj is PrefixedIdentifier, PrefixedIdentifier,
reference.identifier);
@@ -6046,7 +5835,7 @@ void''');
void test_parseCommentReference_simple() {
CommentReference reference =
- ParserTestCase.parse("parseCommentReference", <Object>["a", 5], "");
+ parse("parseCommentReference", <Object>["a", 5], "");
SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
(obj) => obj is SimpleIdentifier, SimpleIdentifier,
reference.identifier);
@@ -6057,7 +5846,7 @@ void''');
void test_parseCommentReference_synthetic() {
CommentReference reference =
- ParserTestCase.parse("parseCommentReference", <Object>["", 5], "");
+ parse("parseCommentReference", <Object>["", 5], "");
SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
(obj) => obj is SimpleIdentifier, SimpleIdentifier,
reference.identifier);
@@ -6073,7 +5862,7 @@ void''');
TokenType.MULTI_LINE_COMMENT, "/** xxx [a] yyy [bb] zzz */", 3);
List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[token];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
List<Token> tokenReferences = token.references;
expect(references, hasLength(2));
expect(tokenReferences, hasLength(2));
@@ -6105,7 +5894,7 @@ void''');
TokenType.MULTI_LINE_COMMENT, "/** [ some text", 5)
];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -6120,7 +5909,7 @@ void''');
TokenType.MULTI_LINE_COMMENT, "/** [namePrefix some text", 5)
];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -6137,7 +5926,7 @@ void''');
TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)
];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(3));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -6159,7 +5948,7 @@ void''');
TokenType.MULTI_LINE_COMMENT, "/** [:xxx [a] yyy:] [b] zzz */", 3)
];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -6173,7 +5962,7 @@ void''');
"/**\n * a[i]\n * xxx [i] zzz\n */", 3)
];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -6187,7 +5976,7 @@ void''');
"/** [a]: http://www.google.com (Google) [b] zzz */", 3)
];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -6201,7 +5990,7 @@ void''');
"/** [a](http://www.google.com) [b] zzz */", 3)
];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -6215,7 +6004,7 @@ void''');
TokenType.MULTI_LINE_COMMENT, "/** [a][c] [b] zzz */", 3)
];
List<CommentReference> references =
- ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
+ parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -6224,7 +6013,7 @@ void''');
}
void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit",
+ CompilationUnit unit = parse4("parseCompilationUnit",
"abstract<dynamic> _abstract = new abstract.A();");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
@@ -6232,56 +6021,55 @@ void''');
}
void test_parseCompilationUnit_builtIn_asFunctionName() {
- ParserTestCase.parse4("parseCompilationUnit", "abstract(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "as(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "dynamic(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "export(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "external(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "factory(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "get(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "implements(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "import(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "library(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "operator(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "part(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "set(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "static(x) => 0;");
- ParserTestCase.parse4("parseCompilationUnit", "typedef(x) => 0;");
+ parse4("parseCompilationUnit", "abstract(x) => 0;");
+ parse4("parseCompilationUnit", "as(x) => 0;");
+ parse4("parseCompilationUnit", "dynamic(x) => 0;");
+ parse4("parseCompilationUnit", "export(x) => 0;");
+ parse4("parseCompilationUnit", "external(x) => 0;");
+ parse4("parseCompilationUnit", "factory(x) => 0;");
+ parse4("parseCompilationUnit", "get(x) => 0;");
+ parse4("parseCompilationUnit", "implements(x) => 0;");
+ parse4("parseCompilationUnit", "import(x) => 0;");
+ parse4("parseCompilationUnit", "library(x) => 0;");
+ parse4("parseCompilationUnit", "operator(x) => 0;");
+ parse4("parseCompilationUnit", "part(x) => 0;");
+ parse4("parseCompilationUnit", "set(x) => 0;");
+ parse4("parseCompilationUnit", "static(x) => 0;");
+ parse4("parseCompilationUnit", "typedef(x) => 0;");
}
void test_parseCompilationUnit_directives_multiple() {
- CompilationUnit unit = ParserTestCase.parse4(
- "parseCompilationUnit", "library l;\npart 'a.dart';");
+ CompilationUnit unit =
+ parse4("parseCompilationUnit", "library l;\npart 'a.dart';");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(2));
expect(unit.declarations, hasLength(0));
}
void test_parseCompilationUnit_directives_single() {
- CompilationUnit unit =
- ParserTestCase.parse4("parseCompilationUnit", "library l;");
+ CompilationUnit unit = parse4("parseCompilationUnit", "library l;");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(1));
expect(unit.declarations, hasLength(0));
}
void test_parseCompilationUnit_empty() {
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "");
+ CompilationUnit unit = parse4("parseCompilationUnit", "");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(0));
}
void test_parseCompilationUnit_exportAsPrefix() {
- CompilationUnit unit = ParserTestCase.parse4(
- "parseCompilationUnit", "export.A _export = new export.A();");
+ CompilationUnit unit =
+ parse4("parseCompilationUnit", "export.A _export = new export.A();");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(1));
}
void test_parseCompilationUnit_exportAsPrefix_parameterized() {
- CompilationUnit unit = ParserTestCase.parse4(
+ CompilationUnit unit = parse4(
"parseCompilationUnit", "export<dynamic> _export = new export.A();");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
@@ -6289,7 +6077,7 @@ void''');
}
void test_parseCompilationUnit_operatorAsPrefix_parameterized() {
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit",
+ CompilationUnit unit = parse4("parseCompilationUnit",
"operator<dynamic> _operator = new operator.A();");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
@@ -6297,8 +6085,7 @@ void''');
}
void test_parseCompilationUnit_script() {
- CompilationUnit unit =
- ParserTestCase.parse4("parseCompilationUnit", "#! /bin/dart");
+ CompilationUnit unit = parse4("parseCompilationUnit", "#! /bin/dart");
expect(unit.scriptTag, isNotNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(0));
@@ -6306,199 +6093,164 @@ void''');
void test_parseCompilationUnit_skipFunctionBody_withInterpolation() {
ParserTestCase.parseFunctionBodies = false;
- CompilationUnit unit =
- ParserTestCase.parse4("parseCompilationUnit", "f() { '\${n}'; }");
+ CompilationUnit unit = parse4("parseCompilationUnit", "f() { '\${n}'; }");
expect(unit.scriptTag, isNull);
expect(unit.declarations, hasLength(1));
}
void test_parseCompilationUnit_topLevelDeclaration() {
- CompilationUnit unit =
- ParserTestCase.parse4("parseCompilationUnit", "class A {}");
+ CompilationUnit unit = parse4("parseCompilationUnit", "class A {}");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(1));
}
void test_parseCompilationUnit_typedefAsPrefix() {
- CompilationUnit unit = ParserTestCase.parse4(
- "parseCompilationUnit", "typedef.A _typedef = new typedef.A();");
+ CompilationUnit unit =
+ parse4("parseCompilationUnit", "typedef.A _typedef = new typedef.A();");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(1));
}
void test_parseCompilationUnitMember_abstractAsPrefix() {
- TopLevelVariableDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "abstract.A _abstract = new abstract.A();");
+ TopLevelVariableDeclaration declaration = parse(
+ "parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "abstract.A _abstract = new abstract.A();");
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
}
void test_parseCompilationUnitMember_class() {
- ClassDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "class A {}");
+ ClassDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "class A {}");
expect(declaration.name.name, "A");
expect(declaration.members, hasLength(0));
}
void test_parseCompilationUnitMember_classTypeAlias() {
- ClassTypeAlias alias = ParserTestCase.parse("parseCompilationUnitMember",
+ ClassTypeAlias alias = parse("parseCompilationUnitMember",
<Object>[emptyCommentAndMetadata()], "abstract class A = B with C;");
expect(alias.name.name, "A");
expect(alias.abstractKeyword, isNotNull);
}
void test_parseCompilationUnitMember_constVariable() {
- TopLevelVariableDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "const int x = 0;");
+ TopLevelVariableDeclaration declaration = parse(
+ "parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "const int x = 0;");
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
}
void test_parseCompilationUnitMember_finalVariable() {
- TopLevelVariableDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "final x = 0;");
+ TopLevelVariableDeclaration declaration = parse(
+ "parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "final x = 0;");
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
}
void test_parseCompilationUnitMember_function_external_noType() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "external f();");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "external f();");
expect(declaration.externalKeyword, isNotNull);
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNull);
}
void test_parseCompilationUnitMember_function_external_type() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "external int f();");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "external int f();");
expect(declaration.externalKeyword, isNotNull);
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNull);
}
void test_parseCompilationUnitMember_function_noType() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "f() {}");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "f() {}");
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNull);
}
void test_parseCompilationUnitMember_function_type() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "int f() {}");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "int f() {}");
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNull);
}
void test_parseCompilationUnitMember_function_void() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "void f() {}");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "void f() {}");
expect(declaration.returnType, isNotNull);
}
void test_parseCompilationUnitMember_getter_external_noType() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "external get p;");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "external get p;");
expect(declaration.externalKeyword, isNotNull);
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNotNull);
}
void test_parseCompilationUnitMember_getter_external_type() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "external int get p;");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "external int get p;");
expect(declaration.externalKeyword, isNotNull);
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNotNull);
}
void test_parseCompilationUnitMember_getter_noType() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "get p => 0;");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "get p => 0;");
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNotNull);
}
void test_parseCompilationUnitMember_getter_type() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "int get p => 0;");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "int get p => 0;");
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNotNull);
}
void test_parseCompilationUnitMember_setter_external_noType() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "external set p(v);");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "external set p(v);");
expect(declaration.externalKeyword, isNotNull);
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNotNull);
}
void test_parseCompilationUnitMember_setter_external_type() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "external void set p(int v);");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "external void set p(int v);");
expect(declaration.externalKeyword, isNotNull);
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNotNull);
}
void test_parseCompilationUnitMember_setter_noType() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "set p(v) {}");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "set p(v) {}");
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNotNull);
}
void test_parseCompilationUnitMember_setter_type() {
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "void set p(int v) {}");
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "void set p(int v) {}");
expect(declaration.functionExpression, isNotNull);
expect(declaration.propertyKeyword, isNotNull);
expect(declaration.returnType, isNotNull);
}
void test_parseCompilationUnitMember_typeAlias_abstract() {
- ClassTypeAlias typeAlias = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "abstract class C = S with M;");
+ ClassTypeAlias typeAlias = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "abstract class C = S with M;");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name.name, "C");
expect(typeAlias.typeParameters, isNull);
@@ -6511,10 +6263,9 @@ void''');
}
void test_parseCompilationUnitMember_typeAlias_generic() {
- ClassTypeAlias typeAlias = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "class C<E> = S<E> with M<E> implements I<E>;");
+ ClassTypeAlias typeAlias = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "class C<E> = S<E> with M<E> implements I<E>;");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name.name, "C");
expect(typeAlias.typeParameters.typeParameters, hasLength(1));
@@ -6527,10 +6278,9 @@ void''');
}
void test_parseCompilationUnitMember_typeAlias_implements() {
- ClassTypeAlias typeAlias = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "class C = S with M implements I;");
+ ClassTypeAlias typeAlias = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "class C = S with M implements I;");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name.name, "C");
expect(typeAlias.typeParameters, isNull);
@@ -6543,10 +6293,8 @@ void''');
}
void test_parseCompilationUnitMember_typeAlias_noImplements() {
- ClassTypeAlias typeAlias = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "class C = S with M;");
+ ClassTypeAlias typeAlias = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "class C = S with M;");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name.name, "C");
expect(typeAlias.typeParameters, isNull);
@@ -6559,44 +6307,39 @@ void''');
}
void test_parseCompilationUnitMember_typedef() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "typedef F();");
+ FunctionTypeAlias typeAlias = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "typedef F();");
expect(typeAlias.name.name, "F");
expect(typeAlias.parameters.parameters, hasLength(0));
}
void test_parseCompilationUnitMember_variable() {
- TopLevelVariableDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "var x = 0;");
+ TopLevelVariableDeclaration declaration = parse(
+ "parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "var x = 0;");
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
}
void test_parseCompilationUnitMember_variableGet() {
- TopLevelVariableDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "String get = null;");
+ TopLevelVariableDeclaration declaration = parse(
+ "parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "String get = null;");
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
}
void test_parseCompilationUnitMember_variableSet() {
- TopLevelVariableDeclaration declaration = ParserTestCase.parse(
- "parseCompilationUnitMember", <Object>[
- emptyCommentAndMetadata()
- ], "String set = null;");
+ TopLevelVariableDeclaration declaration = parse(
+ "parseCompilationUnitMember", <Object>[emptyCommentAndMetadata()],
+ "String set = null;");
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
}
void test_parseConditionalExpression() {
ConditionalExpression expression =
- ParserTestCase.parse4("parseConditionalExpression", "x ? y : z");
+ parse4("parseConditionalExpression", "x ? y : z");
expect(expression.condition, isNotNull);
expect(expression.question, isNotNull);
expect(expression.thenExpression, isNotNull);
@@ -6606,7 +6349,7 @@ void''');
void test_parseConstExpression_instanceCreation() {
InstanceCreationExpression expression =
- ParserTestCase.parse4("parseConstExpression", "const A()");
+ parse4("parseConstExpression", "const A()");
expect(expression.keyword, isNotNull);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -6617,8 +6360,7 @@ void''');
}
void test_parseConstExpression_listLiteral_typed() {
- ListLiteral literal =
- ParserTestCase.parse4("parseConstExpression", "const <A> []");
+ ListLiteral literal = parse4("parseConstExpression", "const <A> []");
expect(literal.constKeyword, isNotNull);
expect(literal.typeArguments, isNotNull);
expect(literal.leftBracket, isNotNull);
@@ -6627,8 +6369,7 @@ void''');
}
void test_parseConstExpression_listLiteral_untyped() {
- ListLiteral literal =
- ParserTestCase.parse4("parseConstExpression", "const []");
+ ListLiteral literal = parse4("parseConstExpression", "const []");
expect(literal.constKeyword, isNotNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -6637,8 +6378,7 @@ void''');
}
void test_parseConstExpression_mapLiteral_typed() {
- MapLiteral literal =
- ParserTestCase.parse4("parseConstExpression", "const <A, B> {}");
+ MapLiteral literal = parse4("parseConstExpression", "const <A, B> {}");
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(0));
expect(literal.rightBracket, isNotNull);
@@ -6646,8 +6386,7 @@ void''');
}
void test_parseConstExpression_mapLiteral_untyped() {
- MapLiteral literal =
- ParserTestCase.parse4("parseConstExpression", "const {}");
+ MapLiteral literal = parse4("parseConstExpression", "const {}");
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(0));
expect(literal.rightBracket, isNotNull);
@@ -6665,8 +6404,8 @@ void''');
void test_parseConstructor_with_pseudo_function_literal() {
// "(b) {}" should not be misinterpreted as a function literal even though
// it looks like one.
- ClassMember classMember = ParserTestCase.parse(
- "parseClassMember", <Object>["C"], "C() : a = (b) {}");
+ ClassMember classMember =
+ parse("parseClassMember", <Object>["C"], "C() : a = (b) {}");
EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration,
ConstructorDeclaration, classMember);
ConstructorDeclaration constructor = classMember as ConstructorDeclaration;
@@ -6684,7 +6423,7 @@ void''');
void test_parseConstructorFieldInitializer_qualified() {
ConstructorFieldInitializer invocation =
- ParserTestCase.parse4("parseConstructorFieldInitializer", "this.a = b");
+ parse4("parseConstructorFieldInitializer", "this.a = b");
expect(invocation.equals, isNotNull);
expect(invocation.expression, isNotNull);
expect(invocation.fieldName, isNotNull);
@@ -6694,7 +6433,7 @@ void''');
void test_parseConstructorFieldInitializer_unqualified() {
ConstructorFieldInitializer invocation =
- ParserTestCase.parse4("parseConstructorFieldInitializer", "a = b");
+ parse4("parseConstructorFieldInitializer", "a = b");
expect(invocation.equals, isNotNull);
expect(invocation.expression, isNotNull);
expect(invocation.fieldName, isNotNull);
@@ -6703,60 +6442,52 @@ void''');
}
void test_parseConstructorName_named_noPrefix() {
- ConstructorName name =
- ParserTestCase.parse4("parseConstructorName", "A.n;");
+ ConstructorName name = parse4("parseConstructorName", "A.n;");
expect(name.type, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
void test_parseConstructorName_named_prefixed() {
- ConstructorName name =
- ParserTestCase.parse4("parseConstructorName", "p.A.n;");
+ ConstructorName name = parse4("parseConstructorName", "p.A.n;");
expect(name.type, isNotNull);
expect(name.period, isNotNull);
expect(name.name, isNotNull);
}
void test_parseConstructorName_unnamed_noPrefix() {
- ConstructorName name = ParserTestCase.parse4("parseConstructorName", "A;");
+ ConstructorName name = parse4("parseConstructorName", "A;");
expect(name.type, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
void test_parseConstructorName_unnamed_prefixed() {
- ConstructorName name =
- ParserTestCase.parse4("parseConstructorName", "p.A;");
+ ConstructorName name = parse4("parseConstructorName", "p.A;");
expect(name.type, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
void test_parseContinueStatement_label() {
- ContinueStatement statement = ParserTestCase.parse4(
- "parseContinueStatement", "continue foo;", [
- ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP
- ]);
+ ContinueStatement statement = parse4("parseContinueStatement",
+ "continue foo;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
expect(statement.continueKeyword, isNotNull);
expect(statement.label, isNotNull);
expect(statement.semicolon, isNotNull);
}
void test_parseContinueStatement_noLabel() {
- ContinueStatement statement = ParserTestCase.parse4(
- "parseContinueStatement", "continue;", [
- ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP
- ]);
+ ContinueStatement statement = parse4("parseContinueStatement", "continue;",
+ [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
expect(statement.continueKeyword, isNotNull);
expect(statement.label, isNull);
expect(statement.semicolon, isNotNull);
}
void test_parseDirective_export() {
- ExportDirective directive = ParserTestCase.parse("parseDirective", <Object>[
- emptyCommentAndMetadata()
- ], "export 'lib/lib.dart';");
+ ExportDirective directive = parse("parseDirective",
+ <Object>[emptyCommentAndMetadata()], "export 'lib/lib.dart';");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(0));
@@ -6764,9 +6495,8 @@ void''');
}
void test_parseDirective_import() {
- ImportDirective directive = ParserTestCase.parse("parseDirective", <Object>[
- emptyCommentAndMetadata()
- ], "import 'lib/lib.dart';");
+ ImportDirective directive = parse("parseDirective",
+ <Object>[emptyCommentAndMetadata()], "import 'lib/lib.dart';");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.asKeyword, isNull);
@@ -6776,7 +6506,7 @@ void''');
}
void test_parseDirective_library() {
- LibraryDirective directive = ParserTestCase.parse(
+ LibraryDirective directive = parse(
"parseDirective", <Object>[emptyCommentAndMetadata()], "library l;");
expect(directive.libraryKeyword, isNotNull);
expect(directive.name, isNotNull);
@@ -6784,16 +6514,15 @@ void''');
}
void test_parseDirective_part() {
- PartDirective directive = ParserTestCase.parse("parseDirective", <Object>[
- emptyCommentAndMetadata()
- ], "part 'lib/lib.dart';");
+ PartDirective directive = parse("parseDirective",
+ <Object>[emptyCommentAndMetadata()], "part 'lib/lib.dart';");
expect(directive.partKeyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.semicolon, isNotNull);
}
void test_parseDirective_partOf() {
- PartOfDirective directive = ParserTestCase.parse(
+ PartOfDirective directive = parse(
"parseDirective", <Object>[emptyCommentAndMetadata()], "part of l;");
expect(directive.partKeyword, isNotNull);
expect(directive.ofKeyword, isNotNull);
@@ -6846,16 +6575,14 @@ void''');
}
void test_parseDocumentationComment_block() {
- Comment comment =
- ParserTestCase.parse4("parseDocumentationComment", "/** */ class");
+ Comment comment = parse4("parseDocumentationComment", "/** */ class");
expect(comment.isBlock, isFalse);
expect(comment.isDocumentation, isTrue);
expect(comment.isEndOfLine, isFalse);
}
void test_parseDocumentationComment_block_withReference() {
- Comment comment =
- ParserTestCase.parse4("parseDocumentationComment", "/** [a] */ class");
+ Comment comment = parse4("parseDocumentationComment", "/** [a] */ class");
expect(comment.isBlock, isFalse);
expect(comment.isDocumentation, isTrue);
expect(comment.isEndOfLine, isFalse);
@@ -6867,16 +6594,14 @@ void''');
}
void test_parseDocumentationComment_endOfLine() {
- Comment comment = ParserTestCase.parse4(
- "parseDocumentationComment", "/// \n/// \n class");
+ Comment comment = parse4("parseDocumentationComment", "/// \n/// \n class");
expect(comment.isBlock, isFalse);
expect(comment.isDocumentation, isTrue);
expect(comment.isEndOfLine, isFalse);
}
void test_parseDoStatement() {
- DoStatement statement =
- ParserTestCase.parse4("parseDoStatement", "do {} while (x);");
+ DoStatement statement = parse4("parseDoStatement", "do {} while (x);");
expect(statement.doKeyword, isNotNull);
expect(statement.body, isNotNull);
expect(statement.whileKeyword, isNotNull);
@@ -6887,13 +6612,12 @@ void''');
}
void test_parseEmptyStatement() {
- EmptyStatement statement =
- ParserTestCase.parse4("parseEmptyStatement", ";");
+ EmptyStatement statement = parse4("parseEmptyStatement", ";");
expect(statement.semicolon, isNotNull);
}
void test_parseEnumDeclaration_one() {
- EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration",
+ EnumDeclaration declaration = parse("parseEnumDeclaration",
<Object>[emptyCommentAndMetadata()], "enum E {ONE}");
expect(declaration.documentationComment, isNull);
expect(declaration.enumKeyword, isNotNull);
@@ -6904,7 +6628,7 @@ void''');
}
void test_parseEnumDeclaration_trailingComma() {
- EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration",
+ EnumDeclaration declaration = parse("parseEnumDeclaration",
<Object>[emptyCommentAndMetadata()], "enum E {ONE,}");
expect(declaration.documentationComment, isNull);
expect(declaration.enumKeyword, isNotNull);
@@ -6915,7 +6639,7 @@ void''');
}
void test_parseEnumDeclaration_two() {
- EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration",
+ EnumDeclaration declaration = parse("parseEnumDeclaration",
<Object>[emptyCommentAndMetadata()], "enum E {ONE, TWO}");
expect(declaration.documentationComment, isNull);
expect(declaration.enumKeyword, isNotNull);
@@ -6926,8 +6650,7 @@ void''');
}
void test_parseEqualityExpression_normal() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseEqualityExpression", "x == y");
+ BinaryExpression expression = parse4("parseEqualityExpression", "x == y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ_EQ);
@@ -6936,7 +6659,7 @@ void''');
void test_parseEqualityExpression_super() {
BinaryExpression expression =
- ParserTestCase.parse4("parseEqualityExpression", "super == y");
+ parse4("parseEqualityExpression", "super == y");
EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression,
SuperExpression, expression.leftOperand);
expect(expression.operator, isNotNull);
@@ -6945,10 +6668,9 @@ void''');
}
void test_parseExportDirective_hide() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "export 'lib/lib.dart' hide A, B;");
+ ExportDirective directive = parse("parseExportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "export 'lib/lib.dart' hide A, B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(1));
@@ -6956,10 +6678,9 @@ void''');
}
void test_parseExportDirective_hide_show() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "export 'lib/lib.dart' hide A show B;");
+ ExportDirective directive = parse("parseExportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "export 'lib/lib.dart' hide A show B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(2));
@@ -6967,7 +6688,7 @@ void''');
}
void test_parseExportDirective_noCombinator() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective",
+ ExportDirective directive = parse("parseExportDirective",
<Object>[emptyCommentAndMetadata()], "export 'lib/lib.dart';");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
@@ -6976,10 +6697,9 @@ void''');
}
void test_parseExportDirective_show() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "export 'lib/lib.dart' show A, B;");
+ ExportDirective directive = parse("parseExportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "export 'lib/lib.dart' show A, B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(1));
@@ -6987,10 +6707,9 @@ void''');
}
void test_parseExportDirective_show_hide() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "export 'lib/lib.dart' show B hide A;");
+ ExportDirective directive = parse("parseExportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "export 'lib/lib.dart' show B hide A;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(2));
@@ -6999,8 +6718,7 @@ void''');
void test_parseExpression_assign() {
// TODO(brianwilkerson) Implement more tests for this method.
- AssignmentExpression expression =
- ParserTestCase.parse4("parseExpression", "x = y");
+ AssignmentExpression expression = parse4("parseExpression", "x = y");
expect(expression.leftHandSide, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ);
@@ -7008,8 +6726,7 @@ void''');
}
void test_parseExpression_comparison() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseExpression", "--a.b == c");
+ BinaryExpression expression = parse4("parseExpression", "--a.b == c");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ_EQ);
@@ -7017,8 +6734,7 @@ void''');
}
void test_parseExpression_function_async() {
- FunctionExpression expression =
- ParserTestCase.parseExpression("() async {}");
+ FunctionExpression expression = parseExpression("() async {}");
expect(expression.body, isNotNull);
expect(expression.body.isAsynchronous, isTrue);
expect(expression.body.isGenerator, isFalse);
@@ -7026,8 +6742,7 @@ void''');
}
void test_parseExpression_function_asyncStar() {
- FunctionExpression expression =
- ParserTestCase.parseExpression("() async* {}");
+ FunctionExpression expression = parseExpression("() async* {}");
expect(expression.body, isNotNull);
expect(expression.body.isAsynchronous, isTrue);
expect(expression.body.isGenerator, isTrue);
@@ -7035,7 +6750,7 @@ void''');
}
void test_parseExpression_function_sync() {
- FunctionExpression expression = ParserTestCase.parseExpression("() {}");
+ FunctionExpression expression = parseExpression("() {}");
expect(expression.body, isNotNull);
expect(expression.body.isAsynchronous, isFalse);
expect(expression.body.isGenerator, isFalse);
@@ -7043,8 +6758,7 @@ void''');
}
void test_parseExpression_function_syncStar() {
- FunctionExpression expression =
- ParserTestCase.parseExpression("() sync* {}");
+ FunctionExpression expression = parseExpression("() sync* {}");
expect(expression.body, isNotNull);
expect(expression.body.isAsynchronous, isFalse);
expect(expression.body.isGenerator, isTrue);
@@ -7053,7 +6767,7 @@ void''');
void test_parseExpression_invokeFunctionExpression() {
FunctionExpressionInvocation invocation =
- ParserTestCase.parse4("parseExpression", "(a) {return a + a;} (3)");
+ parse4("parseExpression", "(a) {return a + a;} (3)");
EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression,
FunctionExpression, invocation.function);
FunctionExpression expression = invocation.function as FunctionExpression;
@@ -7065,33 +6779,31 @@ void''');
}
void test_parseExpression_nonAwait() {
- MethodInvocation expression = ParserTestCase.parseExpression("await()");
+ MethodInvocation expression = parseExpression("await()");
expect(expression.methodName.name, 'await');
}
void test_parseExpression_superMethodInvocation() {
- MethodInvocation invocation =
- ParserTestCase.parse4("parseExpression", "super.m()");
+ MethodInvocation invocation = parse4("parseExpression", "super.m()");
expect(invocation.target, isNotNull);
expect(invocation.methodName, isNotNull);
expect(invocation.argumentList, isNotNull);
}
void test_parseExpressionList_multiple() {
- List<Expression> result =
- ParserTestCase.parse4("parseExpressionList", "1, 2, 3");
+ List<Expression> result = parse4("parseExpressionList", "1, 2, 3");
expect(result, hasLength(3));
}
void test_parseExpressionList_single() {
- List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1");
+ List<Expression> result = parse4("parseExpressionList", "1");
expect(result, hasLength(1));
}
void test_parseExpressionWithoutCascade_assign() {
// TODO(brianwilkerson) Implement more tests for this method.
AssignmentExpression expression =
- ParserTestCase.parse4("parseExpressionWithoutCascade", "x = y");
+ parse4("parseExpressionWithoutCascade", "x = y");
expect(expression.leftHandSide, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ);
@@ -7100,7 +6812,7 @@ void''');
void test_parseExpressionWithoutCascade_comparison() {
BinaryExpression expression =
- ParserTestCase.parse4("parseExpressionWithoutCascade", "--a.b == c");
+ parse4("parseExpressionWithoutCascade", "--a.b == c");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ_EQ);
@@ -7109,15 +6821,14 @@ void''');
void test_parseExpressionWithoutCascade_superMethodInvocation() {
MethodInvocation invocation =
- ParserTestCase.parse4("parseExpressionWithoutCascade", "super.m()");
+ parse4("parseExpressionWithoutCascade", "super.m()");
expect(invocation.target, isNotNull);
expect(invocation.methodName, isNotNull);
expect(invocation.argumentList, isNotNull);
}
void test_parseExtendsClause() {
- ExtendsClause clause =
- ParserTestCase.parse4("parseExtendsClause", "extends B");
+ ExtendsClause clause = parse4("parseExtendsClause", "extends B");
expect(clause.extendsKeyword, isNotNull);
expect(clause.superclass, isNotNull);
EngineTestCase.assertInstanceOf(
@@ -7125,8 +6836,8 @@ void''');
}
void test_parseFinalConstVarOrType_const_noType() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "const");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "const");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -7135,8 +6846,8 @@ void''');
}
void test_parseFinalConstVarOrType_const_type() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "const A a");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "const A a");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -7145,8 +6856,8 @@ void''');
}
void test_parseFinalConstVarOrType_final_noType() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "final");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "final");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -7155,8 +6866,8 @@ void''');
}
void test_parseFinalConstVarOrType_final_prefixedType() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "final p.A a");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "final p.A a");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -7165,8 +6876,8 @@ void''');
}
void test_parseFinalConstVarOrType_final_type() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "final A a");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "final A a");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -7175,43 +6886,43 @@ void''');
}
void test_parseFinalConstVarOrType_type_parameterized() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "A<B> a");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "A<B> a");
expect(result.keyword, isNull);
expect(result.type, isNotNull);
}
void test_parseFinalConstVarOrType_type_prefixed() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "p.A a");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "p.A a");
expect(result.keyword, isNull);
expect(result.type, isNotNull);
}
void test_parseFinalConstVarOrType_type_prefixed_noIdentifier() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "p.A,");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "p.A,");
expect(result.keyword, isNull);
expect(result.type, isNotNull);
}
void test_parseFinalConstVarOrType_type_prefixedAndParameterized() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "p.A<B> a");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "p.A<B> a");
expect(result.keyword, isNull);
expect(result.type, isNotNull);
}
void test_parseFinalConstVarOrType_type_simple() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "A a");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "A a");
expect(result.keyword, isNull);
expect(result.type, isNotNull);
}
void test_parseFinalConstVarOrType_var() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "var");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "var");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -7220,23 +6931,23 @@ void''');
}
void test_parseFinalConstVarOrType_void() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "void f()");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "void f()");
expect(result.keyword, isNull);
expect(result.type, isNotNull);
}
void test_parseFinalConstVarOrType_void_noIdentifier() {
- FinalConstVarOrType result = ParserTestCase.parse(
- "parseFinalConstVarOrType", <Object>[false], "void,");
+ FinalConstVarOrType result =
+ parse("parseFinalConstVarOrType", <Object>[false], "void,");
expect(result.keyword, isNull);
expect(result.type, isNotNull);
}
void test_parseFormalParameter_final_withType_named() {
ParameterKind kind = ParameterKind.NAMED;
- DefaultFormalParameter parameter = ParserTestCase.parse(
- "parseFormalParameter", <Object>[kind], "final A a : null");
+ DefaultFormalParameter parameter =
+ parse("parseFormalParameter", <Object>[kind], "final A a : null");
SimpleFormalParameter simpleParameter =
parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
@@ -7250,8 +6961,8 @@ void''');
void test_parseFormalParameter_final_withType_normal() {
ParameterKind kind = ParameterKind.REQUIRED;
- SimpleFormalParameter parameter = ParserTestCase.parse(
- "parseFormalParameter", <Object>[kind], "final A a");
+ SimpleFormalParameter parameter =
+ parse("parseFormalParameter", <Object>[kind], "final A a");
expect(parameter.identifier, isNotNull);
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
@@ -7260,8 +6971,8 @@ void''');
void test_parseFormalParameter_final_withType_positional() {
ParameterKind kind = ParameterKind.POSITIONAL;
- DefaultFormalParameter parameter = ParserTestCase.parse(
- "parseFormalParameter", <Object>[kind], "final A a = null");
+ DefaultFormalParameter parameter =
+ parse("parseFormalParameter", <Object>[kind], "final A a = null");
SimpleFormalParameter simpleParameter =
parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
@@ -7275,8 +6986,8 @@ void''');
void test_parseFormalParameter_nonFinal_withType_named() {
ParameterKind kind = ParameterKind.NAMED;
- DefaultFormalParameter parameter = ParserTestCase.parse(
- "parseFormalParameter", <Object>[kind], "A a : null");
+ DefaultFormalParameter parameter =
+ parse("parseFormalParameter", <Object>[kind], "A a : null");
SimpleFormalParameter simpleParameter =
parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
@@ -7291,7 +7002,7 @@ void''');
void test_parseFormalParameter_nonFinal_withType_normal() {
ParameterKind kind = ParameterKind.REQUIRED;
SimpleFormalParameter parameter =
- ParserTestCase.parse("parseFormalParameter", <Object>[kind], "A a");
+ parse("parseFormalParameter", <Object>[kind], "A a");
expect(parameter.identifier, isNotNull);
expect(parameter.keyword, isNull);
expect(parameter.type, isNotNull);
@@ -7300,8 +7011,8 @@ void''');
void test_parseFormalParameter_nonFinal_withType_positional() {
ParameterKind kind = ParameterKind.POSITIONAL;
- DefaultFormalParameter parameter = ParserTestCase.parse(
- "parseFormalParameter", <Object>[kind], "A a = null");
+ DefaultFormalParameter parameter =
+ parse("parseFormalParameter", <Object>[kind], "A a = null");
SimpleFormalParameter simpleParameter =
parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
@@ -7316,7 +7027,7 @@ void''');
void test_parseFormalParameter_var() {
ParameterKind kind = ParameterKind.REQUIRED;
SimpleFormalParameter parameter =
- ParserTestCase.parse("parseFormalParameter", <Object>[kind], "var a");
+ parse("parseFormalParameter", <Object>[kind], "var a");
expect(parameter.identifier, isNotNull);
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
@@ -7325,8 +7036,8 @@ void''');
void test_parseFormalParameter_var_named() {
ParameterKind kind = ParameterKind.NAMED;
- DefaultFormalParameter parameter = ParserTestCase.parse(
- "parseFormalParameter", <Object>[kind], "var a : null");
+ DefaultFormalParameter parameter =
+ parse("parseFormalParameter", <Object>[kind], "var a : null");
SimpleFormalParameter simpleParameter =
parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
@@ -7340,8 +7051,8 @@ void''');
void test_parseFormalParameter_var_positional() {
ParameterKind kind = ParameterKind.POSITIONAL;
- DefaultFormalParameter parameter = ParserTestCase.parse(
- "parseFormalParameter", <Object>[kind], "var a = null");
+ DefaultFormalParameter parameter =
+ parse("parseFormalParameter", <Object>[kind], "var a = null");
SimpleFormalParameter simpleParameter =
parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
@@ -7355,7 +7066,7 @@ void''');
void test_parseFormalParameterList_empty() {
FormalParameterList parameterList =
- ParserTestCase.parse4("parseFormalParameterList", "()");
+ parse4("parseFormalParameterList", "()");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNull);
expect(parameterList.parameters, hasLength(0));
@@ -7364,8 +7075,8 @@ void''');
}
void test_parseFormalParameterList_named_multiple() {
- FormalParameterList parameterList = ParserTestCase.parse4(
- "parseFormalParameterList", "({A a : 1, B b, C c : 3})");
+ FormalParameterList parameterList =
+ parse4("parseFormalParameterList", "({A a : 1, B b, C c : 3})");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(3));
@@ -7375,7 +7086,7 @@ void''');
void test_parseFormalParameterList_named_single() {
FormalParameterList parameterList =
- ParserTestCase.parse4("parseFormalParameterList", "({A a})");
+ parse4("parseFormalParameterList", "({A a})");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(1));
@@ -7385,7 +7096,7 @@ void''');
void test_parseFormalParameterList_normal_multiple() {
FormalParameterList parameterList =
- ParserTestCase.parse4("parseFormalParameterList", "(A a, B b, C c)");
+ parse4("parseFormalParameterList", "(A a, B b, C c)");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNull);
expect(parameterList.parameters, hasLength(3));
@@ -7395,7 +7106,7 @@ void''');
void test_parseFormalParameterList_normal_named() {
FormalParameterList parameterList =
- ParserTestCase.parse4("parseFormalParameterList", "(A a, {B b})");
+ parse4("parseFormalParameterList", "(A a, {B b})");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(2));
@@ -7405,7 +7116,7 @@ void''');
void test_parseFormalParameterList_normal_positional() {
FormalParameterList parameterList =
- ParserTestCase.parse4("parseFormalParameterList", "(A a, [B b])");
+ parse4("parseFormalParameterList", "(A a, [B b])");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(2));
@@ -7415,7 +7126,7 @@ void''');
void test_parseFormalParameterList_normal_single() {
FormalParameterList parameterList =
- ParserTestCase.parse4("parseFormalParameterList", "(A a)");
+ parse4("parseFormalParameterList", "(A a)");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNull);
expect(parameterList.parameters, hasLength(1));
@@ -7424,8 +7135,8 @@ void''');
}
void test_parseFormalParameterList_positional_multiple() {
- FormalParameterList parameterList = ParserTestCase.parse4(
- "parseFormalParameterList", "([A a = null, B b, C c = null])");
+ FormalParameterList parameterList =
+ parse4("parseFormalParameterList", "([A a = null, B b, C c = null])");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(3));
@@ -7435,7 +7146,7 @@ void''');
void test_parseFormalParameterList_positional_single() {
FormalParameterList parameterList =
- ParserTestCase.parse4("parseFormalParameterList", "([A a = null])");
+ parse4("parseFormalParameterList", "([A a = null])");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(1));
@@ -7444,8 +7155,8 @@ void''');
}
void test_parseForStatement_each_await() {
- ForEachStatement statement = ParserTestCase.parse4(
- "parseForStatement", "await for (element in list) {}");
+ ForEachStatement statement =
+ parse4("parseForStatement", "await for (element in list) {}");
expect(statement.awaitKeyword, isNotNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -7459,7 +7170,7 @@ void''');
void test_parseForStatement_each_identifier() {
ForEachStatement statement =
- ParserTestCase.parse4("parseForStatement", "for (element in list) {}");
+ parse4("parseForStatement", "for (element in list) {}");
expect(statement.awaitKeyword, isNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -7472,8 +7183,8 @@ void''');
}
void test_parseForStatement_each_noType_metadata() {
- ForEachStatement statement = ParserTestCase.parse4(
- "parseForStatement", "for (@A var element in list) {}");
+ ForEachStatement statement =
+ parse4("parseForStatement", "for (@A var element in list) {}");
expect(statement.awaitKeyword, isNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -7487,8 +7198,8 @@ void''');
}
void test_parseForStatement_each_type() {
- ForEachStatement statement = ParserTestCase.parse4(
- "parseForStatement", "for (A element in list) {}");
+ ForEachStatement statement =
+ parse4("parseForStatement", "for (A element in list) {}");
expect(statement.awaitKeyword, isNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -7501,8 +7212,8 @@ void''');
}
void test_parseForStatement_each_var() {
- ForEachStatement statement = ParserTestCase.parse4(
- "parseForStatement", "for (var element in list) {}");
+ ForEachStatement statement =
+ parse4("parseForStatement", "for (var element in list) {}");
expect(statement.awaitKeyword, isNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -7516,7 +7227,7 @@ void''');
void test_parseForStatement_loop_c() {
ForStatement statement =
- ParserTestCase.parse4("parseForStatement", "for (; i < count;) {}");
+ parse4("parseForStatement", "for (; i < count;) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.variables, isNull);
@@ -7531,7 +7242,7 @@ void''');
void test_parseForStatement_loop_cu() {
ForStatement statement =
- ParserTestCase.parse4("parseForStatement", "for (; i < count; i++) {}");
+ parse4("parseForStatement", "for (; i < count; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.variables, isNull);
@@ -7545,8 +7256,8 @@ void''');
}
void test_parseForStatement_loop_ecu() {
- ForStatement statement = ParserTestCase.parse4(
- "parseForStatement", "for (i--; i < count; i++) {}");
+ ForStatement statement =
+ parse4("parseForStatement", "for (i--; i < count; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.variables, isNull);
@@ -7561,7 +7272,7 @@ void''');
void test_parseForStatement_loop_i() {
ForStatement statement =
- ParserTestCase.parse4("parseForStatement", "for (var i = 0;;) {}");
+ parse4("parseForStatement", "for (var i = 0;;) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -7579,7 +7290,7 @@ void''');
void test_parseForStatement_loop_i_withMetadata() {
ForStatement statement =
- ParserTestCase.parse4("parseForStatement", "for (@A var i = 0;;) {}");
+ parse4("parseForStatement", "for (@A var i = 0;;) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -7596,8 +7307,8 @@ void''');
}
void test_parseForStatement_loop_ic() {
- ForStatement statement = ParserTestCase.parse4(
- "parseForStatement", "for (var i = 0; i < count;) {}");
+ ForStatement statement =
+ parse4("parseForStatement", "for (var i = 0; i < count;) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -7613,8 +7324,8 @@ void''');
}
void test_parseForStatement_loop_icu() {
- ForStatement statement = ParserTestCase.parse4(
- "parseForStatement", "for (var i = 0; i < count; i++) {}");
+ ForStatement statement =
+ parse4("parseForStatement", "for (var i = 0; i < count; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -7630,7 +7341,7 @@ void''');
}
void test_parseForStatement_loop_iicuu() {
- ForStatement statement = ParserTestCase.parse4(
+ ForStatement statement = parse4(
"parseForStatement", "for (int i = 0, j = count; i < j; i++, j--) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -7648,7 +7359,7 @@ void''');
void test_parseForStatement_loop_iu() {
ForStatement statement =
- ParserTestCase.parse4("parseForStatement", "for (var i = 0;; i++) {}");
+ parse4("parseForStatement", "for (var i = 0;; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -7664,8 +7375,7 @@ void''');
}
void test_parseForStatement_loop_u() {
- ForStatement statement =
- ParserTestCase.parse4("parseForStatement", "for (;; i++) {}");
+ ForStatement statement = parse4("parseForStatement", "for (;; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.variables, isNull);
@@ -7679,8 +7389,8 @@ void''');
}
void test_parseFunctionBody_block() {
- BlockFunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "{}");
+ BlockFunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "{}");
expect(functionBody.keyword, isNull);
expect(functionBody.star, isNull);
expect(functionBody.block, isNotNull);
@@ -7690,8 +7400,8 @@ void''');
}
void test_parseFunctionBody_block_async() {
- BlockFunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "async {}");
+ BlockFunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "async {}");
expect(functionBody.keyword, isNotNull);
expect(functionBody.keyword.lexeme, Parser.ASYNC);
expect(functionBody.star, isNull);
@@ -7702,8 +7412,8 @@ void''');
}
void test_parseFunctionBody_block_asyncGenerator() {
- BlockFunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "async* {}");
+ BlockFunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "async* {}");
expect(functionBody.keyword, isNotNull);
expect(functionBody.keyword.lexeme, Parser.ASYNC);
expect(functionBody.star, isNotNull);
@@ -7714,8 +7424,8 @@ void''');
}
void test_parseFunctionBody_block_syncGenerator() {
- BlockFunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "sync* {}");
+ BlockFunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "sync* {}");
expect(functionBody.keyword, isNotNull);
expect(functionBody.keyword.lexeme, Parser.SYNC);
expect(functionBody.star, isNotNull);
@@ -7726,14 +7436,14 @@ void''');
}
void test_parseFunctionBody_empty() {
- EmptyFunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[true, null, false], ";");
+ EmptyFunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[true, null, false], ";");
expect(functionBody.semicolon, isNotNull);
}
void test_parseFunctionBody_expression() {
- ExpressionFunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "=> y;");
+ ExpressionFunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "=> y;");
expect(functionBody.keyword, isNull);
expect(functionBody.functionDefinition, isNotNull);
expect(functionBody.expression, isNotNull);
@@ -7744,8 +7454,8 @@ void''');
}
void test_parseFunctionBody_expression_async() {
- ExpressionFunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "async => y;");
+ ExpressionFunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "async => y;");
expect(functionBody.keyword, isNotNull);
expect(functionBody.keyword.lexeme, Parser.ASYNC);
expect(functionBody.functionDefinition, isNotNull);
@@ -7757,7 +7467,7 @@ void''');
}
void test_parseFunctionBody_nativeFunctionBody() {
- NativeFunctionBody functionBody = ParserTestCase.parse(
+ NativeFunctionBody functionBody = parse(
"parseFunctionBody", <Object>[false, null, false], "native 'str';");
expect(functionBody.nativeKeyword, isNotNull);
expect(functionBody.stringLiteral, isNotNull);
@@ -7766,32 +7476,35 @@ void''');
void test_parseFunctionBody_skip_block() {
ParserTestCase.parseFunctionBodies = false;
- FunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "{}");
+ FunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "{}");
EngineTestCase.assertInstanceOf(
(obj) => obj is EmptyFunctionBody, EmptyFunctionBody, functionBody);
}
void test_parseFunctionBody_skip_block_invalid() {
ParserTestCase.parseFunctionBodies = false;
- FunctionBody functionBody = ParserTestCase.parse3("parseFunctionBody",
- <Object>[false, null, false], "{", [ParserErrorCode.EXPECTED_TOKEN]);
+ FunctionBody functionBody = parse3("parseFunctionBody", <Object>[
+ false,
+ null,
+ false
+ ], "{", [ParserErrorCode.EXPECTED_TOKEN]);
EngineTestCase.assertInstanceOf(
(obj) => obj is EmptyFunctionBody, EmptyFunctionBody, functionBody);
}
void test_parseFunctionBody_skip_blocks() {
ParserTestCase.parseFunctionBodies = false;
- FunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "{ {} }");
+ FunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "{ {} }");
EngineTestCase.assertInstanceOf(
(obj) => obj is EmptyFunctionBody, EmptyFunctionBody, functionBody);
}
void test_parseFunctionBody_skip_expression() {
ParserTestCase.parseFunctionBodies = false;
- FunctionBody functionBody = ParserTestCase.parse(
- "parseFunctionBody", <Object>[false, null, false], "=> y;");
+ FunctionBody functionBody =
+ parse("parseFunctionBody", <Object>[false, null, false], "=> y;");
EngineTestCase.assertInstanceOf(
(obj) => obj is EmptyFunctionBody, EmptyFunctionBody, functionBody);
}
@@ -7799,12 +7512,8 @@ void''');
void test_parseFunctionDeclaration_function() {
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseFunctionDeclaration", <Object>[
- commentAndMetadata(comment),
- null,
- returnType
- ], "f() {}");
+ FunctionDeclaration declaration = parse("parseFunctionDeclaration",
+ <Object>[commentAndMetadata(comment), null, returnType], "f() {}");
expect(declaration.documentationComment, comment);
expect(declaration.returnType, returnType);
expect(declaration.name, isNotNull);
@@ -7818,12 +7527,8 @@ void''');
void test_parseFunctionDeclaration_getter() {
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseFunctionDeclaration", <Object>[
- commentAndMetadata(comment),
- null,
- returnType
- ], "get p => 0;");
+ FunctionDeclaration declaration = parse("parseFunctionDeclaration",
+ <Object>[commentAndMetadata(comment), null, returnType], "get p => 0;");
expect(declaration.documentationComment, comment);
expect(declaration.returnType, returnType);
expect(declaration.name, isNotNull);
@@ -7837,12 +7542,8 @@ void''');
void test_parseFunctionDeclaration_setter() {
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
- FunctionDeclaration declaration = ParserTestCase.parse(
- "parseFunctionDeclaration", <Object>[
- commentAndMetadata(comment),
- null,
- returnType
- ], "set p(v) {}");
+ FunctionDeclaration declaration = parse("parseFunctionDeclaration",
+ <Object>[commentAndMetadata(comment), null, returnType], "set p(v) {}");
expect(declaration.documentationComment, comment);
expect(declaration.returnType, returnType);
expect(declaration.name, isNotNull);
@@ -7854,14 +7555,14 @@ void''');
}
void test_parseFunctionDeclarationStatement() {
- FunctionDeclarationStatement statement = ParserTestCase.parse4(
- "parseFunctionDeclarationStatement", "void f(int p) => p * 2;");
+ FunctionDeclarationStatement statement =
+ parse4("parseFunctionDeclarationStatement", "void f(int p) => p * 2;");
expect(statement.functionDeclaration, isNotNull);
}
void test_parseFunctionExpression_body_inExpression() {
FunctionExpression expression =
- ParserTestCase.parse4("parseFunctionExpression", "(int i) => i++");
+ parse4("parseFunctionExpression", "(int i) => i++");
expect(expression.body, isNotNull);
expect(expression.parameters, isNotNull);
expect((expression.body as ExpressionFunctionBody).semicolon, isNull);
@@ -7870,7 +7571,7 @@ void''');
void test_parseGetter_nonStatic() {
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
- MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object>[
+ MethodDeclaration method = parse("parseGetter", <Object>[
commentAndMetadata(comment),
null,
null,
@@ -7891,7 +7592,7 @@ void''');
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
- MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object>[
+ MethodDeclaration method = parse("parseGetter", <Object>[
commentAndMetadata(comment),
null,
staticKeyword,
@@ -7909,20 +7610,17 @@ void''');
}
void test_parseIdentifierList_multiple() {
- List<SimpleIdentifier> list =
- ParserTestCase.parse4("parseIdentifierList", "a, b, c");
+ List<SimpleIdentifier> list = parse4("parseIdentifierList", "a, b, c");
expect(list, hasLength(3));
}
void test_parseIdentifierList_single() {
- List<SimpleIdentifier> list =
- ParserTestCase.parse4("parseIdentifierList", "a");
+ List<SimpleIdentifier> list = parse4("parseIdentifierList", "a");
expect(list, hasLength(1));
}
void test_parseIfStatement_else_block() {
- IfStatement statement =
- ParserTestCase.parse4("parseIfStatement", "if (x) {} else {}");
+ IfStatement statement = parse4("parseIfStatement", "if (x) {} else {}");
expect(statement.ifKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -7934,7 +7632,7 @@ void''');
void test_parseIfStatement_else_statement() {
IfStatement statement =
- ParserTestCase.parse4("parseIfStatement", "if (x) f(x); else f(y);");
+ parse4("parseIfStatement", "if (x) f(x); else f(y);");
expect(statement.ifKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -7945,8 +7643,7 @@ void''');
}
void test_parseIfStatement_noElse_block() {
- IfStatement statement =
- ParserTestCase.parse4("parseIfStatement", "if (x) {}");
+ IfStatement statement = parse4("parseIfStatement", "if (x) {}");
expect(statement.ifKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -7957,8 +7654,7 @@ void''');
}
void test_parseIfStatement_noElse_statement() {
- IfStatement statement =
- ParserTestCase.parse4("parseIfStatement", "if (x) f(x);");
+ IfStatement statement = parse4("parseIfStatement", "if (x) f(x);");
expect(statement.ifKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -7970,23 +7666,21 @@ void''');
void test_parseImplementsClause_multiple() {
ImplementsClause clause =
- ParserTestCase.parse4("parseImplementsClause", "implements A, B, C");
+ parse4("parseImplementsClause", "implements A, B, C");
expect(clause.interfaces, hasLength(3));
expect(clause.implementsKeyword, isNotNull);
}
void test_parseImplementsClause_single() {
- ImplementsClause clause =
- ParserTestCase.parse4("parseImplementsClause", "implements A");
+ ImplementsClause clause = parse4("parseImplementsClause", "implements A");
expect(clause.interfaces, hasLength(1));
expect(clause.implementsKeyword, isNotNull);
}
void test_parseImportDirective_deferred() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "import 'lib/lib.dart' deferred as a;");
+ ImportDirective directive = parse("parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' deferred as a;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredKeyword, isNotNull);
@@ -7997,10 +7691,9 @@ void''');
}
void test_parseImportDirective_hide() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "import 'lib/lib.dart' hide A, B;");
+ ImportDirective directive = parse("parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' hide A, B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredKeyword, isNull);
@@ -8011,7 +7704,7 @@ void''');
}
void test_parseImportDirective_noCombinator() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective",
+ ImportDirective directive = parse("parseImportDirective",
<Object>[emptyCommentAndMetadata()], "import 'lib/lib.dart';");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
@@ -8023,7 +7716,7 @@ void''');
}
void test_parseImportDirective_prefix() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective",
+ ImportDirective directive = parse("parseImportDirective",
<Object>[emptyCommentAndMetadata()], "import 'lib/lib.dart' as a;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
@@ -8035,10 +7728,9 @@ void''');
}
void test_parseImportDirective_prefix_hide_show() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "import 'lib/lib.dart' as a hide A show B;");
+ ImportDirective directive = parse("parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' as a hide A show B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredKeyword, isNull);
@@ -8049,10 +7741,9 @@ void''');
}
void test_parseImportDirective_prefix_show_hide() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "import 'lib/lib.dart' as a show B hide A;");
+ ImportDirective directive = parse("parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' as a show B hide A;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredKeyword, isNull);
@@ -8063,10 +7754,9 @@ void''');
}
void test_parseImportDirective_show() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective",
- <Object>[
- emptyCommentAndMetadata()
- ], "import 'lib/lib.dart' show A, B;");
+ ImportDirective directive = parse("parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' show A, B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredKeyword, isNull);
@@ -8080,8 +7770,8 @@ void''');
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
TypeName type = new TypeName(new SimpleIdentifier(null), null);
- FieldDeclaration declaration = ParserTestCase.parse(
- "parseInitializedIdentifierList", <Object>[
+ FieldDeclaration declaration = parse("parseInitializedIdentifierList",
+ <Object>[
commentAndMetadata(comment),
staticKeyword,
null,
@@ -8101,8 +7791,8 @@ void''');
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
Token varKeyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
- FieldDeclaration declaration = ParserTestCase.parse(
- "parseInitializedIdentifierList", <Object>[
+ FieldDeclaration declaration = parse("parseInitializedIdentifierList",
+ <Object>[
commentAndMetadata(comment),
staticKeyword,
varKeyword,
@@ -8120,8 +7810,8 @@ void''');
void test_parseInstanceCreationExpression_qualifiedType() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- InstanceCreationExpression expression = ParserTestCase.parse(
- "parseInstanceCreationExpression", <Object>[token], "A.B()");
+ InstanceCreationExpression expression =
+ parse("parseInstanceCreationExpression", <Object>[token], "A.B()");
expect(expression.keyword, token);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -8133,8 +7823,8 @@ void''');
void test_parseInstanceCreationExpression_qualifiedType_named() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- InstanceCreationExpression expression = ParserTestCase.parse(
- "parseInstanceCreationExpression", <Object>[token], "A.B.c()");
+ InstanceCreationExpression expression =
+ parse("parseInstanceCreationExpression", <Object>[token], "A.B.c()");
expect(expression.keyword, token);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -8146,8 +7836,8 @@ void''');
void test_parseInstanceCreationExpression_type() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- InstanceCreationExpression expression = ParserTestCase.parse(
- "parseInstanceCreationExpression", <Object>[token], "A()");
+ InstanceCreationExpression expression =
+ parse("parseInstanceCreationExpression", <Object>[token], "A()");
expect(expression.keyword, token);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -8159,8 +7849,8 @@ void''');
void test_parseInstanceCreationExpression_type_named() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- InstanceCreationExpression expression = ParserTestCase.parse(
- "parseInstanceCreationExpression", <Object>[token], "A<B>.c()");
+ InstanceCreationExpression expression =
+ parse("parseInstanceCreationExpression", <Object>[token], "A<B>.c()");
expect(expression.keyword, token);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -8171,7 +7861,7 @@ void''');
}
void test_parseLibraryDirective() {
- LibraryDirective directive = ParserTestCase.parse("parseLibraryDirective",
+ LibraryDirective directive = parse("parseLibraryDirective",
<Object>[emptyCommentAndMetadata()], "library l;");
expect(directive.libraryKeyword, isNotNull);
expect(directive.name, isNotNull);
@@ -8180,23 +7870,21 @@ void''');
void test_parseLibraryIdentifier_multiple() {
String name = "a.b.c";
- LibraryIdentifier identifier =
- ParserTestCase.parse4("parseLibraryIdentifier", name);
+ LibraryIdentifier identifier = parse4("parseLibraryIdentifier", name);
expect(identifier.name, name);
}
void test_parseLibraryIdentifier_single() {
String name = "a";
- LibraryIdentifier identifier =
- ParserTestCase.parse4("parseLibraryIdentifier", name);
+ LibraryIdentifier identifier = parse4("parseLibraryIdentifier", name);
expect(identifier.name, name);
}
void test_parseListLiteral_empty_oneToken() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
TypeArgumentList typeArguments = null;
- ListLiteral literal = ParserTestCase.parse(
- "parseListLiteral", <Object>[token, typeArguments], "[]");
+ ListLiteral literal =
+ parse("parseListLiteral", <Object>[token, typeArguments], "[]");
expect(literal.constKeyword, token);
expect(literal.typeArguments, typeArguments);
expect(literal.leftBracket, isNotNull);
@@ -8207,7 +7895,7 @@ void''');
void test_parseListLiteral_empty_oneToken_withComment() {
Token constToken = null;
TypeArgumentList typeArguments = null;
- ListLiteral literal = ParserTestCase.parse(
+ ListLiteral literal = parse(
"parseListLiteral", <Object>[constToken, typeArguments], "/* 0 */ []");
expect(literal.constKeyword, constToken);
expect(literal.typeArguments, typeArguments);
@@ -8221,8 +7909,8 @@ void''');
void test_parseListLiteral_empty_twoTokens() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
TypeArgumentList typeArguments = null;
- ListLiteral literal = ParserTestCase.parse(
- "parseListLiteral", <Object>[token, typeArguments], "[ ]");
+ ListLiteral literal =
+ parse("parseListLiteral", <Object>[token, typeArguments], "[ ]");
expect(literal.constKeyword, token);
expect(literal.typeArguments, typeArguments);
expect(literal.leftBracket, isNotNull);
@@ -8231,8 +7919,8 @@ void''');
}
void test_parseListLiteral_multiple() {
- ListLiteral literal = ParserTestCase.parse(
- "parseListLiteral", <Object>[null, null], "[1, 2, 3]");
+ ListLiteral literal =
+ parse("parseListLiteral", <Object>[null, null], "[1, 2, 3]");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -8242,7 +7930,7 @@ void''');
void test_parseListLiteral_single() {
ListLiteral literal =
- ParserTestCase.parse("parseListLiteral", <Object>[null, null], "[1]");
+ parse("parseListLiteral", <Object>[null, null], "[1]");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -8251,8 +7939,7 @@ void''');
}
void test_parseListOrMapLiteral_list_noType() {
- ListLiteral literal =
- ParserTestCase.parse("parseListOrMapLiteral", <Object>[null], "[1]");
+ ListLiteral literal = parse("parseListOrMapLiteral", <Object>[null], "[1]");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -8261,8 +7948,8 @@ void''');
}
void test_parseListOrMapLiteral_list_type() {
- ListLiteral literal = ParserTestCase.parse(
- "parseListOrMapLiteral", <Object>[null], "<int> [1]");
+ ListLiteral literal =
+ parse("parseListOrMapLiteral", <Object>[null], "<int> [1]");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNotNull);
expect(literal.leftBracket, isNotNull);
@@ -8271,8 +7958,8 @@ void''');
}
void test_parseListOrMapLiteral_map_noType() {
- MapLiteral literal = ParserTestCase.parse(
- "parseListOrMapLiteral", <Object>[null], "{'1' : 1}");
+ MapLiteral literal =
+ parse("parseListOrMapLiteral", <Object>[null], "{'1' : 1}");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -8281,7 +7968,7 @@ void''');
}
void test_parseListOrMapLiteral_map_type() {
- MapLiteral literal = ParserTestCase.parse(
+ MapLiteral literal = parse(
"parseListOrMapLiteral", <Object>[null], "<String, int> {'1' : 1}");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNotNull);
@@ -8291,8 +7978,7 @@ void''');
}
void test_parseLogicalAndExpression() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseLogicalAndExpression", "x && y");
+ BinaryExpression expression = parse4("parseLogicalAndExpression", "x && y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.AMPERSAND_AMPERSAND);
@@ -8300,8 +7986,7 @@ void''');
}
void test_parseLogicalOrExpression() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseLogicalOrExpression", "x || y");
+ BinaryExpression expression = parse4("parseLogicalOrExpression", "x || y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.BAR_BAR);
@@ -8312,8 +7997,8 @@ void''');
Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
TypeArgumentList typeArguments = AstFactory.typeArgumentList(
[AstFactory.typeName4("String"), AstFactory.typeName4("int")]);
- MapLiteral literal = ParserTestCase.parse(
- "parseMapLiteral", <Object>[token, typeArguments], "{}");
+ MapLiteral literal =
+ parse("parseMapLiteral", <Object>[token, typeArguments], "{}");
expect(literal.constKeyword, token);
expect(literal.typeArguments, typeArguments);
expect(literal.leftBracket, isNotNull);
@@ -8322,83 +8007,80 @@ void''');
}
void test_parseMapLiteral_multiple() {
- MapLiteral literal = ParserTestCase.parse(
- "parseMapLiteral", <Object>[null, null], "{'a' : b, 'x' : y}");
+ MapLiteral literal =
+ parse("parseMapLiteral", <Object>[null, null], "{'a' : b, 'x' : y}");
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(2));
expect(literal.rightBracket, isNotNull);
}
void test_parseMapLiteral_single() {
- MapLiteral literal = ParserTestCase.parse(
- "parseMapLiteral", <Object>[null, null], "{'x' : y}");
+ MapLiteral literal =
+ parse("parseMapLiteral", <Object>[null, null], "{'x' : y}");
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(1));
expect(literal.rightBracket, isNotNull);
}
void test_parseMapLiteralEntry_complex() {
- MapLiteralEntry entry =
- ParserTestCase.parse4("parseMapLiteralEntry", "2 + 2 : y");
+ MapLiteralEntry entry = parse4("parseMapLiteralEntry", "2 + 2 : y");
expect(entry.key, isNotNull);
expect(entry.separator, isNotNull);
expect(entry.value, isNotNull);
}
void test_parseMapLiteralEntry_int() {
- MapLiteralEntry entry =
- ParserTestCase.parse4("parseMapLiteralEntry", "0 : y");
+ MapLiteralEntry entry = parse4("parseMapLiteralEntry", "0 : y");
expect(entry.key, isNotNull);
expect(entry.separator, isNotNull);
expect(entry.value, isNotNull);
}
void test_parseMapLiteralEntry_string() {
- MapLiteralEntry entry =
- ParserTestCase.parse4("parseMapLiteralEntry", "'x' : y");
+ MapLiteralEntry entry = parse4("parseMapLiteralEntry", "'x' : y");
expect(entry.key, isNotNull);
expect(entry.separator, isNotNull);
expect(entry.value, isNotNull);
}
void test_parseModifiers_abstract() {
- Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "abstract A");
+ Modifiers modifiers = parse4("parseModifiers", "abstract A");
expect(modifiers.abstractKeyword, isNotNull);
}
void test_parseModifiers_const() {
- Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "const A");
+ Modifiers modifiers = parse4("parseModifiers", "const A");
expect(modifiers.constKeyword, isNotNull);
}
void test_parseModifiers_external() {
- Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "external A");
+ Modifiers modifiers = parse4("parseModifiers", "external A");
expect(modifiers.externalKeyword, isNotNull);
}
void test_parseModifiers_factory() {
- Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "factory A");
+ Modifiers modifiers = parse4("parseModifiers", "factory A");
expect(modifiers.factoryKeyword, isNotNull);
}
void test_parseModifiers_final() {
- Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "final A");
+ Modifiers modifiers = parse4("parseModifiers", "final A");
expect(modifiers.finalKeyword, isNotNull);
}
void test_parseModifiers_static() {
- Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "static A");
+ Modifiers modifiers = parse4("parseModifiers", "static A");
expect(modifiers.staticKeyword, isNotNull);
}
void test_parseModifiers_var() {
- Modifiers modifiers = ParserTestCase.parse4("parseModifiers", "var A");
+ Modifiers modifiers = parse4("parseModifiers", "var A");
expect(modifiers.varKeyword, isNotNull);
}
void test_parseMultiplicativeExpression_normal() {
BinaryExpression expression =
- ParserTestCase.parse4("parseMultiplicativeExpression", "x * y");
+ parse4("parseMultiplicativeExpression", "x * y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.STAR);
@@ -8407,7 +8089,7 @@ void''');
void test_parseMultiplicativeExpression_super() {
BinaryExpression expression =
- ParserTestCase.parse4("parseMultiplicativeExpression", "super * y");
+ parse4("parseMultiplicativeExpression", "super * y");
EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression,
SuperExpression, expression.leftOperand);
expect(expression.operator, isNotNull);
@@ -8417,7 +8099,7 @@ void''');
void test_parseNewExpression() {
InstanceCreationExpression expression =
- ParserTestCase.parse4("parseNewExpression", "new A()");
+ parse4("parseNewExpression", "new A()");
expect(expression.keyword, isNotNull);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -8429,74 +8111,73 @@ void''');
void test_parseNonLabeledStatement_const_list_empty() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "const [];");
+ parse4("parseNonLabeledStatement", "const [];");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_list_nonEmpty() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "const [1, 2];");
+ parse4("parseNonLabeledStatement", "const [1, 2];");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_map_empty() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "const {};");
+ parse4("parseNonLabeledStatement", "const {};");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_map_nonEmpty() {
// TODO(brianwilkerson) Implement more tests for this method.
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "const {'a' : 1};");
+ parse4("parseNonLabeledStatement", "const {'a' : 1};");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_object() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "const A();");
+ parse4("parseNonLabeledStatement", "const A();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_object_named_typeParameters() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "const A<B>.c();");
+ parse4("parseNonLabeledStatement", "const A<B>.c();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_constructorInvocation() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "new C().m();");
+ parse4("parseNonLabeledStatement", "new C().m();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_false() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "false;");
+ parse4("parseNonLabeledStatement", "false;");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_functionDeclaration() {
- ParserTestCase.parse4("parseNonLabeledStatement", "f() {};");
+ parse4("parseNonLabeledStatement", "f() {};");
}
void test_parseNonLabeledStatement_functionDeclaration_arguments() {
- ParserTestCase.parse4("parseNonLabeledStatement", "f(void g()) {};");
+ parse4("parseNonLabeledStatement", "f(void g()) {};");
}
void test_parseNonLabeledStatement_functionExpressionIndex() {
- ParserTestCase.parse4("parseNonLabeledStatement", "() {}[0] = null;");
+ parse4("parseNonLabeledStatement", "() {}[0] = null;");
}
void test_parseNonLabeledStatement_functionInvocation() {
- ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "f();");
+ ExpressionStatement statement = parse4("parseNonLabeledStatement", "f();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_invokeFunctionExpression() {
- ExpressionStatement statement = ParserTestCase.parse4(
- "parseNonLabeledStatement", "(a) {return a + a;} (3);");
+ ExpressionStatement statement =
+ parse4("parseNonLabeledStatement", "(a) {return a + a;} (3);");
EngineTestCase.assertInstanceOf(
(obj) => obj is FunctionExpressionInvocation,
FunctionExpressionInvocation, statement.expression);
@@ -8513,32 +8194,30 @@ void''');
}
void test_parseNonLabeledStatement_null() {
- ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "null;");
+ ExpressionStatement statement = parse4("parseNonLabeledStatement", "null;");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "library.getName();");
+ parse4("parseNonLabeledStatement", "library.getName();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_true() {
- ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "true;");
+ ExpressionStatement statement = parse4("parseNonLabeledStatement", "true;");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_typeCast() {
ExpressionStatement statement =
- ParserTestCase.parse4("parseNonLabeledStatement", "double.NAN as num;");
+ parse4("parseNonLabeledStatement", "double.NAN as num;");
expect(statement.expression, isNotNull);
}
void test_parseNormalFormalParameter_field_const_noType() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "const this.a)");
+ parse4("parseNormalFormalParameter", "const this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8547,7 +8226,7 @@ void''');
void test_parseNormalFormalParameter_field_const_type() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "const A this.a)");
+ parse4("parseNormalFormalParameter", "const A this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -8556,7 +8235,7 @@ void''');
void test_parseNormalFormalParameter_field_final_noType() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "final this.a)");
+ parse4("parseNormalFormalParameter", "final this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8565,7 +8244,7 @@ void''');
void test_parseNormalFormalParameter_field_final_type() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "final A this.a)");
+ parse4("parseNormalFormalParameter", "final A this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -8574,7 +8253,7 @@ void''');
void test_parseNormalFormalParameter_field_function_nested() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "this.a(B b))");
+ parse4("parseNormalFormalParameter", "this.a(B b))");
expect(parameter.keyword, isNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8585,7 +8264,7 @@ void''');
void test_parseNormalFormalParameter_field_function_noNested() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "this.a())");
+ parse4("parseNormalFormalParameter", "this.a())");
expect(parameter.keyword, isNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8596,7 +8275,7 @@ void''');
void test_parseNormalFormalParameter_field_noType() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "this.a)");
+ parse4("parseNormalFormalParameter", "this.a)");
expect(parameter.keyword, isNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8605,7 +8284,7 @@ void''');
void test_parseNormalFormalParameter_field_type() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "A this.a)");
+ parse4("parseNormalFormalParameter", "A this.a)");
expect(parameter.keyword, isNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -8614,7 +8293,7 @@ void''');
void test_parseNormalFormalParameter_field_var() {
FieldFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "var this.a)");
+ parse4("parseNormalFormalParameter", "var this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8623,7 +8302,7 @@ void''');
void test_parseNormalFormalParameter_function_noType() {
FunctionTypedFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "a())");
+ parse4("parseNormalFormalParameter", "a())");
expect(parameter.returnType, isNull);
expect(parameter.identifier, isNotNull);
expect(parameter.parameters, isNotNull);
@@ -8631,7 +8310,7 @@ void''');
void test_parseNormalFormalParameter_function_type() {
FunctionTypedFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "A a())");
+ parse4("parseNormalFormalParameter", "A a())");
expect(parameter.returnType, isNotNull);
expect(parameter.identifier, isNotNull);
expect(parameter.parameters, isNotNull);
@@ -8639,7 +8318,7 @@ void''');
void test_parseNormalFormalParameter_function_void() {
FunctionTypedFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "void a())");
+ parse4("parseNormalFormalParameter", "void a())");
expect(parameter.returnType, isNotNull);
expect(parameter.identifier, isNotNull);
expect(parameter.parameters, isNotNull);
@@ -8647,7 +8326,7 @@ void''');
void test_parseNormalFormalParameter_simple_const_noType() {
SimpleFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "const a)");
+ parse4("parseNormalFormalParameter", "const a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8655,7 +8334,7 @@ void''');
void test_parseNormalFormalParameter_simple_const_type() {
SimpleFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "const A a)");
+ parse4("parseNormalFormalParameter", "const A a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -8663,7 +8342,7 @@ void''');
void test_parseNormalFormalParameter_simple_final_noType() {
SimpleFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "final a)");
+ parse4("parseNormalFormalParameter", "final a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8671,7 +8350,7 @@ void''');
void test_parseNormalFormalParameter_simple_final_type() {
SimpleFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "final A a)");
+ parse4("parseNormalFormalParameter", "final A a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -8679,7 +8358,7 @@ void''');
void test_parseNormalFormalParameter_simple_noType() {
SimpleFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "a)");
+ parse4("parseNormalFormalParameter", "a)");
expect(parameter.keyword, isNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -8687,7 +8366,7 @@ void''');
void test_parseNormalFormalParameter_simple_type() {
SimpleFormalParameter parameter =
- ParserTestCase.parse4("parseNormalFormalParameter", "A a)");
+ parse4("parseNormalFormalParameter", "A a)");
expect(parameter.keyword, isNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -8696,7 +8375,7 @@ void''');
void test_parseOperator() {
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
- MethodDeclaration method = ParserTestCase.parse("parseOperator", <Object>[
+ MethodDeclaration method = parse("parseOperator", <Object>[
commentAndMetadata(comment),
null,
returnType
@@ -8717,7 +8396,7 @@ void''');
}
void test_parsePartDirective_part() {
- PartDirective directive = ParserTestCase.parse("parsePartDirective",
+ PartDirective directive = parse("parsePartDirective",
<Object>[emptyCommentAndMetadata()], "part 'lib/lib.dart';");
expect(directive.partKeyword, isNotNull);
expect(directive.uri, isNotNull);
@@ -8725,7 +8404,7 @@ void''');
}
void test_parsePartDirective_partOf() {
- PartOfDirective directive = ParserTestCase.parse("parsePartDirective",
+ PartOfDirective directive = parse("parsePartDirective",
<Object>[emptyCommentAndMetadata()], "part of l;");
expect(directive.partKeyword, isNotNull);
expect(directive.ofKeyword, isNotNull);
@@ -8734,55 +8413,48 @@ void''');
}
void test_parsePostfixExpression_decrement() {
- PostfixExpression expression =
- ParserTestCase.parse4("parsePostfixExpression", "i--");
+ PostfixExpression expression = parse4("parsePostfixExpression", "i--");
expect(expression.operand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS_MINUS);
}
void test_parsePostfixExpression_increment() {
- PostfixExpression expression =
- ParserTestCase.parse4("parsePostfixExpression", "i++");
+ PostfixExpression expression = parse4("parsePostfixExpression", "i++");
expect(expression.operand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS_PLUS);
}
void test_parsePostfixExpression_none_indexExpression() {
- IndexExpression expression =
- ParserTestCase.parse4("parsePostfixExpression", "a[0]");
+ IndexExpression expression = parse4("parsePostfixExpression", "a[0]");
expect(expression.target, isNotNull);
expect(expression.index, isNotNull);
}
void test_parsePostfixExpression_none_methodInvocation() {
- MethodInvocation expression =
- ParserTestCase.parse4("parsePostfixExpression", "a.m()");
+ MethodInvocation expression = parse4("parsePostfixExpression", "a.m()");
expect(expression.target, isNotNull);
expect(expression.methodName, isNotNull);
expect(expression.argumentList, isNotNull);
}
void test_parsePostfixExpression_none_propertyAccess() {
- PrefixedIdentifier expression =
- ParserTestCase.parse4("parsePostfixExpression", "a.b");
+ PrefixedIdentifier expression = parse4("parsePostfixExpression", "a.b");
expect(expression.prefix, isNotNull);
expect(expression.identifier, isNotNull);
}
void test_parsePrefixedIdentifier_noPrefix() {
String lexeme = "bar";
- SimpleIdentifier identifier =
- ParserTestCase.parse4("parsePrefixedIdentifier", lexeme);
+ SimpleIdentifier identifier = parse4("parsePrefixedIdentifier", lexeme);
expect(identifier.token, isNotNull);
expect(identifier.name, lexeme);
}
void test_parsePrefixedIdentifier_prefix() {
String lexeme = "foo.bar";
- PrefixedIdentifier identifier =
- ParserTestCase.parse4("parsePrefixedIdentifier", lexeme);
+ PrefixedIdentifier identifier = parse4("parsePrefixedIdentifier", lexeme);
expect(identifier.prefix.name, "foo");
expect(identifier.period, isNotNull);
expect(identifier.identifier.name, "bar");
@@ -8790,112 +8462,103 @@ void''');
void test_parsePrimaryExpression_const() {
InstanceCreationExpression expression =
- ParserTestCase.parse4("parsePrimaryExpression", "const A()");
+ parse4("parsePrimaryExpression", "const A()");
expect(expression, isNotNull);
}
void test_parsePrimaryExpression_double() {
String doubleLiteral = "3.2e4";
- DoubleLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", doubleLiteral);
+ DoubleLiteral literal = parse4("parsePrimaryExpression", doubleLiteral);
expect(literal.literal, isNotNull);
expect(literal.value, double.parse(doubleLiteral));
}
void test_parsePrimaryExpression_false() {
- BooleanLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "false");
+ BooleanLiteral literal = parse4("parsePrimaryExpression", "false");
expect(literal.literal, isNotNull);
expect(literal.value, isFalse);
}
void test_parsePrimaryExpression_function_arguments() {
FunctionExpression expression =
- ParserTestCase.parse4("parsePrimaryExpression", "(int i) => i + 1");
+ parse4("parsePrimaryExpression", "(int i) => i + 1");
expect(expression.parameters, isNotNull);
expect(expression.body, isNotNull);
}
void test_parsePrimaryExpression_function_noArguments() {
FunctionExpression expression =
- ParserTestCase.parse4("parsePrimaryExpression", "() => 42");
+ parse4("parsePrimaryExpression", "() => 42");
expect(expression.parameters, isNotNull);
expect(expression.body, isNotNull);
}
void test_parsePrimaryExpression_hex() {
String hexLiteral = "3F";
- IntegerLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "0x$hexLiteral");
+ IntegerLiteral literal = parse4("parsePrimaryExpression", "0x$hexLiteral");
expect(literal.literal, isNotNull);
expect(literal.value, int.parse(hexLiteral, radix: 16));
}
void test_parsePrimaryExpression_identifier() {
- SimpleIdentifier identifier =
- ParserTestCase.parse4("parsePrimaryExpression", "a");
+ SimpleIdentifier identifier = parse4("parsePrimaryExpression", "a");
expect(identifier, isNotNull);
}
void test_parsePrimaryExpression_int() {
String intLiteral = "472";
- IntegerLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", intLiteral);
+ IntegerLiteral literal = parse4("parsePrimaryExpression", intLiteral);
expect(literal.literal, isNotNull);
expect(literal.value, int.parse(intLiteral));
}
void test_parsePrimaryExpression_listLiteral() {
- ListLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "[ ]");
+ ListLiteral literal = parse4("parsePrimaryExpression", "[ ]");
expect(literal, isNotNull);
}
void test_parsePrimaryExpression_listLiteral_index() {
- ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "[]");
+ ListLiteral literal = parse4("parsePrimaryExpression", "[]");
expect(literal, isNotNull);
}
void test_parsePrimaryExpression_listLiteral_typed() {
- ListLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "<A>[ ]");
+ ListLiteral literal = parse4("parsePrimaryExpression", "<A>[ ]");
expect(literal.typeArguments, isNotNull);
expect(literal.typeArguments.arguments, hasLength(1));
}
void test_parsePrimaryExpression_mapLiteral() {
- MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "{}");
+ MapLiteral literal = parse4("parsePrimaryExpression", "{}");
expect(literal, isNotNull);
}
void test_parsePrimaryExpression_mapLiteral_typed() {
- MapLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "<A, B>{}");
+ MapLiteral literal = parse4("parsePrimaryExpression", "<A, B>{}");
expect(literal.typeArguments, isNotNull);
expect(literal.typeArguments.arguments, hasLength(2));
}
void test_parsePrimaryExpression_new() {
InstanceCreationExpression expression =
- ParserTestCase.parse4("parsePrimaryExpression", "new A()");
+ parse4("parsePrimaryExpression", "new A()");
expect(expression, isNotNull);
}
void test_parsePrimaryExpression_null() {
- NullLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "null");
+ NullLiteral literal = parse4("parsePrimaryExpression", "null");
expect(literal.literal, isNotNull);
}
void test_parsePrimaryExpression_parenthesized() {
ParenthesizedExpression expression =
- ParserTestCase.parse4("parsePrimaryExpression", "(x)");
+ parse4("parsePrimaryExpression", "(x)");
expect(expression, isNotNull);
}
void test_parsePrimaryExpression_string() {
SimpleStringLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "\"string\"");
+ parse4("parsePrimaryExpression", "\"string\"");
expect(literal.isMultiline, isFalse);
expect(literal.isRaw, isFalse);
expect(literal.value, "string");
@@ -8903,23 +8566,21 @@ void''');
void test_parsePrimaryExpression_string_multiline() {
SimpleStringLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "'''string'''");
+ parse4("parsePrimaryExpression", "'''string'''");
expect(literal.isMultiline, isTrue);
expect(literal.isRaw, isFalse);
expect(literal.value, "string");
}
void test_parsePrimaryExpression_string_raw() {
- SimpleStringLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "r'string'");
+ SimpleStringLiteral literal = parse4("parsePrimaryExpression", "r'string'");
expect(literal.isMultiline, isFalse);
expect(literal.isRaw, isTrue);
expect(literal.value, "string");
}
void test_parsePrimaryExpression_super() {
- PropertyAccess propertyAccess =
- ParserTestCase.parse4("parsePrimaryExpression", "super.x");
+ PropertyAccess propertyAccess = parse4("parsePrimaryExpression", "super.x");
expect(propertyAccess.target is SuperExpression, isTrue);
expect(propertyAccess.operator, isNotNull);
expect(propertyAccess.operator.type, TokenType.PERIOD);
@@ -8927,14 +8588,12 @@ void''');
}
void test_parsePrimaryExpression_this() {
- ThisExpression expression =
- ParserTestCase.parse4("parsePrimaryExpression", "this");
+ ThisExpression expression = parse4("parsePrimaryExpression", "this");
expect(expression.thisKeyword, isNotNull);
}
void test_parsePrimaryExpression_true() {
- BooleanLiteral literal =
- ParserTestCase.parse4("parsePrimaryExpression", "true");
+ BooleanLiteral literal = parse4("parsePrimaryExpression", "true");
expect(literal.literal, isNotNull);
expect(literal.value, isTrue);
}
@@ -8944,8 +8603,8 @@ void''');
}
void test_parseRedirectingConstructorInvocation_named() {
- RedirectingConstructorInvocation invocation = ParserTestCase.parse4(
- "parseRedirectingConstructorInvocation", "this.a()");
+ RedirectingConstructorInvocation invocation =
+ parse4("parseRedirectingConstructorInvocation", "this.a()");
expect(invocation.argumentList, isNotNull);
expect(invocation.constructorName, isNotNull);
expect(invocation.thisKeyword, isNotNull);
@@ -8953,8 +8612,8 @@ void''');
}
void test_parseRedirectingConstructorInvocation_unnamed() {
- RedirectingConstructorInvocation invocation = ParserTestCase.parse4(
- "parseRedirectingConstructorInvocation", "this()");
+ RedirectingConstructorInvocation invocation =
+ parse4("parseRedirectingConstructorInvocation", "this()");
expect(invocation.argumentList, isNotNull);
expect(invocation.constructorName, isNull);
expect(invocation.thisKeyword, isNotNull);
@@ -8962,16 +8621,14 @@ void''');
}
void test_parseRelationalExpression_as() {
- AsExpression expression =
- ParserTestCase.parse4("parseRelationalExpression", "x as Y");
+ AsExpression expression = parse4("parseRelationalExpression", "x as Y");
expect(expression.expression, isNotNull);
expect(expression.asOperator, isNotNull);
expect(expression.type, isNotNull);
}
void test_parseRelationalExpression_is() {
- IsExpression expression =
- ParserTestCase.parse4("parseRelationalExpression", "x is y");
+ IsExpression expression = parse4("parseRelationalExpression", "x is y");
expect(expression.expression, isNotNull);
expect(expression.isOperator, isNotNull);
expect(expression.notOperator, isNull);
@@ -8979,8 +8636,7 @@ void''');
}
void test_parseRelationalExpression_isNot() {
- IsExpression expression =
- ParserTestCase.parse4("parseRelationalExpression", "x is! y");
+ IsExpression expression = parse4("parseRelationalExpression", "x is! y");
expect(expression.expression, isNotNull);
expect(expression.isOperator, isNotNull);
expect(expression.notOperator, isNotNull);
@@ -8988,8 +8644,7 @@ void''');
}
void test_parseRelationalExpression_normal() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseRelationalExpression", "x < y");
+ BinaryExpression expression = parse4("parseRelationalExpression", "x < y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.LT);
@@ -8998,7 +8653,7 @@ void''');
void test_parseRelationalExpression_super() {
BinaryExpression expression =
- ParserTestCase.parse4("parseRelationalExpression", "super < y");
+ parse4("parseRelationalExpression", "super < y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.LT);
@@ -9006,35 +8661,32 @@ void''');
}
void test_parseRethrowExpression() {
- RethrowExpression expression =
- ParserTestCase.parse4("parseRethrowExpression", "rethrow;");
+ RethrowExpression expression = parse4("parseRethrowExpression", "rethrow;");
expect(expression.rethrowKeyword, isNotNull);
}
void test_parseReturnStatement_noValue() {
- ReturnStatement statement =
- ParserTestCase.parse4("parseReturnStatement", "return;");
+ ReturnStatement statement = parse4("parseReturnStatement", "return;");
expect(statement.returnKeyword, isNotNull);
expect(statement.expression, isNull);
expect(statement.semicolon, isNotNull);
}
void test_parseReturnStatement_value() {
- ReturnStatement statement =
- ParserTestCase.parse4("parseReturnStatement", "return x;");
+ ReturnStatement statement = parse4("parseReturnStatement", "return x;");
expect(statement.returnKeyword, isNotNull);
expect(statement.expression, isNotNull);
expect(statement.semicolon, isNotNull);
}
void test_parseReturnType_nonVoid() {
- TypeName typeName = ParserTestCase.parse4("parseReturnType", "A<B>");
+ TypeName typeName = parse4("parseReturnType", "A<B>");
expect(typeName.name, isNotNull);
expect(typeName.typeArguments, isNotNull);
}
void test_parseReturnType_void() {
- TypeName typeName = ParserTestCase.parse4("parseReturnType", "void");
+ TypeName typeName = parse4("parseReturnType", "void");
expect(typeName.name, isNotNull);
expect(typeName.typeArguments, isNull);
}
@@ -9042,7 +8694,7 @@ void''');
void test_parseSetter_nonStatic() {
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
- MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object>[
+ MethodDeclaration method = parse("parseSetter", <Object>[
commentAndMetadata(comment),
null,
null,
@@ -9063,7 +8715,7 @@ void''');
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
- MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object>[
+ MethodDeclaration method = parse("parseSetter", <Object>[
commentAndMetadata(comment),
null,
staticKeyword,
@@ -9081,8 +8733,7 @@ void''');
}
void test_parseShiftExpression_normal() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseShiftExpression", "x << y");
+ BinaryExpression expression = parse4("parseShiftExpression", "x << y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.LT_LT);
@@ -9090,8 +8741,7 @@ void''');
}
void test_parseShiftExpression_super() {
- BinaryExpression expression =
- ParserTestCase.parse4("parseShiftExpression", "super << y");
+ BinaryExpression expression = parse4("parseShiftExpression", "super << y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.LT_LT);
@@ -9104,16 +8754,14 @@ void''');
void test_parseSimpleIdentifier_builtInIdentifier() {
String lexeme = "as";
- SimpleIdentifier identifier =
- ParserTestCase.parse4("parseSimpleIdentifier", lexeme);
+ SimpleIdentifier identifier = parse4("parseSimpleIdentifier", lexeme);
expect(identifier.token, isNotNull);
expect(identifier.name, lexeme);
}
void test_parseSimpleIdentifier_normalIdentifier() {
String lexeme = "foo";
- SimpleIdentifier identifier =
- ParserTestCase.parse4("parseSimpleIdentifier", lexeme);
+ SimpleIdentifier identifier = parse4("parseSimpleIdentifier", lexeme);
expect(identifier.token, isNotNull);
expect(identifier.name, lexeme);
}
@@ -9121,24 +8769,22 @@ void''');
void test_parseStatement_functionDeclaration() {
// TODO(brianwilkerson) Implement more tests for this method.
FunctionDeclarationStatement statement =
- ParserTestCase.parse4("parseStatement", "int f(a, b) {};");
+ parse4("parseStatement", "int f(a, b) {};");
expect(statement.functionDeclaration, isNotNull);
}
void test_parseStatement_mulipleLabels() {
- LabeledStatement statement =
- ParserTestCase.parse4("parseStatement", "l: m: return x;");
+ LabeledStatement statement = parse4("parseStatement", "l: m: return x;");
expect(statement.labels, hasLength(2));
expect(statement.statement, isNotNull);
}
void test_parseStatement_noLabels() {
- ParserTestCase.parse4("parseStatement", "return x;");
+ parse4("parseStatement", "return x;");
}
void test_parseStatement_singleLabel() {
- LabeledStatement statement =
- ParserTestCase.parse4("parseStatement", "l: return x;");
+ LabeledStatement statement = parse4("parseStatement", "l: return x;");
expect(statement.labels, hasLength(1));
expect(statement.statement, isNotNull);
}
@@ -9155,8 +8801,7 @@ void''');
}
void test_parseStringLiteral_adjacent() {
- AdjacentStrings literal =
- ParserTestCase.parse4("parseStringLiteral", "'a' 'b'");
+ AdjacentStrings literal = parse4("parseStringLiteral", "'a' 'b'");
NodeList<StringLiteral> strings = literal.strings;
expect(strings, hasLength(2));
StringLiteral firstString = strings[0];
@@ -9167,7 +8812,7 @@ void''');
void test_parseStringLiteral_interpolated() {
StringInterpolation literal =
- ParserTestCase.parse4("parseStringLiteral", "'a \${b} c \$this d'");
+ parse4("parseStringLiteral", "'a \${b} c \$this d'");
NodeList<InterpolationElement> elements = literal.elements;
expect(elements, hasLength(5));
expect(elements[0] is InterpolationString, isTrue);
@@ -9178,15 +8823,14 @@ void''');
}
void test_parseStringLiteral_single() {
- SimpleStringLiteral literal =
- ParserTestCase.parse4("parseStringLiteral", "'a'");
+ SimpleStringLiteral literal = parse4("parseStringLiteral", "'a'");
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseSuperConstructorInvocation_named() {
SuperConstructorInvocation invocation =
- ParserTestCase.parse4("parseSuperConstructorInvocation", "super.a()");
+ parse4("parseSuperConstructorInvocation", "super.a()");
expect(invocation.argumentList, isNotNull);
expect(invocation.constructorName, isNotNull);
expect(invocation.superKeyword, isNotNull);
@@ -9195,7 +8839,7 @@ void''');
void test_parseSuperConstructorInvocation_unnamed() {
SuperConstructorInvocation invocation =
- ParserTestCase.parse4("parseSuperConstructorInvocation", "super()");
+ parse4("parseSuperConstructorInvocation", "super()");
expect(invocation.argumentList, isNotNull);
expect(invocation.constructorName, isNull);
expect(invocation.superKeyword, isNotNull);
@@ -9203,8 +8847,8 @@ void''');
}
void test_parseSwitchStatement_case() {
- SwitchStatement statement = ParserTestCase.parse4(
- "parseSwitchStatement", "switch (a) {case 1: return 'I';}");
+ SwitchStatement statement =
+ parse4("parseSwitchStatement", "switch (a) {case 1: return 'I';}");
expect(statement.switchKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.expression, isNotNull);
@@ -9215,8 +8859,7 @@ void''');
}
void test_parseSwitchStatement_empty() {
- SwitchStatement statement =
- ParserTestCase.parse4("parseSwitchStatement", "switch (a) {}");
+ SwitchStatement statement = parse4("parseSwitchStatement", "switch (a) {}");
expect(statement.switchKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.expression, isNotNull);
@@ -9227,8 +8870,8 @@ void''');
}
void test_parseSwitchStatement_labeledCase() {
- SwitchStatement statement = ParserTestCase.parse4(
- "parseSwitchStatement", "switch (a) {l1: l2: l3: case(1):}");
+ SwitchStatement statement =
+ parse4("parseSwitchStatement", "switch (a) {l1: l2: l3: case(1):}");
expect(statement.switchKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.expression, isNotNull);
@@ -9240,7 +8883,7 @@ void''');
}
void test_parseSwitchStatement_labeledStatementInCase() {
- SwitchStatement statement = ParserTestCase.parse4(
+ SwitchStatement statement = parse4(
"parseSwitchStatement", "switch (a) {case 0: f(); l1: g(); break;}");
expect(statement.switchKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -9254,7 +8897,7 @@ void''');
void test_parseSymbolLiteral_builtInIdentifier() {
SymbolLiteral literal =
- ParserTestCase.parse4("parseSymbolLiteral", "#dynamic.static.abstract");
+ parse4("parseSymbolLiteral", "#dynamic.static.abstract");
expect(literal.poundSign, isNotNull);
List<Token> components = literal.components;
expect(components, hasLength(3));
@@ -9264,8 +8907,7 @@ void''');
}
void test_parseSymbolLiteral_multiple() {
- SymbolLiteral literal =
- ParserTestCase.parse4("parseSymbolLiteral", "#a.b.c");
+ SymbolLiteral literal = parse4("parseSymbolLiteral", "#a.b.c");
expect(literal.poundSign, isNotNull);
List<Token> components = literal.components;
expect(components, hasLength(3));
@@ -9275,7 +8917,7 @@ void''');
}
void test_parseSymbolLiteral_operator() {
- SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#==");
+ SymbolLiteral literal = parse4("parseSymbolLiteral", "#==");
expect(literal.poundSign, isNotNull);
List<Token> components = literal.components;
expect(components, hasLength(1));
@@ -9283,7 +8925,7 @@ void''');
}
void test_parseSymbolLiteral_single() {
- SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a");
+ SymbolLiteral literal = parse4("parseSymbolLiteral", "#a");
expect(literal.poundSign, isNotNull);
List<Token> components = literal.components;
expect(components, hasLength(1));
@@ -9291,8 +8933,7 @@ void''');
}
void test_parseSymbolLiteral_void() {
- SymbolLiteral literal =
- ParserTestCase.parse4("parseSymbolLiteral", "#void");
+ SymbolLiteral literal = parse4("parseSymbolLiteral", "#void");
expect(literal.poundSign, isNotNull);
List<Token> components = literal.components;
expect(components, hasLength(1));
@@ -9300,22 +8941,20 @@ void''');
}
void test_parseThrowExpression() {
- ThrowExpression expression =
- ParserTestCase.parse4("parseThrowExpression", "throw x;");
+ ThrowExpression expression = parse4("parseThrowExpression", "throw x;");
expect(expression.throwKeyword, isNotNull);
expect(expression.expression, isNotNull);
}
void test_parseThrowExpressionWithoutCascade() {
ThrowExpression expression =
- ParserTestCase.parse4("parseThrowExpressionWithoutCascade", "throw x;");
+ parse4("parseThrowExpressionWithoutCascade", "throw x;");
expect(expression.throwKeyword, isNotNull);
expect(expression.expression, isNotNull);
}
void test_parseTryStatement_catch() {
- TryStatement statement =
- ParserTestCase.parse4("parseTryStatement", "try {} catch (e) {}");
+ TryStatement statement = parse4("parseTryStatement", "try {} catch (e) {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -9333,8 +8972,8 @@ void''');
}
void test_parseTryStatement_catch_finally() {
- TryStatement statement = ParserTestCase.parse4(
- "parseTryStatement", "try {} catch (e, s) {} finally {}");
+ TryStatement statement =
+ parse4("parseTryStatement", "try {} catch (e, s) {} finally {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -9352,8 +8991,7 @@ void''');
}
void test_parseTryStatement_finally() {
- TryStatement statement =
- ParserTestCase.parse4("parseTryStatement", "try {} finally {}");
+ TryStatement statement = parse4("parseTryStatement", "try {} finally {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
expect(statement.catchClauses, hasLength(0));
@@ -9362,7 +9000,7 @@ void''');
}
void test_parseTryStatement_multiple() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement",
+ TryStatement statement = parse4("parseTryStatement",
"try {} on NPE catch (e) {} on Error {} catch (e) {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
@@ -9372,8 +9010,7 @@ void''');
}
void test_parseTryStatement_on() {
- TryStatement statement =
- ParserTestCase.parse4("parseTryStatement", "try {} on Error {}");
+ TryStatement statement = parse4("parseTryStatement", "try {} on Error {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -9391,8 +9028,8 @@ void''');
}
void test_parseTryStatement_on_catch() {
- TryStatement statement = ParserTestCase.parse4(
- "parseTryStatement", "try {} on Error catch (e, s) {}");
+ TryStatement statement =
+ parse4("parseTryStatement", "try {} on Error catch (e, s) {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -9410,7 +9047,7 @@ void''');
}
void test_parseTryStatement_on_catch_finally() {
- TryStatement statement = ParserTestCase.parse4(
+ TryStatement statement = parse4(
"parseTryStatement", "try {} on Error catch (e, s) {} finally {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
@@ -9429,7 +9066,7 @@ void''');
}
void test_parseTypeAlias_function_noParameters() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias",
+ FunctionTypeAlias typeAlias = parse("parseTypeAlias",
<Object>[emptyCommentAndMetadata()], "typedef bool F();");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name, isNotNull);
@@ -9440,7 +9077,7 @@ void''');
}
void test_parseTypeAlias_function_noReturnType() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse(
+ FunctionTypeAlias typeAlias = parse(
"parseTypeAlias", <Object>[emptyCommentAndMetadata()], "typedef F();");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name, isNotNull);
@@ -9451,7 +9088,7 @@ void''');
}
void test_parseTypeAlias_function_parameterizedReturnType() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias",
+ FunctionTypeAlias typeAlias = parse("parseTypeAlias",
<Object>[emptyCommentAndMetadata()], "typedef A<B> F();");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name, isNotNull);
@@ -9462,7 +9099,7 @@ void''');
}
void test_parseTypeAlias_function_parameters() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias",
+ FunctionTypeAlias typeAlias = parse("parseTypeAlias",
<Object>[emptyCommentAndMetadata()], "typedef bool F(Object value);");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name, isNotNull);
@@ -9473,7 +9110,7 @@ void''');
}
void test_parseTypeAlias_function_typeParameters() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias",
+ FunctionTypeAlias typeAlias = parse("parseTypeAlias",
<Object>[emptyCommentAndMetadata()], "typedef bool F<E>();");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name, isNotNull);
@@ -9484,7 +9121,7 @@ void''');
}
void test_parseTypeAlias_function_voidReturnType() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias",
+ FunctionTypeAlias typeAlias = parse("parseTypeAlias",
<Object>[emptyCommentAndMetadata()], "typedef void F();");
expect(typeAlias.typedefKeyword, isNotNull);
expect(typeAlias.name, isNotNull);
@@ -9496,15 +9133,14 @@ void''');
void test_parseTypeArgumentList_multiple() {
TypeArgumentList argumentList =
- ParserTestCase.parse4("parseTypeArgumentList", "<int, int, int>");
+ parse4("parseTypeArgumentList", "<int, int, int>");
expect(argumentList.leftBracket, isNotNull);
expect(argumentList.arguments, hasLength(3));
expect(argumentList.rightBracket, isNotNull);
}
void test_parseTypeArgumentList_nested() {
- TypeArgumentList argumentList =
- ParserTestCase.parse4("parseTypeArgumentList", "<A<B>>");
+ TypeArgumentList argumentList = parse4("parseTypeArgumentList", "<A<B>>");
expect(argumentList.leftBracket, isNotNull);
expect(argumentList.arguments, hasLength(1));
TypeName argument = argumentList.arguments[0];
@@ -9517,7 +9153,7 @@ void''');
void test_parseTypeArgumentList_nested_withComment_double() {
TypeArgumentList argumentList =
- ParserTestCase.parse4("parseTypeArgumentList", "<A<B /* 0 */ >>");
+ parse4("parseTypeArgumentList", "<A<B /* 0 */ >>");
expect(argumentList.leftBracket, isNotNull);
expect(argumentList.rightBracket, isNotNull);
expect(argumentList.arguments, hasLength(1));
@@ -9535,7 +9171,7 @@ void''');
void test_parseTypeArgumentList_nested_withComment_tripple() {
TypeArgumentList argumentList =
- ParserTestCase.parse4("parseTypeArgumentList", "<A<B<C /* 0 */ >>>");
+ parse4("parseTypeArgumentList", "<A<B<C /* 0 */ >>>");
expect(argumentList.leftBracket, isNotNull);
expect(argumentList.rightBracket, isNotNull);
expect(argumentList.arguments, hasLength(1));
@@ -9561,35 +9197,33 @@ void''');
}
void test_parseTypeArgumentList_single() {
- TypeArgumentList argumentList =
- ParserTestCase.parse4("parseTypeArgumentList", "<int>");
+ TypeArgumentList argumentList = parse4("parseTypeArgumentList", "<int>");
expect(argumentList.leftBracket, isNotNull);
expect(argumentList.arguments, hasLength(1));
expect(argumentList.rightBracket, isNotNull);
}
void test_parseTypeName_parameterized() {
- TypeName typeName = ParserTestCase.parse4("parseTypeName", "List<int>");
+ TypeName typeName = parse4("parseTypeName", "List<int>");
expect(typeName.name, isNotNull);
expect(typeName.typeArguments, isNotNull);
}
void test_parseTypeName_simple() {
- TypeName typeName = ParserTestCase.parse4("parseTypeName", "int");
+ TypeName typeName = parse4("parseTypeName", "int");
expect(typeName.name, isNotNull);
expect(typeName.typeArguments, isNull);
}
void test_parseTypeParameter_bounded() {
- TypeParameter parameter =
- ParserTestCase.parse4("parseTypeParameter", "A extends B");
+ TypeParameter parameter = parse4("parseTypeParameter", "A extends B");
expect(parameter.bound, isNotNull);
expect(parameter.extendsKeyword, isNotNull);
expect(parameter.name, isNotNull);
}
void test_parseTypeParameter_simple() {
- TypeParameter parameter = ParserTestCase.parse4("parseTypeParameter", "A");
+ TypeParameter parameter = parse4("parseTypeParameter", "A");
expect(parameter.bound, isNull);
expect(parameter.extendsKeyword, isNull);
expect(parameter.name, isNotNull);
@@ -9597,7 +9231,7 @@ void''');
void test_parseTypeParameterList_multiple() {
TypeParameterList parameterList =
- ParserTestCase.parse4("parseTypeParameterList", "<A, B extends C, D>");
+ parse4("parseTypeParameterList", "<A, B extends C, D>");
expect(parameterList.leftBracket, isNotNull);
expect(parameterList.rightBracket, isNotNull);
expect(parameterList.typeParameters, hasLength(3));
@@ -9605,39 +9239,35 @@ void''');
void test_parseTypeParameterList_parameterizedWithTrailingEquals() {
TypeParameterList parameterList =
- ParserTestCase.parse4("parseTypeParameterList", "<A extends B<E>>=");
+ parse4("parseTypeParameterList", "<A extends B<E>>=");
expect(parameterList.leftBracket, isNotNull);
expect(parameterList.rightBracket, isNotNull);
expect(parameterList.typeParameters, hasLength(1));
}
void test_parseTypeParameterList_single() {
- TypeParameterList parameterList =
- ParserTestCase.parse4("parseTypeParameterList", "<A>");
+ TypeParameterList parameterList = parse4("parseTypeParameterList", "<A>");
expect(parameterList.leftBracket, isNotNull);
expect(parameterList.rightBracket, isNotNull);
expect(parameterList.typeParameters, hasLength(1));
}
void test_parseTypeParameterList_withTrailingEquals() {
- TypeParameterList parameterList =
- ParserTestCase.parse4("parseTypeParameterList", "<A>=");
+ TypeParameterList parameterList = parse4("parseTypeParameterList", "<A>=");
expect(parameterList.leftBracket, isNotNull);
expect(parameterList.rightBracket, isNotNull);
expect(parameterList.typeParameters, hasLength(1));
}
void test_parseUnaryExpression_decrement_normal() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "--x");
+ PrefixExpression expression = parse4("parseUnaryExpression", "--x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS_MINUS);
expect(expression.operand, isNotNull);
}
void test_parseUnaryExpression_decrement_super() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "--super");
+ PrefixExpression expression = parse4("parseUnaryExpression", "--super");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS);
Expression innerExpression = expression.operand;
@@ -9650,8 +9280,7 @@ void''');
}
void test_parseUnaryExpression_decrement_super_propertyAccess() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "--super.x");
+ PrefixExpression expression = parse4("parseUnaryExpression", "--super.x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS_MINUS);
expect(expression.operand, isNotNull);
@@ -9662,7 +9291,7 @@ void''');
void test_parseUnaryExpression_decrement_super_withComment() {
PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "/* 0 */ --super");
+ parse4("parseUnaryExpression", "/* 0 */ --super");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS);
expect(expression.operator.precedingComments, isNotNull);
@@ -9676,16 +9305,14 @@ void''');
}
void test_parseUnaryExpression_increment_normal() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "++x");
+ PrefixExpression expression = parse4("parseUnaryExpression", "++x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS_PLUS);
expect(expression.operand, isNotNull);
}
void test_parseUnaryExpression_increment_super_index() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "++super[0]");
+ PrefixExpression expression = parse4("parseUnaryExpression", "++super[0]");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS_PLUS);
expect(expression.operand, isNotNull);
@@ -9695,8 +9322,7 @@ void''');
}
void test_parseUnaryExpression_increment_super_propertyAccess() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "++super.x");
+ PrefixExpression expression = parse4("parseUnaryExpression", "++super.x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS_PLUS);
expect(expression.operand, isNotNull);
@@ -9706,48 +9332,42 @@ void''');
}
void test_parseUnaryExpression_minus_normal() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "-x");
+ PrefixExpression expression = parse4("parseUnaryExpression", "-x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS);
expect(expression.operand, isNotNull);
}
void test_parseUnaryExpression_minus_super() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "-super");
+ PrefixExpression expression = parse4("parseUnaryExpression", "-super");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS);
expect(expression.operand, isNotNull);
}
void test_parseUnaryExpression_not_normal() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "!x");
+ PrefixExpression expression = parse4("parseUnaryExpression", "!x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.BANG);
expect(expression.operand, isNotNull);
}
void test_parseUnaryExpression_not_super() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "!super");
+ PrefixExpression expression = parse4("parseUnaryExpression", "!super");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.BANG);
expect(expression.operand, isNotNull);
}
void test_parseUnaryExpression_tilda_normal() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "~x");
+ PrefixExpression expression = parse4("parseUnaryExpression", "~x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.TILDE);
expect(expression.operand, isNotNull);
}
void test_parseUnaryExpression_tilda_super() {
- PrefixExpression expression =
- ParserTestCase.parse4("parseUnaryExpression", "~super");
+ PrefixExpression expression = parse4("parseUnaryExpression", "~super");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.TILDE);
expect(expression.operand, isNotNull);
@@ -9755,95 +9375,86 @@ void''');
void test_parseVariableDeclaration_equals() {
VariableDeclaration declaration =
- ParserTestCase.parse4("parseVariableDeclaration", "a = b");
+ parse4("parseVariableDeclaration", "a = b");
expect(declaration.name, isNotNull);
expect(declaration.equals, isNotNull);
expect(declaration.initializer, isNotNull);
}
void test_parseVariableDeclaration_noEquals() {
- VariableDeclaration declaration =
- ParserTestCase.parse4("parseVariableDeclaration", "a");
+ VariableDeclaration declaration = parse4("parseVariableDeclaration", "a");
expect(declaration.name, isNotNull);
expect(declaration.equals, isNull);
expect(declaration.initializer, isNull);
}
void test_parseVariableDeclarationListAfterMetadata_const_noType() {
- VariableDeclarationList declarationList = ParserTestCase.parse(
- "parseVariableDeclarationListAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "const a");
+ VariableDeclarationList declarationList = parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "const a");
expect(declarationList.keyword, isNotNull);
expect(declarationList.type, isNull);
expect(declarationList.variables, hasLength(1));
}
void test_parseVariableDeclarationListAfterMetadata_const_type() {
- VariableDeclarationList declarationList = ParserTestCase.parse(
- "parseVariableDeclarationListAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "const A a");
+ VariableDeclarationList declarationList = parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "const A a");
expect(declarationList.keyword, isNotNull);
expect(declarationList.type, isNotNull);
expect(declarationList.variables, hasLength(1));
}
void test_parseVariableDeclarationListAfterMetadata_final_noType() {
- VariableDeclarationList declarationList = ParserTestCase.parse(
- "parseVariableDeclarationListAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "final a");
+ VariableDeclarationList declarationList = parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "final a");
expect(declarationList.keyword, isNotNull);
expect(declarationList.type, isNull);
expect(declarationList.variables, hasLength(1));
}
void test_parseVariableDeclarationListAfterMetadata_final_type() {
- VariableDeclarationList declarationList = ParserTestCase.parse(
- "parseVariableDeclarationListAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "final A a");
+ VariableDeclarationList declarationList = parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "final A a");
expect(declarationList.keyword, isNotNull);
expect(declarationList.type, isNotNull);
expect(declarationList.variables, hasLength(1));
}
void test_parseVariableDeclarationListAfterMetadata_type_multiple() {
- VariableDeclarationList declarationList = ParserTestCase.parse(
- "parseVariableDeclarationListAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "A a, b, c");
+ VariableDeclarationList declarationList = parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "A a, b, c");
expect(declarationList.keyword, isNull);
expect(declarationList.type, isNotNull);
expect(declarationList.variables, hasLength(3));
}
void test_parseVariableDeclarationListAfterMetadata_type_single() {
- VariableDeclarationList declarationList = ParserTestCase.parse(
- "parseVariableDeclarationListAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "A a");
+ VariableDeclarationList declarationList = parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "A a");
expect(declarationList.keyword, isNull);
expect(declarationList.type, isNotNull);
expect(declarationList.variables, hasLength(1));
}
void test_parseVariableDeclarationListAfterMetadata_var_multiple() {
- VariableDeclarationList declarationList = ParserTestCase.parse(
- "parseVariableDeclarationListAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "var a, b, c");
+ VariableDeclarationList declarationList = parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "var a, b, c");
expect(declarationList.keyword, isNotNull);
expect(declarationList.type, isNull);
expect(declarationList.variables, hasLength(3));
}
void test_parseVariableDeclarationListAfterMetadata_var_single() {
- VariableDeclarationList declarationList = ParserTestCase.parse(
- "parseVariableDeclarationListAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "var a");
+ VariableDeclarationList declarationList = parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "var a");
expect(declarationList.keyword, isNotNull);
expect(declarationList.type, isNull);
expect(declarationList.variables, hasLength(1));
@@ -9851,7 +9462,7 @@ void''');
void test_parseVariableDeclarationListAfterType_type() {
TypeName type = new TypeName(new SimpleIdentifier(null), null);
- VariableDeclarationList declarationList = ParserTestCase.parse(
+ VariableDeclarationList declarationList = parse(
"parseVariableDeclarationListAfterType", <Object>[
emptyCommentAndMetadata(),
null,
@@ -9864,7 +9475,7 @@ void''');
void test_parseVariableDeclarationListAfterType_var() {
Token keyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
- VariableDeclarationList declarationList = ParserTestCase.parse(
+ VariableDeclarationList declarationList = parse(
"parseVariableDeclarationListAfterType", <Object>[
emptyCommentAndMetadata(),
keyword,
@@ -9876,10 +9487,9 @@ void''');
}
void test_parseVariableDeclarationStatementAfterMetadata_multiple() {
- VariableDeclarationStatement statement = ParserTestCase.parse(
- "parseVariableDeclarationStatementAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "var x, y, z;");
+ VariableDeclarationStatement statement = parse(
+ "parseVariableDeclarationStatementAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "var x, y, z;");
expect(statement.semicolon, isNotNull);
VariableDeclarationList variableList = statement.variables;
expect(variableList, isNotNull);
@@ -9887,10 +9497,9 @@ void''');
}
void test_parseVariableDeclarationStatementAfterMetadata_single() {
- VariableDeclarationStatement statement = ParserTestCase.parse(
- "parseVariableDeclarationStatementAfterMetadata", <Object>[
- emptyCommentAndMetadata()
- ], "var x;");
+ VariableDeclarationStatement statement = parse(
+ "parseVariableDeclarationStatementAfterMetadata",
+ <Object>[emptyCommentAndMetadata()], "var x;");
expect(statement.semicolon, isNotNull);
VariableDeclarationList variableList = statement.variables;
expect(variableList, isNotNull);
@@ -9898,8 +9507,7 @@ void''');
}
void test_parseWhileStatement() {
- WhileStatement statement =
- ParserTestCase.parse4("parseWhileStatement", "while (x) {}");
+ WhileStatement statement = parse4("parseWhileStatement", "while (x) {}");
expect(statement.whileKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -9908,21 +9516,19 @@ void''');
}
void test_parseWithClause_multiple() {
- WithClause clause =
- ParserTestCase.parse4("parseWithClause", "with A, B, C");
+ WithClause clause = parse4("parseWithClause", "with A, B, C");
expect(clause.withKeyword, isNotNull);
expect(clause.mixinTypes, hasLength(3));
}
void test_parseWithClause_single() {
- WithClause clause = ParserTestCase.parse4("parseWithClause", "with M");
+ WithClause clause = parse4("parseWithClause", "with M");
expect(clause.withKeyword, isNotNull);
expect(clause.mixinTypes, hasLength(1));
}
void test_parseYieldStatement_each() {
- YieldStatement statement =
- ParserTestCase.parse4("parseYieldStatement", "yield* x;");
+ YieldStatement statement = parse4("parseYieldStatement", "yield* x;");
expect(statement.yieldKeyword, isNotNull);
expect(statement.star, isNotNull);
expect(statement.expression, isNotNull);
@@ -9930,8 +9536,7 @@ void''');
}
void test_parseYieldStatement_normal() {
- YieldStatement statement =
- ParserTestCase.parse4("parseYieldStatement", "yield x;");
+ YieldStatement statement = parse4("parseYieldStatement", "yield x;");
expect(statement.yieldKeyword, isNotNull);
expect(statement.star, isNull);
expect(statement.expression, isNotNull);
@@ -10076,8 +9681,7 @@ void''');
*/
SimpleIdentifier _createSyntheticIdentifier() {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2(
- "createSyntheticIdentifier", "", listener);
+ return invokeParserMethod2("createSyntheticIdentifier", "", listener);
}
/**
@@ -10090,8 +9694,7 @@ void''');
*/
SimpleStringLiteral _createSyntheticStringLiteral() {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2(
- "createSyntheticStringLiteral", "", listener);
+ return invokeParserMethod2("createSyntheticStringLiteral", "", listener);
}
/**
@@ -10104,7 +9707,7 @@ void''');
*/
bool _isFunctionDeclaration(String source) {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2(
+ return invokeParserMethod2(
"isFunctionDeclaration", source, listener) as bool;
}
@@ -10128,9 +9731,8 @@ void''');
// Parse the source.
//
Parser parser = new Parser(null, listener);
- return invokeParserMethodImpl(parser, "isFunctionExpression", <Object>[
- tokenStream
- ], tokenStream) as bool;
+ return invokeParserMethodImpl(parser, "isFunctionExpression",
+ <Object>[tokenStream], tokenStream) as bool;
}
/**
@@ -10143,7 +9745,7 @@ void''');
*/
bool _isInitializedVariableDeclaration(String source) {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2(
+ return invokeParserMethod2(
"isInitializedVariableDeclaration", source, listener) as bool;
}
@@ -10157,8 +9759,7 @@ void''');
*/
bool _isSwitchMember(String source) {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2(
- "isSwitchMember", source, listener) as bool;
+ return invokeParserMethod2("isSwitchMember", source, listener) as bool;
}
/**
« no previous file with comments | « pkg/analyzer/test/generated/ast_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698