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

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

Issue 725143004: Format and sort analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
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 1c6e01a9e09f71f182035a5de2041f2d797bc207..a05201ee384926d4d28d4ad677f6752abdf1e676 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -7,26 +7,39 @@
library engine.parser_test;
-import 'package:analyzer/src/generated/error.dart';
-import 'package:analyzer/src/generated/source.dart' show Source;
-import 'package:analyzer/src/generated/scanner.dart';
import 'package:analyzer/src/generated/ast.dart';
-import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/element.dart';
-import 'package:analyzer/src/generated/utilities_dart.dart';
-import 'package:unittest/unittest.dart';
-import 'test_support.dart';
+import 'package:analyzer/src/generated/error.dart';
+import 'package:analyzer/src/generated/parser.dart';
+import 'package:analyzer/src/generated/scanner.dart';
+import 'package:analyzer/src/generated/source.dart' show Source;
import 'package:analyzer/src/generated/testing/ast_factory.dart';
import 'package:analyzer/src/generated/testing/element_factory.dart';
import 'package:analyzer/src/generated/testing/token_factory.dart';
+import 'package:analyzer/src/generated/utilities_dart.dart';
+import 'package:unittest/unittest.dart';
import '../reflective_tests.dart';
+import 'test_support.dart';
-class AnalysisErrorListener_SimpleParserTest_computeStringValue implements AnalysisErrorListener {
+main() {
+ groupSep = ' | ';
+ runReflectiveTests(ComplexParserTest);
+ runReflectiveTests(ErrorParserTest);
+ runReflectiveTests(IncrementalParserTest);
+ runReflectiveTests(NonErrorParserTest);
+ runReflectiveTests(RecoveryParserTest);
+ runReflectiveTests(ResolutionCopierTest);
+ runReflectiveTests(SimpleParserTest);
+}
+
+class AnalysisErrorListener_SimpleParserTest_computeStringValue implements
+ AnalysisErrorListener {
@override
void onError(AnalysisError event) {
- fail("Unexpected compilation error: ${event.message} (${event.offset}, ${event.length})");
+ fail(
+ "Unexpected compilation error: ${event.message} (${event.offset}, ${event.length})");
}
}
@@ -94,10 +107,12 @@ class AstValidator extends UnifyingAstVisitor<Object> {
int parentStart = parent.offset;
int parentEnd = parentStart + parent.length;
if (nodeStart < parentStart) {
- _errors.add("Invalid source start ($nodeStart) for ${node.runtimeType} inside ${parent.runtimeType} ($parentStart)");
+ _errors.add(
+ "Invalid source start ($nodeStart) for ${node.runtimeType} inside ${parent.runtimeType} ($parentStart)");
}
if (nodeEnd > parentEnd) {
- _errors.add("Invalid source end ($nodeEnd) for ${node.runtimeType} inside ${parent.runtimeType} ($parentStart)");
+ _errors.add(
+ "Invalid source end ($nodeEnd) for ${node.runtimeType} inside ${parent.runtimeType} ($parentStart)");
}
}
}
@@ -113,42 +128,69 @@ class AstValidator extends UnifyingAstVisitor<Object> {
class ComplexParserTest extends ParserTestCase {
void test_additiveExpression_normal() {
BinaryExpression expression = ParserTestCase.parseExpression("x + y - z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_additiveExpression_noSpaces() {
BinaryExpression expression = ParserTestCase.parseExpression("i+1");
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
- EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiteral, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IntegerLiteral,
+ IntegerLiteral,
+ expression.rightOperand);
}
void test_additiveExpression_precedence_multiplicative_left() {
BinaryExpression expression = ParserTestCase.parseExpression("x * y + z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_additiveExpression_precedence_multiplicative_left_withSuper() {
- BinaryExpression expression = ParserTestCase.parseExpression("super * y - z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_additiveExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super + y - z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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 =
+ ParserTestCase.parseExpression("a(b)(c).d(e).f");
expect(propertyAccess1.propertyName.name, "f");
//
// a(b)(c).d(e)
//
- MethodInvocation invocation2 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, propertyAccess1.target);
+ MethodInvocation invocation2 = EngineTestCase.assertInstanceOf(
+ (obj) => obj is MethodInvocation,
+ MethodInvocation,
+ propertyAccess1.target);
expect(invocation2.methodName.name, "d");
ArgumentList argumentList2 = invocation2.argumentList;
expect(argumentList2, isNotNull);
@@ -156,14 +198,20 @@ class ComplexParserTest extends ParserTestCase {
//
// a(b)(c)
//
- FunctionExpressionInvocation invocation3 = EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpressionInvocation, FunctionExpressionInvocation, invocation2.target);
+ FunctionExpressionInvocation invocation3 = EngineTestCase.assertInstanceOf(
+ (obj) => obj is FunctionExpressionInvocation,
+ FunctionExpressionInvocation,
+ invocation2.target);
ArgumentList argumentList3 = invocation3.argumentList;
expect(argumentList3, isNotNull);
expect(argumentList3.arguments, hasLength(1));
//
// a(b)
//
- MethodInvocation invocation4 = EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, invocation3.function);
+ MethodInvocation invocation4 = EngineTestCase.assertInstanceOf(
+ (obj) => obj is MethodInvocation,
+ MethodInvocation,
+ invocation3.function);
expect(invocation4.methodName.name, "a");
ArgumentList argumentList4 = invocation4.argumentList;
expect(argumentList4, isNotNull);
@@ -171,96 +219,169 @@ class ComplexParserTest extends ParserTestCase {
}
void test_assignmentExpression_compound() {
- AssignmentExpression expression = ParserTestCase.parseExpression("x = y = 0");
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftHandSide);
- EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression, AssignmentExpression, expression.rightHandSide);
+ AssignmentExpression expression =
+ ParserTestCase.parseExpression("x = y = 0");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftHandSide);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is AssignmentExpression,
+ AssignmentExpression,
+ expression.rightHandSide);
}
void test_assignmentExpression_indexExpression() {
- AssignmentExpression expression = ParserTestCase.parseExpression("x[1] = 0");
- EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpression, expression.leftHandSide);
- EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiteral, expression.rightHandSide);
+ AssignmentExpression expression =
+ ParserTestCase.parseExpression("x[1] = 0");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IndexExpression,
+ IndexExpression,
+ expression.leftHandSide);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IntegerLiteral,
+ IntegerLiteral,
+ expression.rightHandSide);
}
void test_assignmentExpression_prefixedIdentifier() {
AssignmentExpression expression = ParserTestCase.parseExpression("x.y = 0");
- EngineTestCase.assertInstanceOf((obj) => obj is PrefixedIdentifier, PrefixedIdentifier, expression.leftHandSide);
- EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiteral, expression.rightHandSide);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is PrefixedIdentifier,
+ PrefixedIdentifier,
+ expression.leftHandSide);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IntegerLiteral,
+ IntegerLiteral,
+ expression.rightHandSide);
}
void test_assignmentExpression_propertyAccess() {
- AssignmentExpression expression = ParserTestCase.parseExpression("super.y = 0");
- EngineTestCase.assertInstanceOf((obj) => obj is PropertyAccess, PropertyAccess, expression.leftHandSide);
- EngineTestCase.assertInstanceOf((obj) => obj is IntegerLiteral, IntegerLiteral, expression.rightHandSide);
+ AssignmentExpression expression =
+ ParserTestCase.parseExpression("super.y = 0");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is PropertyAccess,
+ PropertyAccess,
+ expression.leftHandSide);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IntegerLiteral,
+ IntegerLiteral,
+ expression.rightHandSide);
}
void test_bitwiseAndExpression_normal() {
BinaryExpression expression = ParserTestCase.parseExpression("x & y & z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseAndExpression_precedence_equality_left() {
BinaryExpression expression = ParserTestCase.parseExpression("x == y && z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseAndExpression_precedence_equality_right() {
BinaryExpression expression = ParserTestCase.parseExpression("x && y == z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_bitwiseAndExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super & y & z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parseExpression("super & y & z");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseOrExpression_normal() {
BinaryExpression expression = ParserTestCase.parseExpression("x | y | z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseOrExpression_precedence_xor_left() {
BinaryExpression expression = ParserTestCase.parseExpression("x ^ y | z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseOrExpression_precedence_xor_right() {
BinaryExpression expression = ParserTestCase.parseExpression("x | y ^ z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_bitwiseOrExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super | y | z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parseExpression("super | y | z");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseXorExpression_normal() {
BinaryExpression expression = ParserTestCase.parseExpression("x ^ y ^ z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseXorExpression_precedence_and_left() {
BinaryExpression expression = ParserTestCase.parseExpression("x & y ^ z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseXorExpression_precedence_and_right() {
BinaryExpression expression = ParserTestCase.parseExpression("x ^ y & z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_bitwiseXorExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super ^ y ^ z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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;");
+ CascadeExpression cascade =
+ ParserTestCase.parseExpression("new Map()..[3] = 4 ..[0] = 11;");
Expression target = cascade.target;
for (Expression section in cascade.cascadeSections) {
- EngineTestCase.assertInstanceOf((obj) => obj is AssignmentExpression, AssignmentExpression, section);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is AssignmentExpression,
+ AssignmentExpression,
+ section);
Expression lhs = (section as AssignmentExpression).leftHandSide;
- EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpression, lhs);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IndexExpression,
+ IndexExpression,
+ lhs);
IndexExpression index = lhs as IndexExpression;
expect(index.isCascaded, isTrue);
expect(index.realTarget, same(target));
@@ -268,8 +389,12 @@ class ComplexParserTest extends ParserTestCase {
}
void test_conditionalExpression_precedence_logicalOrExpression() {
- ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.condition);
+ ConditionalExpression expression =
+ ParserTestCase.parseExpression("a | b ? y : z");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.condition);
}
void test_constructor_initializer_withParenthesizedExpression() {
@@ -284,104 +409,171 @@ class C {
}
void test_equalityExpression_normal() {
- BinaryExpression expression = ParserTestCase.parseExpression("x == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.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");
- EngineTestCase.assertInstanceOf((obj) => obj is IsExpression, IsExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IsExpression,
+ IsExpression,
+ expression.leftOperand);
}
void test_equalityExpression_precedence_relational_right() {
BinaryExpression expression = ParserTestCase.parseExpression("x == y is z");
- EngineTestCase.assertInstanceOf((obj) => obj is IsExpression, IsExpression, expression.rightOperand);
+ 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]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.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");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_logicalAndExpression_precedence_bitwiseOr_left() {
BinaryExpression expression = ParserTestCase.parseExpression("x | y < z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_logicalAndExpression_precedence_bitwiseOr_right() {
BinaryExpression expression = ParserTestCase.parseExpression("x < y | z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_logicalOrExpression() {
BinaryExpression expression = ParserTestCase.parseExpression("x || y || z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_logicalOrExpression_precedence_logicalAnd_left() {
BinaryExpression expression = ParserTestCase.parseExpression("x && y || z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_logicalOrExpression_precedence_logicalAnd_right() {
BinaryExpression expression = ParserTestCase.parseExpression("x || y && z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_multipleLabels_statement() {
- LabeledStatement statement = ParserTestCase.parseStatement("a: b: c: return x;");
+ LabeledStatement statement =
+ ParserTestCase.parseStatement("a: b: c: return x;");
expect(statement.labels, hasLength(3));
- EngineTestCase.assertInstanceOf((obj) => obj is ReturnStatement, ReturnStatement, statement.statement);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ReturnStatement,
+ ReturnStatement,
+ statement.statement);
}
void test_multiplicativeExpression_normal() {
BinaryExpression expression = ParserTestCase.parseExpression("x * y / z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_multiplicativeExpression_precedence_unary_left() {
BinaryExpression expression = ParserTestCase.parseExpression("-x * y");
- EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression, PrefixExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is PrefixExpression,
+ PrefixExpression,
+ expression.leftOperand);
}
void test_multiplicativeExpression_precedence_unary_right() {
BinaryExpression expression = ParserTestCase.parseExpression("x * -y");
- EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression, PrefixExpression, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is PrefixExpression,
+ PrefixExpression,
+ expression.rightOperand);
}
void test_multiplicativeExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super * y / z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.expression);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.expression);
}
void test_shiftExpression_normal() {
BinaryExpression expression = ParserTestCase.parseExpression("x >> 4 << 3");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_shiftExpression_precedence_additive_left() {
BinaryExpression expression = ParserTestCase.parseExpression("x + y << z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_shiftExpression_precedence_additive_right() {
BinaryExpression expression = ParserTestCase.parseExpression("x << y + z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_shiftExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super >> 4 << 3");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parseExpression("super >> 4 << 3");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_topLevelVariable_withMetadata() {
@@ -395,136 +587,224 @@ class C {
*/
class ErrorParserTest extends ParserTestCase {
void fail_expectedListOrMapLiteral() {
- // It isn't clear that this test can ever pass. The parser is currently create a synthetic list
- // literal in this case, but isSynthetic() isn't overridden for ListLiteral. The problem is that
- // the synthetic list 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]);
+ // It isn't clear that this test can ever pass. The parser is currently
+ // create a synthetic list literal in this case, but isSynthetic() isn't
+ // overridden for ListLiteral. The problem is that the synthetic list
+ // 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]);
expect(literal.isSynthetic, isTrue);
}
void fail_illegalAssignmentToNonAssignable_superAssigned() {
// TODO(brianwilkerson) When this test starts to pass, remove the test
// test_illegalAssignmentToNonAssignable_superAssigned.
- ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseCommentReference",
+ <Object>["new 42", 0],
+ "",
+ [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
}
void fail_invalidCommentReference__new_tooMuch() {
- ParserTestCase.parse3("parseCommentReference", <Object> ["new a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
+ ParserTestCase.parse3(
+ "parseCommentReference",
+ <Object>["new a.b.c.d", 0],
+ "",
+ [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
}
void fail_invalidCommentReference__nonNew_nonIdentifier() {
// This test fails because the method parseCommentReference returns null.
- ParserTestCase.parse3("parseCommentReference", <Object> ["42", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ // 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]);
}
void fail_missingFunctionParameters_local_nonVoid_block() {
- // The parser does not recognize this as a function declaration, so it tries to parse it as an
- // expression statement. It isn't clear what the best error message is in this case.
- ParserTestCase.parseStatement("int f { return x;}", [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
+ // The parser does not recognize this as a function declaration, so it tries
+ // to parse it as an expression statement. It isn't clear what the best
+ // error message is in this case.
+ ParserTestCase.parseStatement(
+ "int f { return x;}",
+ [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
}
void fail_missingFunctionParameters_local_nonVoid_expression() {
- // The parser does not recognize this as a function declaration, so it tries to parse it as an
- // expression statement. It isn't clear what the best error message is in this case.
- ParserTestCase.parseStatement("int f => x;", [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
+ // The parser does not recognize this as a function declaration, so it tries
+ // to parse it as an expression statement. It isn't clear what the best
+ // error message is in this case.
+ ParserTestCase.parseStatement(
+ "int f => x;",
+ [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
}
void fail_namedFunctionExpression() {
- Expression expression = ParserTestCase.parse4("parsePrimaryExpression", "f() {}", [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
- EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, FunctionExpression, expression);
+ Expression expression = ParserTestCase.parse4(
+ "parsePrimaryExpression",
+ "f() {}",
+ [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FunctionExpression,
+ FunctionExpression,
+ expression);
}
void fail_unexpectedToken_invalidPostfixExpression() {
- // Note: this might not be the right error to produce, but some error should be produced
+ // Note: this might not be the right error to produce, but some error should
+ // be produced
ParserTestCase.parseExpression("f()++", [ParserErrorCode.UNEXPECTED_TOKEN]);
}
void fail_varAndType_local() {
- // This is currently reporting EXPECTED_TOKEN for a missing semicolon, but this would be a
- // better error message.
+ // This is currently reporting EXPECTED_TOKEN for a missing semicolon, but
+ // this would be a better error message.
ParserTestCase.parseStatement("var int x;", [ParserErrorCode.VAR_AND_TYPE]);
}
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]);
+ // 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]);
}
void test_abstractClassMember_constructor() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "abstract C.c();", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "abstract set m(v);",
+ [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
}
void test_abstractEnum() {
- ParserTestCase.parseCompilationUnit("abstract enum E {ONE}", [ParserErrorCode.ABSTRACT_ENUM]);
+ ParserTestCase.parseCompilationUnit(
+ "abstract enum E {ONE}",
+ [ParserErrorCode.ABSTRACT_ENUM]);
}
void test_abstractTopLevelFunction_function() {
- ParserTestCase.parseCompilationUnit("abstract f(v) {}", [ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION]);
+ ParserTestCase.parseCompilationUnit(
+ "abstract f(v) {}",
+ [ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION]);
}
void test_abstractTopLevelFunction_getter() {
- ParserTestCase.parseCompilationUnit("abstract get m {}", [ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION]);
+ ParserTestCase.parseCompilationUnit(
+ "abstract get m {}",
+ [ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION]);
}
void test_abstractTopLevelFunction_setter() {
- ParserTestCase.parseCompilationUnit("abstract set m(v) {}", [ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION]);
+ ParserTestCase.parseCompilationUnit(
+ "abstract set m(v) {}",
+ [ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION]);
}
void test_abstractTopLevelVariable() {
- ParserTestCase.parseCompilationUnit("abstract C f;", [ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE]);
+ ParserTestCase.parseCompilationUnit(
+ "abstract C f;",
+ [ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE]);
}
void test_abstractTypeDef() {
- ParserTestCase.parseCompilationUnit("abstract typedef F();", [ParserErrorCode.ABSTRACT_TYPEDEF]);
+ ParserTestCase.parseCompilationUnit(
+ "abstract typedef F();",
+ [ParserErrorCode.ABSTRACT_TYPEDEF]);
}
void test_assertDoesNotTakeAssignment() {
- ParserTestCase.parse4("parseAssertStatement", "assert(b = true);", [ParserErrorCode.ASSERT_DOES_NOT_TAKE_ASSIGNMENT]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse4(
+ "parseAssertStatement",
+ "assert(throw x);",
+ [ParserErrorCode.ASSERT_DOES_NOT_TAKE_THROW]);
}
void test_breakOutsideOfLoop_breakInDoStatement() {
@@ -536,11 +816,16 @@ class ErrorParserTest extends ParserTestCase {
}
void test_breakOutsideOfLoop_breakInIfStatement() {
- ParserTestCase.parse4("parseIfStatement", "if (x) {break;}", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
+ ParserTestCase.parse4(
+ "parseIfStatement",
+ "if (x) {break;}",
+ [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
}
void test_breakOutsideOfLoop_breakInSwitchStatement() {
- ParserTestCase.parse4("parseSwitchStatement", "switch (x) {case 1: break;}");
+ ParserTestCase.parse4(
+ "parseSwitchStatement",
+ "switch (x) {case 1: break;}");
}
void test_breakOutsideOfLoop_breakInWhileStatement() {
@@ -548,7 +833,9 @@ class ErrorParserTest extends ParserTestCase {
}
void test_breakOutsideOfLoop_functionExpression_inALoop() {
- ParserTestCase.parseStatement("for(; x;) {() {break;};}", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
+ ParserTestCase.parseStatement(
+ "for(; x;) {() {break;};}",
+ [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
}
void test_breakOutsideOfLoop_functionExpression_withALoop() {
@@ -556,51 +843,87 @@ 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;", [
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN]);
+ // 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;",
+ [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.EXPECTED_TOKEN]);
}
void test_constAndFinal() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "const final int x;", [ParserErrorCode.CONST_AND_FINAL]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "const var x;",
+ [ParserErrorCode.CONST_AND_VAR]);
}
void test_constClass() {
- ParserTestCase.parseCompilationUnit("const class C {}", [ParserErrorCode.CONST_CLASS]);
+ ParserTestCase.parseCompilationUnit(
+ "const class C {}",
+ [ParserErrorCode.CONST_CLASS]);
}
void test_constConstructorWithBody() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "const C() {}", [ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "const C() {}",
+ [ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY]);
}
void test_constEnum() {
- ParserTestCase.parseCompilationUnit("const enum E {ONE}", [ParserErrorCode.CONST_ENUM]);
+ ParserTestCase.parseCompilationUnit(
+ "const enum E {ONE}",
+ [ParserErrorCode.CONST_ENUM]);
}
void test_constFactory() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "const factory C() {}", [ParserErrorCode.CONST_FACTORY]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "const factory C() {}",
+ [ParserErrorCode.CONST_FACTORY]);
}
void test_constMethod() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "const int m() {}", [ParserErrorCode.CONST_METHOD]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "var C() {}",
+ [ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]);
}
void test_constTypedef() {
- ParserTestCase.parseCompilationUnit("const typedef F();", [ParserErrorCode.CONST_TYPEDEF]);
+ ParserTestCase.parseCompilationUnit(
+ "const typedef F();",
+ [ParserErrorCode.CONST_TYPEDEF]);
}
void test_continueOutsideOfLoop_continueInDoStatement() {
@@ -612,11 +935,16 @@ class ErrorParserTest extends ParserTestCase {
}
void test_continueOutsideOfLoop_continueInIfStatement() {
- ParserTestCase.parse4("parseIfStatement", "if (x) {continue;}", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
+ ParserTestCase.parse4(
+ "parseIfStatement",
+ "if (x) {continue;}",
+ [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
}
void test_continueOutsideOfLoop_continueInSwitchStatement() {
- ParserTestCase.parse4("parseSwitchStatement", "switch (x) {case 1: continue a;}");
+ ParserTestCase.parse4(
+ "parseSwitchStatement",
+ "switch (x) {case 1: continue a;}");
}
void test_continueOutsideOfLoop_continueInWhileStatement() {
@@ -624,7 +952,9 @@ class ErrorParserTest extends ParserTestCase {
}
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() {
@@ -632,144 +962,246 @@ class ErrorParserTest extends ParserTestCase {
}
void test_continueWithoutLabelInCase_error() {
- ParserTestCase.parse4("parseSwitchStatement", "switch (x) {case 1: continue;}", [ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE]);
+ ParserTestCase.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;}");
+ ParserTestCase.parse4(
+ "parseSwitchStatement",
+ "switch (x) {case 1: continue a;}");
}
void test_continueWithoutLabelInCase_noError_switchInLoop() {
- ParserTestCase.parse4("parseWhileStatement", "while (a) { switch (b) {default: continue;}}");
+ ParserTestCase.parse4(
+ "parseWhileStatement",
+ "while (a) { switch (b) {default: continue;}}");
}
void test_deprecatedClassTypeAlias() {
- ParserTestCase.parseCompilationUnit("typedef C = S with M;", [ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]);
+ ParserTestCase.parseCompilationUnit(
+ "typedef C = S with M;",
+ [ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]);
}
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]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "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]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseEnumDeclaration",
+ <Object>[emptyCommentAndMetadata()],
+ "enum E {}",
+ [ParserErrorCode.EMPTY_ENUM_BODY]);
}
void test_equalityCannotBeEqualityOperand_eq_eq() {
- ParserTestCase.parseExpression("1 == 2 == 3", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
+ ParserTestCase.parseExpression(
+ "1 == 2 == 3",
+ [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
}
void test_equalityCannotBeEqualityOperand_eq_neq() {
- ParserTestCase.parseExpression("1 == 2 != 3", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
+ ParserTestCase.parseExpression(
+ "1 == 2 != 3",
+ [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
}
void test_equalityCannotBeEqualityOperand_neq_eq() {
- ParserTestCase.parseExpression("1 != 2 == 3", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
+ ParserTestCase.parseExpression(
+ "1 != 2 == 3",
+ [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
}
void test_expectedCaseOrDefault() {
- ParserTestCase.parse4("parseSwitchStatement", "switch (e) {break;}", [ParserErrorCode.EXPECTED_CASE_OR_DEFAULT]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "4 score",
+ [ParserErrorCode.EXPECTED_EXECUTABLE]);
}
void test_expectedExecutable_topLevel_eof() {
- ParserTestCase.parse2("parseCompilationUnitMember", <Object> [emptyCommentAndMetadata()], "x", [new AnalysisError.con2(null, 0, 1, ParserErrorCode.EXPECTED_EXECUTABLE)]);
+ ParserTestCase.parse2(
+ "parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "x",
+ [new AnalysisError.con2(null, 0, 1, ParserErrorCode.EXPECTED_EXECUTABLE)]);
}
void test_expectedInterpolationIdentifier() {
- ParserTestCase.parse4("parseStringLiteral", "'\$x\$'", [ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\$x\$'",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_expectedInterpolationIdentifier_emptyString() {
- // 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'", [new AnalysisError.con2(null, 2, 1, ParserErrorCode.MISSING_IDENTIFIER)]);
+ // 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'",
+ [new AnalysisError.con2(null, 2, 1, ParserErrorCode.MISSING_IDENTIFIER)]);
}
void test_expectedStringLiteral() {
- StringLiteral expression = ParserTestCase.parse4("parseStringLiteral", "1", [ParserErrorCode.EXPECTED_STRING_LITERAL]);
+ StringLiteral expression = ParserTestCase.parse4(
+ "parseStringLiteral",
+ "1",
+ [ParserErrorCode.EXPECTED_STRING_LITERAL]);
expect(expression.isSynthetic, isTrue);
}
void test_expectedToken_commaMissingInArgumentList() {
- ParserTestCase.parse4("parseArgumentList", "(x, y z)", [ParserErrorCode.EXPECTED_TOKEN]);
+ ParserTestCase.parse4(
+ "parseArgumentList",
+ "(x, y z)",
+ [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_expectedToken_parseStatement_afterVoid() {
- ParserTestCase.parseStatement("void}", [
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parseStatement(
+ "void}",
+ [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_expectedToken_semicolonAfterClass() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
- ParserTestCase.parse3("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C", [ParserErrorCode.EXPECTED_TOKEN]);
+ ParserTestCase.parse3(
+ "parseClassTypeAlias",
+ <Object>[emptyCommentAndMetadata(), null, token],
+ "A = B with C",
+ [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_expectedToken_semicolonMissingAfterExport() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("export '' class A {}", [ParserErrorCode.EXPECTED_TOKEN]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "export '' class A {}",
+ [ParserErrorCode.EXPECTED_TOKEN]);
ExportDirective directive = unit.directives[0] as ExportDirective;
Token semicolon = directive.semicolon;
expect(semicolon, isNotNull);
@@ -781,7 +1213,9 @@ class ErrorParserTest extends ParserTestCase {
}
void test_expectedToken_semicolonMissingAfterImport() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("import '' class A {}", [ParserErrorCode.EXPECTED_TOKEN]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "import '' class A {}",
+ [ParserErrorCode.EXPECTED_TOKEN]);
ImportDirective directive = unit.directives[0] as ImportDirective;
Token semicolon = directive.semicolon;
expect(semicolon, isNotNull);
@@ -789,291 +1223,486 @@ class ErrorParserTest extends ParserTestCase {
}
void test_expectedToken_whileMissingInDoStatement() {
- ParserTestCase.parseStatement("do {} (x);", [ParserErrorCode.EXPECTED_TOKEN]);
+ ParserTestCase.parseStatement(
+ "do {} (x);",
+ [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_expectedTypeName_is() {
- ParserTestCase.parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "static external int m();",
+ [ParserErrorCode.EXTERNAL_AFTER_STATIC]);
}
void test_externalClass() {
- ParserTestCase.parseCompilationUnit("external class C {}", [ParserErrorCode.EXTERNAL_CLASS]);
+ ParserTestCase.parseCompilationUnit(
+ "external class C {}",
+ [ParserErrorCode.EXTERNAL_CLASS]);
}
void test_externalConstructorWithBody_factory() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "external factory C() {}", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "external C.c() {}",
+ [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
}
void test_externalEnum() {
- ParserTestCase.parseCompilationUnit("external enum E {ONE}", [ParserErrorCode.EXTERNAL_ENUM]);
+ ParserTestCase.parseCompilationUnit(
+ "external enum E {ONE}",
+ [ParserErrorCode.EXTERNAL_ENUM]);
}
void test_externalField_const() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "external const A f;", [ParserErrorCode.EXTERNAL_FIELD]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "external set x(int value) {}",
+ [ParserErrorCode.EXTERNAL_SETTER_WITH_BODY]);
}
void test_externalTypedef() {
- ParserTestCase.parseCompilationUnit("external typedef F();", [ParserErrorCode.EXTERNAL_TYPEDEF]);
+ ParserTestCase.parseCompilationUnit(
+ "external typedef F();",
+ [ParserErrorCode.EXTERNAL_TYPEDEF]);
}
void test_factoryTopLevelDeclaration_class() {
- ParserTestCase.parseCompilationUnit("factory class C {}", [ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION]);
+ ParserTestCase.parseCompilationUnit(
+ "factory class C {}",
+ [ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION]);
}
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"],
+ <Object>["C"],
"factory C() : x = 3 {}",
[ParserErrorCode.FACTORY_WITH_INITIALIZERS]);
}
void test_factoryWithoutBody() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "factory C();", [ParserErrorCode.FACTORY_WITHOUT_BODY]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "factory C();",
+ [ParserErrorCode.FACTORY_WITHOUT_BODY]);
}
void test_fieldInitializerOutsideConstructor() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "void m(this.x);", [ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "final var x;",
+ [ParserErrorCode.FINAL_AND_VAR]);
}
void test_finalClass() {
- ParserTestCase.parseCompilationUnit("final class C {}", [ParserErrorCode.FINAL_CLASS]);
+ ParserTestCase.parseCompilationUnit(
+ "final class C {}",
+ [ParserErrorCode.FINAL_CLASS]);
}
void test_finalConstructor() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "final C() {}", [ParserErrorCode.FINAL_CONSTRUCTOR]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "final C() {}",
+ [ParserErrorCode.FINAL_CONSTRUCTOR]);
}
void test_finalEnum() {
- ParserTestCase.parseCompilationUnit("final enum E {ONE}", [ParserErrorCode.FINAL_ENUM]);
+ ParserTestCase.parseCompilationUnit(
+ "final enum E {ONE}",
+ [ParserErrorCode.FINAL_ENUM]);
}
void test_finalMethod() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "final int m() {}", [ParserErrorCode.FINAL_METHOD]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "final int m() {}",
+ [ParserErrorCode.FINAL_METHOD]);
}
void test_finalTypedef() {
- ParserTestCase.parseCompilationUnit("final typedef F();", [ParserErrorCode.FINAL_TYPEDEF]);
+ ParserTestCase.parseCompilationUnit(
+ "final typedef F();",
+ [ParserErrorCode.FINAL_TYPEDEF]);
}
void test_functionTypedParameter_const() {
- ParserTestCase.parseCompilationUnit("void f(const x()) {}", [ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR]);
+ ParserTestCase.parseCompilationUnit(
+ "void f(const x()) {}",
+ [ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR]);
}
void test_functionTypedParameter_final() {
- ParserTestCase.parseCompilationUnit("void f(final x()) {}", [ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR]);
+ ParserTestCase.parseCompilationUnit(
+ "void f(final x()) {}",
+ [ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR]);
}
void test_functionTypedParameter_var() {
- ParserTestCase.parseCompilationUnit("void f(var x()) {}", [ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR]);
+ ParserTestCase.parseCompilationUnit(
+ "void f(var x()) {}",
+ [ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR]);
}
void test_getterInFunction_block_noReturnType() {
- ParserTestCase.parseStatement("get x { return _x; }", [ParserErrorCode.GETTER_IN_FUNCTION]);
+ ParserTestCase.parseStatement(
+ "get x { return _x; }",
+ [ParserErrorCode.GETTER_IN_FUNCTION]);
}
void test_getterInFunction_block_returnType() {
- ParserTestCase.parseStatement("int get x { return _x; }", [ParserErrorCode.GETTER_IN_FUNCTION]);
+ ParserTestCase.parseStatement(
+ "int get x { return _x; }",
+ [ParserErrorCode.GETTER_IN_FUNCTION]);
}
void test_getterInFunction_expression_noReturnType() {
- ParserTestCase.parseStatement("get x => _x;", [ParserErrorCode.GETTER_IN_FUNCTION]);
+ ParserTestCase.parseStatement(
+ "get x => _x;",
+ [ParserErrorCode.GETTER_IN_FUNCTION]);
}
void test_getterInFunction_expression_returnType() {
- ParserTestCase.parseStatement("int get x => _x;", [ParserErrorCode.GETTER_IN_FUNCTION]);
+ ParserTestCase.parseStatement(
+ "int get x => _x;",
+ [ParserErrorCode.GETTER_IN_FUNCTION]);
}
void test_getterWithParameters() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "int get x() {}", [ParserErrorCode.GETTER_WITH_PARAMETERS]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "int get x() {}",
+ [ParserErrorCode.GETTER_WITH_PARAMETERS]);
}
void test_illegalAssignmentToNonAssignable_postfix_minusMinus_literal() {
- ParserTestCase.parseExpression("0--", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
+ ParserTestCase.parseExpression(
+ "0--",
+ [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
void test_illegalAssignmentToNonAssignable_postfix_plusPlus_literal() {
- ParserTestCase.parseExpression("0++", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
+ ParserTestCase.parseExpression(
+ "0++",
+ [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
void test_illegalAssignmentToNonAssignable_postfix_plusPlus_parethesized() {
- ParserTestCase.parseExpression("(x)++", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
+ ParserTestCase.parseExpression(
+ "(x)++",
+ [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
void test_illegalAssignmentToNonAssignable_primarySelectorPostfix() {
- ParserTestCase.parseExpression("x(y)(z)++", [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
+ ParserTestCase.parseExpression(
+ "x(y)(z)++",
+ [ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
}
void test_illegalAssignmentToNonAssignable_superAssigned() {
- // TODO(brianwilkerson) When the test fail_illegalAssignmentToNonAssignable_superAssigned starts
- // to pass, 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;", [
- ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR,
- ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
+ // TODO(brianwilkerson) When the test
+ // fail_illegalAssignmentToNonAssignable_superAssigned starts to pass,
+ // 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;",
+ [
+ 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]);
+ ParserTestCase.parseCompilationUnit(
+ "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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse4(
+ "parseForStatement",
+ "await for (; ;) {}",
+ [ParserErrorCode.INVALID_AWAIT_IN_FOR]);
}
void test_invalidCodePoint() {
- ParserTestCase.parse4("parseStringLiteral", "'\\uD900'", [ParserErrorCode.INVALID_CODE_POINT]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\\uD900'",
+ [ParserErrorCode.INVALID_CODE_POINT]);
}
void test_invalidHexEscape_invalidDigit() {
- ParserTestCase.parse4("parseStringLiteral", "'\\x0 a'", [ParserErrorCode.INVALID_HEX_ESCAPE]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\\x0 a'",
+ [ParserErrorCode.INVALID_HEX_ESCAPE]);
}
void test_invalidHexEscape_tooFewDigits() {
- ParserTestCase.parse4("parseStringLiteral", "'\\x0'", [ParserErrorCode.INVALID_HEX_ESCAPE]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\\x0'",
+ [ParserErrorCode.INVALID_HEX_ESCAPE]);
}
void test_invalidInterpolationIdentifier_startWithDigit() {
- ParserTestCase.parse4("parseStringLiteral", "'\$1'", [ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\$1'",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_invalidOperator() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "void operator ===(x) {}", [ParserErrorCode.INVALID_OPERATOR]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "void operator ===(x) {}",
+ [ParserErrorCode.INVALID_OPERATOR]);
}
void test_invalidOperatorForSuper() {
- ParserTestCase.parse4("parseUnaryExpression", "++super", [ParserErrorCode.INVALID_OPERATOR_FOR_SUPER]);
+ ParserTestCase.parse4(
+ "parseUnaryExpression",
+ "++super",
+ [ParserErrorCode.INVALID_OPERATOR_FOR_SUPER]);
}
void test_invalidStarAfterAsync() {
- ParserTestCase.parse3("parseFunctionBody", <Object> [false, null, false], "async* => 0;", [ParserErrorCode.INVALID_STAR_AFTER_ASYNC]);
+ ParserTestCase.parse3(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "async* => 0;",
+ [ParserErrorCode.INVALID_STAR_AFTER_ASYNC]);
}
void test_invalidSync() {
- ParserTestCase.parse3("parseFunctionBody", <Object> [false, null, false], "sync* => 0;", [ParserErrorCode.INVALID_SYNC]);
+ ParserTestCase.parse3(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "sync* => 0;",
+ [ParserErrorCode.INVALID_SYNC]);
}
void test_invalidUnicodeEscape_incomplete_noDigits() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u{'", [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\\u{'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_incomplete_someDigits() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u{0A'", [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\\u{0A'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_invalidDigit() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u0 a'", [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\\u0 a'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooFewDigits_fixed() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u04'", [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\\u04'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooFewDigits_variable() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u{}'", [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
+ ParserTestCase.parse4(
+ "parseStringLiteral",
+ "'\\u{}'",
+ [ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooManyDigits_variable() {
- ParserTestCase.parse4("parseStringLiteral", "'\\u{12345678}'", [
- ParserErrorCode.INVALID_UNICODE_ESCAPE,
- ParserErrorCode.INVALID_CODE_POINT]);
+ ParserTestCase.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]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "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() {
- ParserTestCase.parseStatement("static f() {}", [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
+ ParserTestCase.parseStatement(
+ "static f() {}",
+ [ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER]);
}
void test_missingAssignableSelector_identifiersAssigned() {
@@ -1081,11 +1710,15 @@ class ErrorParserTest extends ParserTestCase {
}
void test_missingAssignableSelector_prefix_minusMinus_literal() {
- ParserTestCase.parseExpression("--0", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ ParserTestCase.parseExpression(
+ "--0",
+ [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
}
void test_missingAssignableSelector_prefix_plusPlus_literal() {
- ParserTestCase.parseExpression("++0", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ ParserTestCase.parseExpression(
+ "++0",
+ [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
}
void test_missingAssignableSelector_selector() {
@@ -1093,7 +1726,10 @@ class ErrorParserTest extends ParserTestCase {
}
void test_missingAssignableSelector_superPrimaryExpression() {
- SuperExpression expression = ParserTestCase.parse4("parsePrimaryExpression", "super", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
+ SuperExpression expression = ParserTestCase.parse4(
+ "parsePrimaryExpression",
+ "super",
+ [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
expect(expression.keyword, isNotNull);
}
@@ -1102,129 +1738,217 @@ class ErrorParserTest extends ParserTestCase {
}
void test_missingCatchOrFinally() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {}", [ParserErrorCode.MISSING_CATCH_OR_FINALLY]);
+ TryStatement statement = ParserTestCase.parse4(
+ "parseTryStatement",
+ "try {}",
+ [ParserErrorCode.MISSING_CATCH_OR_FINALLY]);
expect(statement, isNotNull);
}
void test_missingClassBody() {
- ParserTestCase.parseCompilationUnit("class A class B {}", [ParserErrorCode.MISSING_CLASS_BODY]);
+ ParserTestCase.parseCompilationUnit(
+ "class A class B {}",
+ [ParserErrorCode.MISSING_CLASS_BODY]);
}
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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseEnumDeclaration",
+ <Object>[emptyCommentAndMetadata()],
+ "enum E;",
+ [ParserErrorCode.MISSING_ENUM_BODY]);
}
void test_missingExpressionInThrow_withCascade() {
- ParserTestCase.parse4("parseThrowExpression", "throw;", [ParserErrorCode.MISSING_EXPRESSION_IN_THROW]);
+ ParserTestCase.parse4(
+ "parseThrowExpression",
+ "throw;",
+ [ParserErrorCode.MISSING_EXPRESSION_IN_THROW]);
}
void test_missingExpressionInThrow_withoutCascade() {
- ParserTestCase.parse4("parseThrowExpressionWithoutCascade", "throw;", [ParserErrorCode.MISSING_EXPRESSION_IN_THROW]);
+ ParserTestCase.parse4(
+ "parseThrowExpressionWithoutCascade",
+ "throw;",
+ [ParserErrorCode.MISSING_EXPRESSION_IN_THROW]);
}
void test_missingFunctionBody_emptyNotAllowed() {
- ParserTestCase.parse3("parseFunctionBody", <Object> [false, ParserErrorCode.MISSING_FUNCTION_BODY, false], ";", [ParserErrorCode.MISSING_FUNCTION_BODY]);
+ ParserTestCase.parse3(
+ "parseFunctionBody",
+ <Object>[false, ParserErrorCode.MISSING_FUNCTION_BODY, false],
+ ";",
+ [ParserErrorCode.MISSING_FUNCTION_BODY]);
}
void test_missingFunctionBody_invalid() {
- ParserTestCase.parse3("parseFunctionBody", <Object> [false, ParserErrorCode.MISSING_FUNCTION_BODY, false], "return 0;", [ParserErrorCode.MISSING_FUNCTION_BODY]);
+ ParserTestCase.parse3(
+ "parseFunctionBody",
+ <Object>[false, ParserErrorCode.MISSING_FUNCTION_BODY, false],
+ "return 0;",
+ [ParserErrorCode.MISSING_FUNCTION_BODY]);
}
void test_missingFunctionParameters_local_void_block() {
- ParserTestCase.parseStatement("void f { return x;}", [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
+ ParserTestCase.parseStatement(
+ "void f { return x;}",
+ [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
}
void test_missingFunctionParameters_local_void_expression() {
- ParserTestCase.parseStatement("void f => x;", [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
+ ParserTestCase.parseStatement(
+ "void f => x;",
+ [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
}
void test_missingFunctionParameters_topLevel_nonVoid_block() {
- ParserTestCase.parseCompilationUnit("int f { return x;}", [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "int f { return x;}",
+ [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
}
void test_missingFunctionParameters_topLevel_nonVoid_expression() {
- ParserTestCase.parseCompilationUnit("int f => x;", [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "int f => x;",
+ [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
}
void test_missingFunctionParameters_topLevel_void_block() {
- ParserTestCase.parseCompilationUnit("void f { return x;}", [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "void f { return x;}",
+ [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
}
void test_missingFunctionParameters_topLevel_void_expression() {
- ParserTestCase.parseCompilationUnit("void f => x;", [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "void f => x;",
+ [ParserErrorCode.MISSING_FUNCTION_PARAMETERS]);
}
void test_missingIdentifier_afterOperator() {
- ParserTestCase.parse4("parseMultiplicativeExpression", "1 *", [ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parse4(
+ "parseMultiplicativeExpression",
+ "1 *",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_beforeClosingCurly() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "int}", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "int}",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN]);
}
void test_missingIdentifier_functionDeclaration_returnTypeWithoutName() {
- ParserTestCase.parse4("parseFunctionDeclarationStatement", "A<T> () {}", [ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parse4(
+ "parseFunctionDeclarationStatement",
+ "A<T> () {}",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_inEnum() {
- ParserTestCase.parse3("parseEnumDeclaration", <Object> [emptyCommentAndMetadata()], "enum E {, TWO}", [ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parse3(
+ "parseEnumDeclaration",
+ <Object>[emptyCommentAndMetadata()],
+ "enum E {, TWO}",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_inSymbol_afterPeriod() {
- ParserTestCase.parse4("parseSymbolLiteral", "#a.", [ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parse4(
+ "parseSymbolLiteral",
+ "#a.",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_inSymbol_first() {
- ParserTestCase.parse4("parseSymbolLiteral", "#", [ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parse4(
+ "parseSymbolLiteral",
+ "#",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_number() {
- SimpleIdentifier expression = ParserTestCase.parse4("parseSimpleIdentifier", "1", [ParserErrorCode.MISSING_IDENTIFIER]);
+ SimpleIdentifier expression = ParserTestCase.parse4(
+ "parseSimpleIdentifier",
+ "1",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
expect(expression.isSynthetic, isTrue);
}
void test_missingKeywordOperator() {
- ParserTestCase.parse3("parseOperator", <Object> [emptyCommentAndMetadata(), null, null], "+(x) {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
+ ParserTestCase.parse3(
+ "parseOperator",
+ <Object>[emptyCommentAndMetadata(), null, null],
+ "+(x) {}",
+ [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
}
void test_missingKeywordOperator_parseClassMember() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "+() {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "+() {}",
+ [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
}
void test_missingKeywordOperator_parseClassMember_afterTypeName() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "int +() {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "int +() {}",
+ [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
}
void test_missingKeywordOperator_parseClassMember_afterVoid() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "void +() {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "void +() {}",
+ [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
}
void test_missingNameInLibraryDirective() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("library;", [ParserErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "library;",
+ [ParserErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]);
expect(unit, isNotNull);
}
void test_missingNameInPartOfDirective() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of;", [ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "part of;",
+ [ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE]);
expect(unit, isNotNull);
}
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> [false, null, false], "sync {}", [ParserErrorCode.MISSING_STAR_AFTER_SYNC]);
+ ParserTestCase.parse3(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "sync {}",
+ [ParserErrorCode.MISSING_STAR_AFTER_SYNC]);
}
void test_missingStatement() {
@@ -1236,345 +1960,578 @@ class ErrorParserTest extends ParserTestCase {
}
void test_missingTerminatorForParameterGroup_named() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, {b: 0)", [ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
+ ParserTestCase.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]);
+ ParserTestCase.parse4(
+ "parseFormalParameterList",
+ "(a, [b = 0)",
+ [ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
}
void test_missingTypedefParameters_nonVoid() {
- ParserTestCase.parseCompilationUnit("typedef int F;", [ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "typedef int F;",
+ [ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
}
void test_missingTypedefParameters_typeParameters() {
- ParserTestCase.parseCompilationUnit("typedef F<E>;", [ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "typedef F<E>;",
+ [ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
}
void test_missingTypedefParameters_void() {
- ParserTestCase.parseCompilationUnit("typedef void F;", [ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "typedef void F;",
+ [ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
}
void test_missingVariableInForEach() {
- ParserTestCase.parse4("parseForStatement", "for (a < b in foo) {}", [ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH]);
+ ParserTestCase.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]);
+ ParserTestCase.parse4(
+ "parseFormalParameterList",
+ "(a, {b}, [c])",
+ [ParserErrorCode.MIXED_PARAMETER_GROUPS]);
}
void test_mixedParameterGroups_positionalNamed() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, [b], {c})", [ParserErrorCode.MIXED_PARAMETER_GROUPS]);
+ ParserTestCase.parse4(
+ "parseFormalParameterList",
+ "(a, [b], {c})",
+ [ParserErrorCode.MIXED_PARAMETER_GROUPS]);
}
void test_mixin_application_lacks_with_clause() {
- ParserTestCase.parseCompilationUnit("class Foo = Bar;", [ParserErrorCode.EXPECTED_TOKEN]);
+ ParserTestCase.parseCompilationUnit(
+ "class Foo = Bar;",
+ [ParserErrorCode.EXPECTED_TOKEN]);
}
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() {
- ParserTestCase.parseCompilationUnit("class A implements B implements C {}", [ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES]);
+ ParserTestCase.parseCompilationUnit(
+ "class A implements B implements C {}",
+ [ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES]);
}
void test_multipleLibraryDirectives() {
- ParserTestCase.parseCompilationUnit("library l; library m;", [ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES]);
+ ParserTestCase.parseCompilationUnit(
+ "library l; library m;",
+ [ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES]);
}
void test_multipleNamedParameterGroups() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, {b}, {c})", [ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS]);
+ ParserTestCase.parse4(
+ "parseFormalParameterList",
+ "(a, {b}, {c})",
+ [ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS]);
}
void test_multiplePartOfDirectives() {
- ParserTestCase.parseCompilationUnit("part of l; part of m;", [ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES]);
+ ParserTestCase.parseCompilationUnit(
+ "part of l; part of m;",
+ [ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES]);
}
void test_multiplePositionalParameterGroups() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, [b], [c])", [ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "factory int m() {}",
+ [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
}
void test_nonIdentifierLibraryName_library() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("library 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "library 'lib';",
+ [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
expect(unit, isNotNull);
}
void test_nonIdentifierLibraryName_partOf() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "part of 'lib';",
+ [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
expect(unit, isNotNull);
}
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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "operator +=(int x) => x + 1;",
+ [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]);
}
void test_optionalAfterNormalParameters_named() {
- ParserTestCase.parseCompilationUnit("f({a}, b) {}", [ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "f({a}, b) {}",
+ [ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS]);
}
void test_optionalAfterNormalParameters_positional() {
- ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS]);
+ ParserTestCase.parseCompilationUnit(
+ "f([a], b) {}",
+ [ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS]);
}
void test_parseCascadeSection_missingIdentifier() {
- MethodInvocation methodInvocation = ParserTestCase.parse4("parseCascadeSection", "..()", [ParserErrorCode.MISSING_IDENTIFIER]);
+ MethodInvocation methodInvocation = ParserTestCase.parse4(
+ "parseCascadeSection",
+ "..()",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
expect(methodInvocation.target, isNull);
expect(methodInvocation.methodName.name, "");
expect(methodInvocation.argumentList.arguments, hasLength(0));
}
void test_positionalAfterNamedArgument() {
- ParserTestCase.parse4("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT]);
+ ParserTestCase.parse4(
+ "parseArgumentList",
+ "(x: 1, 2)",
+ [ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT]);
}
void test_positionalParameterOutsideGroup() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, b = 0)", [ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "C() = D;",
+ [ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR]);
}
void test_setterInFunction_block() {
- ParserTestCase.parseStatement("set x(v) {_x = v;}", [ParserErrorCode.SETTER_IN_FUNCTION]);
+ ParserTestCase.parseStatement(
+ "set x(v) {_x = v;}",
+ [ParserErrorCode.SETTER_IN_FUNCTION]);
}
void test_setterInFunction_expression() {
- ParserTestCase.parseStatement("set x(v) => _x = v;", [ParserErrorCode.SETTER_IN_FUNCTION]);
+ ParserTestCase.parseStatement(
+ "set x(v) => _x = v;",
+ [ParserErrorCode.SETTER_IN_FUNCTION]);
}
void test_staticAfterConst() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "final static int f;", [ParserErrorCode.STATIC_AFTER_FINAL]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "static set m(x);",
+ [ParserErrorCode.STATIC_SETTER_WITHOUT_BODY]);
}
void test_staticTopLevelDeclaration_class() {
- ParserTestCase.parseCompilationUnit("static class C {}", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
+ ParserTestCase.parseCompilationUnit(
+ "static class C {}",
+ [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
}
void test_staticTopLevelDeclaration_function() {
- ParserTestCase.parseCompilationUnit("static f() {}", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
+ ParserTestCase.parseCompilationUnit(
+ "static f() {}",
+ [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
}
void test_staticTopLevelDeclaration_typedef() {
- ParserTestCase.parseCompilationUnit("static typedef F();", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
+ ParserTestCase.parseCompilationUnit(
+ "static typedef F();",
+ [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
}
void test_staticTopLevelDeclaration_variable() {
- ParserTestCase.parseCompilationUnit("static var x;", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
+ ParserTestCase.parseCompilationUnit(
+ "static var x;",
+ [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
}
void test_switchHasCaseAfterDefaultCase() {
- ParserTestCase.parse4("parseSwitchStatement", "switch (a) {default: return 0; case 1: return 1;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
+ ParserTestCase.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", "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]);
+ ParserTestCase.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]);
}
void test_switchHasMultipleDefaultCases() {
- ParserTestCase.parse4("parseSwitchStatement", "switch (a) {default: return 0; default: return 1;}", [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
+ ParserTestCase.parse4(
+ "parseSwitchStatement",
+ "switch (a) {default: return 0; default: return 1;}",
+ [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
}
void test_switchHasMultipleDefaultCases_repeated() {
- ParserTestCase.parse4("parseSwitchStatement", "switch (a) {default: return 0; default: return 1; default: return 2;}", [
- ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
- ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
+ ParserTestCase.parse4(
+ "parseSwitchStatement",
+ "switch (a) {default: return 0; default: return 1; default: return 2;}",
+ [
+ ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
+ ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
}
void test_topLevelOperator_withoutType() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object> [emptyCommentAndMetadata()], "operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_LEVEL_OPERATOR]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "void operator +(bool x, bool y) => x | y;",
+ [ParserErrorCode.TOP_LEVEL_OPERATOR]);
}
void test_unexpectedTerminatorForParameterGroup_named() {
- ParserTestCase.parse4("parseFormalParameterList", "(a, b})", [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
+ ParserTestCase.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]);
+ ParserTestCase.parse4(
+ "parseFormalParameterList",
+ "(a, b])",
+ [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
}
void test_unexpectedToken_semicolonBetweenClassMembers() {
- ParserTestCase.parse3("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]);
+ ParserTestCase.parse3(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class C { int x; ; int y;}",
+ [ParserErrorCode.UNEXPECTED_TOKEN]);
}
void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() {
- ParserTestCase.parseCompilationUnit("int x; ; int y;", [ParserErrorCode.UNEXPECTED_TOKEN]);
+ ParserTestCase.parseCompilationUnit(
+ "int x; ; int y;",
+ [ParserErrorCode.UNEXPECTED_TOKEN]);
}
void test_useOfUnaryPlusOperator() {
- SimpleIdentifier expression = ParserTestCase.parse4("parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression);
+ SimpleIdentifier expression = ParserTestCase.parse4(
+ "parseUnaryExpression",
+ "+x",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression);
expect(expression.isSynthetic, isTrue);
}
void test_varAndType_field() {
- ParserTestCase.parseCompilationUnit("class C { var int x; }", [ParserErrorCode.VAR_AND_TYPE]);
+ ParserTestCase.parseCompilationUnit(
+ "class C { var int x; }",
+ [ParserErrorCode.VAR_AND_TYPE]);
}
void test_varAndType_topLevelVariable() {
- ParserTestCase.parseCompilationUnit("var int x;", [ParserErrorCode.VAR_AND_TYPE]);
+ ParserTestCase.parseCompilationUnit(
+ "var int x;",
+ [ParserErrorCode.VAR_AND_TYPE]);
}
void test_varAsTypeName_as() {
- ParserTestCase.parseExpression("x as var", [ParserErrorCode.VAR_AS_TYPE_NAME]);
+ ParserTestCase.parseExpression(
+ "x as var",
+ [ParserErrorCode.VAR_AS_TYPE_NAME]);
}
void test_varClass() {
- ParserTestCase.parseCompilationUnit("var class C {}", [ParserErrorCode.VAR_CLASS]);
+ ParserTestCase.parseCompilationUnit(
+ "var class C {}",
+ [ParserErrorCode.VAR_CLASS]);
}
void test_varEnum() {
- ParserTestCase.parseCompilationUnit("var enum E {ONE}", [ParserErrorCode.VAR_ENUM]);
+ ParserTestCase.parseCompilationUnit(
+ "var enum E {ONE}",
+ [ParserErrorCode.VAR_ENUM]);
}
void test_varReturnType() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "var m() {}", [ParserErrorCode.VAR_RETURN_TYPE]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "var m() {}",
+ [ParserErrorCode.VAR_RETURN_TYPE]);
}
void test_varTypedef() {
- ParserTestCase.parseCompilationUnit("var typedef F();", [ParserErrorCode.VAR_TYPEDEF]);
+ ParserTestCase.parseCompilationUnit(
+ "var typedef F();",
+ [ParserErrorCode.VAR_TYPEDEF]);
}
void test_voidParameter() {
- ParserTestCase.parse4("parseNormalFormalParameter", "void a)", [ParserErrorCode.VOID_PARAMETER]);
+ ParserTestCase.parse4(
+ "parseNormalFormalParameter",
+ "void a)",
+ [ParserErrorCode.VOID_PARAMETER]);
}
void test_voidVariable_parseClassMember_initializer() {
- ParserTestCase.parse3("parseClassMember", <Object> ["C"], "void x = 0;", [ParserErrorCode.VOID_VARIABLE]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "void x;",
+ [ParserErrorCode.VOID_VARIABLE]);
}
void test_voidVariable_parseCompilationUnit_initializer() {
- ParserTestCase.parseCompilationUnit("void x = 0;", [ParserErrorCode.VOID_VARIABLE]);
+ ParserTestCase.parseCompilationUnit(
+ "void x = 0;",
+ [ParserErrorCode.VOID_VARIABLE]);
}
void test_voidVariable_parseCompilationUnit_noInitializer() {
- ParserTestCase.parseCompilationUnit("void x;", [ParserErrorCode.VOID_VARIABLE]);
+ ParserTestCase.parseCompilationUnit(
+ "void x;",
+ [ParserErrorCode.VOID_VARIABLE]);
}
void test_voidVariable_parseCompilationUnitMember_initializer() {
- ParserTestCase.parse3("parseCompilationUnitMember", <Object> [emptyCommentAndMetadata()], "void a = 0;", [ParserErrorCode.VOID_VARIABLE]);
+ ParserTestCase.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]);
+ ParserTestCase.parse3(
+ "parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "void a;",
+ [ParserErrorCode.VOID_VARIABLE]);
}
void test_voidVariable_statement_initializer() {
- ParserTestCase.parseStatement("void x = 0;", [
- ParserErrorCode.VOID_VARIABLE,
- ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
+ ParserTestCase.parseStatement(
+ "void x = 0;",
+ [
+ ParserErrorCode.VOID_VARIABLE,
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
}
void test_voidVariable_statement_noInitializer() {
- ParserTestCase.parseStatement("void x;", [
- ParserErrorCode.VOID_VARIABLE,
- ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
+ ParserTestCase.parseStatement(
+ "void x;",
+ [
+ ParserErrorCode.VOID_VARIABLE,
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
}
void test_withBeforeExtends() {
- ParserTestCase.parseCompilationUnit("class A with B extends C {}", [ParserErrorCode.WITH_BEFORE_EXTENDS]);
+ ParserTestCase.parseCompilationUnit(
+ "class A with B extends C {}",
+ [ParserErrorCode.WITH_BEFORE_EXTENDS]);
}
void test_withWithoutExtends() {
- ParserTestCase.parse3("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A with B, C {}", [ParserErrorCode.WITH_WITHOUT_EXTENDS]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.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]);
+ ParserTestCase.parse4(
+ "parseFormalParameterList",
+ "(a, [b, c})",
+ [ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]);
}
}
class IncrementalParserTest extends EngineTestCase {
void fail_replace_identifier_with_functionLiteral_in_initializer() {
- // Function literals aren't allowed inside initializers; incremental parsing needs to gather
- // the appropriate context.
+ // Function literals aren't allowed inside initializers; incremental parsing
+ // needs to gather the appropriate context.
//
// "class A { var a; A(b) : a = b ? b : 0 { } }"
// "class A { var a; A(b) : a = b ? () {} : 0 { } }"
- _assertParse("class A { var a; A(b) : a = b ? ", "b", "() {}", " : 0 { } }");
+ _assertParse(
+ "class A { var a; A(b) : a = b ? ",
+ "b",
+ "() {}",
+ " : 0 { } }");
}
void test_delete_everything() {
@@ -1676,7 +2633,11 @@ class IncrementalParserTest extends EngineTestCase {
void test_insert_newIdentifier4() {
// "/** An [A]. */ class A {} class B { m() { return 1; } }"
// "/** An [A]. */ class A {} class B { m() { return 1 + 2; } }"
- _assertParse("/** An [A]. */ class A {} class B { m() { return 1", "", " + 2", "; } }");
+ _assertParse(
+ "/** An [A]. */ class A {} class B { m() { return 1",
+ "",
+ " + 2",
+ "; } }");
}
void test_insert_period() {
@@ -1718,7 +2679,11 @@ class IncrementalParserTest extends EngineTestCase {
void test_insert_simpleToComplexExression() {
// "/** An [A]. */ class A {} class B { m() => 1; }"
// "/** An [A]. */ class A {} class B { m() => 1 + 2; }"
- _assertParse("/** An [A]. */ class A {} class B { m() => 1", "", " + 2", "; }");
+ _assertParse(
+ "/** An [A]. */ class A {} class B { m() => 1",
+ "",
+ " + 2",
+ "; }");
}
void test_insert_whitespace_end() {
@@ -1784,7 +2749,8 @@ class IncrementalParserTest extends EngineTestCase {
* @param added the text that was added to the modified contents
* @param suffix the unchanged text after the edit region
*/
- void _assertParse(String prefix, String removed, String added, String suffix) {
+ void _assertParse(String prefix, String removed, String added,
+ String suffix) {
//
// Compute the information needed to perform the test.
//
@@ -1796,35 +2762,58 @@ class IncrementalParserTest extends EngineTestCase {
// Parse the original contents.
//
GatheringErrorListener originalListener = new GatheringErrorListener();
- Scanner originalScanner = new Scanner(source, new CharSequenceReader(originalContents), originalListener);
+ Scanner originalScanner = new Scanner(
+ source,
+ new CharSequenceReader(originalContents),
+ originalListener);
Token originalTokens = originalScanner.tokenize();
expect(originalTokens, isNotNull);
Parser originalParser = new Parser(source, originalListener);
- CompilationUnit originalUnit = originalParser.parseCompilationUnit(originalTokens);
+ CompilationUnit originalUnit =
+ originalParser.parseCompilationUnit(originalTokens);
expect(originalUnit, isNotNull);
//
// Parse the modified contents.
//
GatheringErrorListener modifiedListener = new GatheringErrorListener();
- Scanner modifiedScanner = new Scanner(source, new CharSequenceReader(modifiedContents), modifiedListener);
+ Scanner modifiedScanner = new Scanner(
+ source,
+ new CharSequenceReader(modifiedContents),
+ modifiedListener);
Token modifiedTokens = modifiedScanner.tokenize();
expect(modifiedTokens, isNotNull);
Parser modifiedParser = new Parser(source, modifiedListener);
- CompilationUnit modifiedUnit = modifiedParser.parseCompilationUnit(modifiedTokens);
+ CompilationUnit modifiedUnit =
+ modifiedParser.parseCompilationUnit(modifiedTokens);
expect(modifiedUnit, isNotNull);
//
// Incrementally parse the modified contents.
//
GatheringErrorListener incrementalListener = new GatheringErrorListener();
- IncrementalScanner incrementalScanner = new IncrementalScanner(source, new CharSequenceReader(modifiedContents), incrementalListener);
- Token incrementalTokens = incrementalScanner.rescan(originalTokens, replaceStart, removed.length, added.length);
+ IncrementalScanner incrementalScanner = new IncrementalScanner(
+ source,
+ new CharSequenceReader(modifiedContents),
+ incrementalListener);
+ Token incrementalTokens = incrementalScanner.rescan(
+ originalTokens,
+ replaceStart,
+ removed.length,
+ added.length);
expect(incrementalTokens, isNotNull);
- IncrementalParser incrementalParser = new IncrementalParser(source, incrementalScanner.tokenMap, incrementalListener);
- CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, incrementalScanner.leftToken, incrementalScanner.rightToken, replaceStart, prefix.length + removed.length);
+ IncrementalParser incrementalParser = new IncrementalParser(
+ source,
+ incrementalScanner.tokenMap,
+ incrementalListener);
+ CompilationUnit incrementalUnit = incrementalParser.reparse(
+ originalUnit,
+ incrementalScanner.leftToken,
+ incrementalScanner.rightToken,
+ replaceStart,
+ prefix.length + removed.length);
expect(incrementalUnit, isNotNull);
//
- // Validate that the results of the incremental parse are the same as the full parse of the
- // modified source.
+ // Validate that the results of the incremental parse are the same as the
+ // full parse of the modified source.
//
expect(AstComparator.equalNodes(modifiedUnit, incrementalUnit), isTrue);
// TODO(brianwilkerson) Verify that the errors are correct?
@@ -1833,7 +2822,10 @@ class IncrementalParserTest extends EngineTestCase {
class NonErrorParserTest extends ParserTestCase {
void test_constFactory_external() {
- ParserTestCase.parse("parseClassMember", <Object> ["C"], "external const factory C();");
+ ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "external const factory C();");
}
}
@@ -1849,6 +2841,32 @@ class ParserTestCase extends EngineTestCase {
static bool parseFunctionBodies = true;
/**
+ * Return a CommentAndMetadata object with the given values that can be used for testing.
+ *
+ * @param comment the comment to be wrapped in the object
+ * @param annotations the annotations to be wrapped in the object
+ * @return a CommentAndMetadata object that can be used for testing
+ */
+ CommentAndMetadata commentAndMetadata(Comment comment,
+ [List<Annotation> annotations]) {
+ return new CommentAndMetadata(comment, annotations);
+ }
+
+ /**
+ * Return an empty CommentAndMetadata object that can be used for testing.
+ *
+ * @return an empty CommentAndMetadata object that can be used for testing
+ */
+ 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
@@ -1863,6 +2881,67 @@ class ParserTestCase extends EngineTestCase {
}
/**
+ * 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.
+ *
+ * The given source is scanned and the parser is initialized to start with the first token in the
+ * source before the method is invoked.
+ *
+ * @param methodName the name of the method that should be invoked
+ * @param objects the values of the arguments to the method
+ * @param source the source to be processed by the parse method
+ * @param listener the error listener that will be used for both scanning and parsing
+ * @return the result of invoking the method
+ * @throws Exception if the method could not be invoked or throws an exception
+ * @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,
+ String source, GatheringErrorListener listener) {
+ //
+ // Scan the source.
+ //
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
+ Token tokenStream = scanner.tokenize();
+ listener.setLineInfo(new TestSource(), scanner.lineStarts);
+ //
+ // Parse the source.
+ //
+ Parser parser = createParser(listener);
+ parser.parseFunctionBodies = parseFunctionBodies;
+ parser.parseDeferredLibraries = true;
+ parser.parseAsync = true;
+ Object result =
+ invokeParserMethodImpl(parser, methodName, objects, tokenStream);
+ //
+ // Partially test the results.
+ //
+ if (!listener.hasErrors) {
+ expect(result, isNotNull);
+ }
+ return result;
+ }
+
+ /**
+ * Invoke a method in [Parser]. The method is assumed to have no arguments.
+ *
+ * The given source is scanned and the parser is initialized to start with the first token in the
+ * source before the method is invoked.
+ *
+ * @param methodName the name of the method that should be invoked
+ * @param source the source to be processed by the parse method
+ * @param listener the error listener that will be used for both scanning and parsing
+ * @return the result of invoking the method
+ * @throws Exception if the method could not be invoked or throws an exception
+ * @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(String methodName, String source,
+ GatheringErrorListener listener) =>
+ invokeParserMethod(methodName, _EMPTY_ARGUMENTS, source, listener);
+
+ /**
* Invoke a parse method in [Parser]. The method is assumed to have the given number and
* type of parameters and will be invoked with the given arguments.
*
@@ -1876,8 +2955,8 @@ 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)
- => parse2(methodName, objects, source);
+ static Object parse(String methodName, List<Object> objects, String source) =>
+ parse2(methodName, objects, source);
/**
* Invoke a parse method in [Parser]. The method is assumed to have the given number and
@@ -1895,7 +2974,8 @@ 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, [List<AnalysisError> errors = AnalysisError.NO_ERRORS]) {
+ static 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);
listener.assertErrors(errors);
@@ -1918,7 +2998,8 @@ 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, [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
+ static 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);
listener.assertErrorsWithCodes(errorCodes);
@@ -1939,8 +3020,9 @@ 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, [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST])
- => parse3(methodName, _EMPTY_ARGUMENTS, source, errorCodes);
+ static 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.
@@ -1951,9 +3033,11 @@ class ParserTestCase extends EngineTestCase {
* @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, [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
+ static CompilationUnit parseCompilationUnit(String source,
+ [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
GatheringErrorListener listener = new GatheringErrorListener();
- Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener);
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
listener.setLineInfo(new TestSource(), scanner.lineStarts);
Token token = scanner.tokenize();
Parser parser = createParser(listener);
@@ -1972,9 +3056,11 @@ class ParserTestCase extends EngineTestCase {
* @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, [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
+ static Expression parseExpression(String source, [List<ErrorCode> errorCodes =
+ ErrorCode.EMPTY_LIST]) {
GatheringErrorListener listener = new GatheringErrorListener();
- Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener);
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
listener.setLineInfo(new TestSource(), scanner.lineStarts);
Token token = scanner.tokenize();
Parser parser = createParser(listener);
@@ -1993,9 +3079,11 @@ class ParserTestCase extends EngineTestCase {
* @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 Statement parseStatement(String source, [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
+ static Statement parseStatement(String source, [List<ErrorCode> errorCodes =
+ ErrorCode.EMPTY_LIST]) {
GatheringErrorListener listener = new GatheringErrorListener();
- Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener);
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
listener.setLineInfo(new TestSource(), scanner.lineStarts);
Token token = scanner.tokenize();
Parser parser = createParser(listener);
@@ -2016,9 +3104,11 @@ class ParserTestCase extends EngineTestCase {
* the expected count, if the compilation errors in the source do not match those that
* are expected, or if the result would have been `null`
*/
- static List<Statement> parseStatements(String source, int expectedCount, [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
+ static List<Statement> parseStatements(String source, int expectedCount,
+ [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
GatheringErrorListener listener = new GatheringErrorListener();
- Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener);
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
listener.setLineInfo(new TestSource(), scanner.lineStarts);
Token token = scanner.tokenize();
Parser parser = createParser(listener);
@@ -2027,86 +3117,6 @@ class ParserTestCase extends EngineTestCase {
listener.assertErrorsWithCodes(errorCodes);
return statements;
}
-
- /**
- * 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.
- *
- * The given source is scanned and the parser is initialized to start with the first token in the
- * source before the method is invoked.
- *
- * @param methodName the name of the method that should be invoked
- * @param objects the values of the arguments to the method
- * @param source the source to be processed by the parse method
- * @param listener the error listener that will be used for both scanning and parsing
- * @return the result of invoking the method
- * @throws Exception if the method could not be invoked or throws an exception
- * @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, String source, GatheringErrorListener listener) {
- //
- // Scan the source.
- //
- Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener);
- Token tokenStream = scanner.tokenize();
- listener.setLineInfo(new TestSource(), scanner.lineStarts);
- //
- // Parse the source.
- //
- Parser parser = createParser(listener);
- parser.parseFunctionBodies = parseFunctionBodies;
- parser.parseDeferredLibraries = true;
- parser.parseAsync = true;
- Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStream);
- //
- // Partially test the results.
- //
- if (!listener.hasErrors) {
- expect(result, isNotNull);
- }
- return result;
- }
-
- /**
- * Invoke a method in [Parser]. The method is assumed to have no arguments.
- *
- * The given source is scanned and the parser is initialized to start with the first token in the
- * source before the method is invoked.
- *
- * @param methodName the name of the method that should be invoked
- * @param source the source to be processed by the parse method
- * @param listener the error listener that will be used for both scanning and parsing
- * @return the result of invoking the method
- * @throws Exception if the method could not be invoked or throws an exception
- * @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(String methodName, String source, GatheringErrorListener listener) => invokeParserMethod(methodName, _EMPTY_ARGUMENTS, source, listener);
-
- /**
- * Return a CommentAndMetadata object with the given values that can be used for testing.
- *
- * @param comment the comment to be wrapped in the object
- * @param annotations the annotations to be wrapped in the object
- * @return a CommentAndMetadata object that can be used for testing
- */
- CommentAndMetadata commentAndMetadata(Comment comment, [List<Annotation> annotations]) {
- return new CommentAndMetadata(comment, annotations);
- }
-
- /**
- * Return an empty CommentAndMetadata object that can be used for testing.
- *
- * @return an empty CommentAndMetadata object that can be used for testing
- */
- CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, null);
-
- @override
- void setUp() {
- super.setUp();
- parseFunctionBodies = true;
- }
}
/**
@@ -2127,240 +3137,393 @@ Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
}
void test_additiveExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("+", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "+",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_additiveExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x +", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.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("* +", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "* +",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_additiveExpression_precedence_multiplicative_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("+ *", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "+ *",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_additiveExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super + +", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "super + +",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_assignmentExpression_missing_compound1() {
- AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
+ AssignmentExpression expression = ParserTestCase.parseExpression(
+ "= y = 0",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
Expression syntheticExpression = expression.leftHandSide;
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, syntheticExpression);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ syntheticExpression);
expect(syntheticExpression.isSynthetic, isTrue);
}
void test_assignmentExpression_missing_compound2() {
- AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
- Expression syntheticExpression = (expression.rightHandSide as AssignmentExpression).leftHandSide;
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, syntheticExpression);
+ AssignmentExpression expression = ParserTestCase.parseExpression(
+ "x = = 0",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
+ Expression syntheticExpression =
+ (expression.rightHandSide as AssignmentExpression).leftHandSide;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ syntheticExpression);
expect(syntheticExpression.isSynthetic, isTrue);
}
void test_assignmentExpression_missing_compound3() {
- AssignmentExpression expression = ParserTestCase.parseExpression("x = y =", [ParserErrorCode.MISSING_IDENTIFIER]);
- Expression syntheticExpression = (expression.rightHandSide as AssignmentExpression).rightHandSide;
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, syntheticExpression);
+ AssignmentExpression expression = ParserTestCase.parseExpression(
+ "x = y =",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
+ Expression syntheticExpression =
+ (expression.rightHandSide as AssignmentExpression).rightHandSide;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ syntheticExpression);
expect(syntheticExpression.isSynthetic, isTrue);
}
void test_assignmentExpression_missing_LHS() {
- AssignmentExpression expression = ParserTestCase.parseExpression("= 0", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftHandSide);
+ AssignmentExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftHandSide);
+ AssignmentExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("&", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "&",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseAndExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x &", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.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("== &&", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "== &&",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseAndExpression_precedence_equality_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("&& ==", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "&& ==",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_bitwiseAndExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super & &", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "super & &",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseOrExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("| y", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("|", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "|",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseOrExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x |", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.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("^ |", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "^ |",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseOrExpression_precedence_xor_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("| ^", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "| ^",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_bitwiseOrExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super | |", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "super | |",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseXorExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("^ y", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("^", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "^",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_bitwiseXorExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x ^", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.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("& ^", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "& ^",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_bitwiseXorExpression_precedence_and_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("^ &", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "^ &",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_bitwiseXorExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super ^ ^", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "super ^ ^",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_classTypeAlias_withBody() {
@@ -2370,116 +3533,185 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_conditionalExpression_missingElse() {
- ConditionalExpression expression = ParserTestCase.parse4("parseConditionalExpression", "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.elseExpression);
+ ConditionalExpression expression = ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.thenExpression);
+ ConditionalExpression expression = ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("==", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "==",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_equalityExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x ==", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.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 ==", [
- ParserErrorCode.EXPECTED_TYPE_NAME,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is IsExpression, IsExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "is ==",
+ [
+ ParserErrorCode.EXPECTED_TYPE_NAME,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IsExpression,
+ IsExpression,
+ expression.leftOperand);
}
void test_equalityExpression_precedence_relational_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("== is", [
- ParserErrorCode.EXPECTED_TYPE_NAME,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is IsExpression, IsExpression, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "== is",
+ [
+ ParserErrorCode.EXPECTED_TYPE_NAME,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is IsExpression,
+ IsExpression,
+ expression.rightOperand);
}
void test_equalityExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "super == ==",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_expressionList_multiple_end() {
- List<Expression> result = ParserTestCase.parse4("parseExpressionList", ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]);
+ List<Expression> result = ParserTestCase.parse4(
+ "parseExpressionList",
+ ", 2, 3, 4",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
expect(result, hasLength(4));
Expression syntheticExpression = result[0];
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, syntheticExpression);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ syntheticExpression);
expect(syntheticExpression.isSynthetic, isTrue);
}
void test_expressionList_multiple_middle() {
- List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2, , 4", [ParserErrorCode.MISSING_IDENTIFIER]);
+ List<Expression> result = ParserTestCase.parse4(
+ "parseExpressionList",
+ "1, 2, , 4",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
expect(result, hasLength(4));
Expression syntheticExpression = result[2];
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, syntheticExpression);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ syntheticExpression);
expect(syntheticExpression.isSynthetic, isTrue);
}
void test_expressionList_multiple_start() {
- List<Expression> result = ParserTestCase.parse4("parseExpressionList", "1, 2, 3,", [ParserErrorCode.MISSING_IDENTIFIER]);
+ List<Expression> result = ParserTestCase.parse4(
+ "parseExpressionList",
+ "1, 2, 3,",
+ [ParserErrorCode.MISSING_IDENTIFIER]);
expect(result, hasLength(4));
Expression syntheticExpression = result[3];
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, syntheticExpression);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ syntheticExpression);
expect(syntheticExpression.isSynthetic, isTrue);
}
void test_functionExpression_in_ConstructorFieldInitializer() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("class A { A() : a = (){}; var v; }", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.UNEXPECTED_TOKEN]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "class A { A() : a = (){}; var v; }",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.UNEXPECTED_TOKEN]);
// Make sure we recovered and parsed "var v" correctly
ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
NodeList<ClassMember> members = declaration.members;
ClassMember fieldDecl = members[1];
- EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDeclaration, fieldDecl);
- NodeList<VariableDeclaration> vars = (fieldDecl as FieldDeclaration).fields.variables;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FieldDeclaration,
+ FieldDeclaration,
+ fieldDecl);
+ NodeList<VariableDeclaration> vars =
+ (fieldDecl as FieldDeclaration).fields.variables;
expect(vars, hasLength(1));
expect(vars[0].name.name, "v");
}
void test_functionExpression_named() {
- ParserTestCase.parseExpression("m(f() => 0);", [
- ParserErrorCode.EXPECTED_TOKEN]);
+ ParserTestCase.parseExpression(
+ "m(f() => 0);",
+ [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_incomplete_conditionalExpression() {
- ParserTestCase.parseExpression("x ? 0", [
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parseExpression(
+ "x ? 0",
+ [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_incomplete_constructorInitializers_empty() {
@@ -2497,11 +3729,13 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
"C() : x(3) {}",
[ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER]);
expect(member, new isInstanceOf<ConstructorDeclaration>());
- NodeList<ConstructorInitializer> initializers = (member as ConstructorDeclaration).initializers;
+ NodeList<ConstructorInitializer> initializers =
+ (member as ConstructorDeclaration).initializers;
expect(initializers, hasLength(1));
ConstructorInitializer initializer = initializers[0];
expect(initializer, new isInstanceOf<ConstructorFieldInitializer>());
- Expression expression = (initializer as ConstructorFieldInitializer).expression;
+ Expression expression =
+ (initializer as ConstructorFieldInitializer).expression;
expect(expression, isNotNull);
expect(expression, new isInstanceOf<ParenthesizedExpression>());
}
@@ -2515,59 +3749,78 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_incomplete_topLevelFunction() {
- ParserTestCase.parseCompilationUnit("foo();", [
- ParserErrorCode.MISSING_FUNCTION_BODY]);
+ ParserTestCase.parseCompilationUnit(
+ "foo();",
+ [ParserErrorCode.MISSING_FUNCTION_BODY]);
}
void test_incomplete_topLevelVariable() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("String", [ParserErrorCode.EXPECTED_EXECUTABLE]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "String",
+ [ParserErrorCode.EXPECTED_EXECUTABLE]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember member = declarations[0];
- EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
- NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclaration).variables.variables;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is TopLevelVariableDeclaration,
+ TopLevelVariableDeclaration,
+ member);
+ NodeList<VariableDeclaration> variables =
+ (member as TopLevelVariableDeclaration).variables.variables;
expect(variables, hasLength(1));
SimpleIdentifier name = variables[0].name;
expect(name.isSynthetic, isTrue);
}
void test_incomplete_topLevelVariable_const() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("const ", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "const ",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember member = declarations[0];
- EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
- NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclaration).variables.variables;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is TopLevelVariableDeclaration,
+ TopLevelVariableDeclaration,
+ member);
+ NodeList<VariableDeclaration> variables =
+ (member as TopLevelVariableDeclaration).variables.variables;
expect(variables, hasLength(1));
SimpleIdentifier name = variables[0].name;
expect(name.isSynthetic, isTrue);
}
void test_incomplete_topLevelVariable_final() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("final ", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "final ",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember member = declarations[0];
- EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
- NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclaration).variables.variables;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is TopLevelVariableDeclaration,
+ TopLevelVariableDeclaration,
+ member);
+ NodeList<VariableDeclaration> variables =
+ (member as TopLevelVariableDeclaration).variables.variables;
expect(variables, hasLength(1));
SimpleIdentifier name = variables[0].name;
expect(name.isSynthetic, isTrue);
}
void test_incomplete_topLevelVariable_var() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("var ", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "var ",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember member = declarations[0];
- EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableDeclaration, TopLevelVariableDeclaration, member);
- NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclaration).variables.variables;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is TopLevelVariableDeclaration,
+ TopLevelVariableDeclaration,
+ member);
+ NodeList<VariableDeclaration> variables =
+ (member as TopLevelVariableDeclaration).variables.variables;
expect(variables, hasLength(1));
SimpleIdentifier name = variables[0].name;
expect(name.isSynthetic, isTrue);
@@ -2577,18 +3830,23 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]);
CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
class C {
const
-}''', [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN]);
+}''', [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember unitMember = declarations[0];
- EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDeclaration, unitMember);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ClassDeclaration,
+ ClassDeclaration,
+ unitMember);
NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
expect(members, hasLength(1));
ClassMember classMember = members[0];
- EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDeclaration, classMember);
- VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FieldDeclaration,
+ FieldDeclaration,
+ classMember);
+ VariableDeclarationList fieldList =
+ (classMember as FieldDeclaration).fields;
expect((fieldList.keyword as KeywordToken).keyword, Keyword.CONST);
NodeList<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
@@ -2600,18 +3858,23 @@ class C {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
class C {
final
-}''', [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN]);
+}''', [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember unitMember = declarations[0];
- EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDeclaration, unitMember);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ClassDeclaration,
+ ClassDeclaration,
+ unitMember);
NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
expect(members, hasLength(1));
ClassMember classMember = members[0];
- EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDeclaration, classMember);
- VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FieldDeclaration,
+ FieldDeclaration,
+ classMember);
+ VariableDeclarationList fieldList =
+ (classMember as FieldDeclaration).fields;
expect((fieldList.keyword as KeywordToken).keyword, Keyword.FINAL);
NodeList<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
@@ -2623,18 +3886,23 @@ class C {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
class C {
var
-}''', [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN]);
+}''', [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember unitMember = declarations[0];
- EngineTestCase.assertInstanceOf((obj) => obj is ClassDeclaration, ClassDeclaration, unitMember);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ClassDeclaration,
+ ClassDeclaration,
+ unitMember);
NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
expect(members, hasLength(1));
ClassMember classMember = members[0];
- EngineTestCase.assertInstanceOf((obj) => obj is FieldDeclaration, FieldDeclaration, classMember);
- VariableDeclarationList fieldList = (classMember as FieldDeclaration).fields;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FieldDeclaration,
+ FieldDeclaration,
+ classMember);
+ VariableDeclarationList fieldList =
+ (classMember as FieldDeclaration).fields;
expect((fieldList.keyword as KeywordToken).keyword, Keyword.VAR);
NodeList<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
@@ -2643,15 +3911,18 @@ class C {
}
void test_invalidFunctionBodyModifier() {
- ParserTestCase.parseCompilationUnit("f() sync {}", [
- ParserErrorCode.MISSING_STAR_AFTER_SYNC]);
+ ParserTestCase.parseCompilationUnit(
+ "f() sync {}",
+ [ParserErrorCode.MISSING_STAR_AFTER_SYNC]);
}
void test_isExpression_noType() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T extends Foo> {m(x){if (x is ) return;if (x is !)}}", [
- ParserErrorCode.EXPECTED_TYPE_NAME,
- ParserErrorCode.EXPECTED_TYPE_NAME,
- ParserErrorCode.MISSING_STATEMENT]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "class Bar<T extends Foo> {m(x){if (x is ) return;if (x is !)}}",
+ [
+ ParserErrorCode.EXPECTED_TYPE_NAME,
+ ParserErrorCode.EXPECTED_TYPE_NAME,
+ ParserErrorCode.MISSING_STATEMENT]);
ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
MethodDeclaration method = declaration.members[0] as MethodDeclaration;
BlockFunctionBody body = method.body as BlockFunctionBody;
@@ -2663,95 +3934,147 @@ class C {
TypeName type = expression.type;
expect(type, isNotNull);
expect(type.name.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is EmptyStatement, EmptyStatement, ifStatement.thenStatement);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is EmptyStatement,
+ EmptyStatement,
+ ifStatement.thenStatement);
}
void test_keywordInPlaceOfIdentifier() {
// TODO(brianwilkerson) We could do better with this.
- ParserTestCase.parseCompilationUnit("do() {}", [
- ParserErrorCode.EXPECTED_EXECUTABLE,
- ParserErrorCode.UNEXPECTED_TOKEN]);
+ ParserTestCase.parseCompilationUnit(
+ "do() {}",
+ [ParserErrorCode.EXPECTED_EXECUTABLE, ParserErrorCode.UNEXPECTED_TOKEN]);
}
void test_logicalAndExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("&& y", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("&&", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "&&",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_logicalAndExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x &&", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("| &&", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "| &&",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_logicalAndExpression_precedence_bitwiseOr_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("&& |", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "&& |",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_logicalOrExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("|| y", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("||", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "||",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_logicalOrExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x ||", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("&& ||", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "&& ||",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_logicalOrExpression_precedence_logicalAnd_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "|| &&",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_missing_commaInArgumentList() {
- ParserTestCase.parseExpression("f(x: 1 y: 2)", [
- ParserErrorCode.EXPECTED_TOKEN]);
+ ParserTestCase.parseExpression(
+ "f(x: 1 y: 2)",
+ [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_missingGet() {
@@ -2761,17 +4084,28 @@ class C {
void foo() {}
}''', [ParserErrorCode.MISSING_GET]);
expect(unit, isNotNull);
- ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration;
+ ClassDeclaration classDeclaration =
+ unit.declarations[0] as ClassDeclaration;
NodeList<ClassMember> members = classDeclaration.members;
expect(members, hasLength(2));
- EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDeclaration, members[0]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is MethodDeclaration,
+ MethodDeclaration,
+ members[0]);
ClassMember member = members[1];
- EngineTestCase.assertInstanceOf((obj) => obj is MethodDeclaration, MethodDeclaration, member);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is MethodDeclaration,
+ MethodDeclaration,
+ member);
expect((member as MethodDeclaration).name.name, "foo");
}
void test_missingIdentifier_afterAnnotation() {
- MethodDeclaration method = ParserTestCase.parse3("parseClassMember", <Object> ["C"], "@override }", [ParserErrorCode.EXPECTED_CLASS_MEMBER]);
+ MethodDeclaration method = ParserTestCase.parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "@override }",
+ [ParserErrorCode.EXPECTED_CLASS_MEMBER]);
expect(method.documentationComment, isNull);
NodeList<Annotation> metadata = method.metadata;
expect(metadata, hasLength(1));
@@ -2779,194 +4113,302 @@ class C {
}
void test_multiplicativeExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("*", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "*",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_multiplicativeExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x *", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression, PrefixExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is PrefixExpression, PrefixExpression, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.parseExpression("* -y", [ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is PrefixExpression,
+ PrefixExpression,
+ expression.rightOperand);
}
void test_multiplicativeExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "super == ==",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_prefixExpression_missing_operand_minus() {
- PrefixExpression expression = ParserTestCase.parseExpression("-", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.operand);
+ PrefixExpression expression =
+ ParserTestCase.parseExpression("-", [ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.operand);
expect(expression.operand.isSynthetic, isTrue);
expect(expression.operator.type, TokenType.MINUS);
}
void test_primaryExpression_argumentDefinitionTest() {
- Expression expression = ParserTestCase.parse4("parsePrimaryExpression", "?a", [ParserErrorCode.UNEXPECTED_TOKEN]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression);
+ Expression expression = ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.expression);
+ IsExpression expression =
+ ParserTestCase.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", [
- ParserErrorCode.EXPECTED_TYPE_NAME,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.expression);
+ IsExpression expression = ParserTestCase.parseExpression(
+ "is",
+ [ParserErrorCode.EXPECTED_TYPE_NAME, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.expression);
expect(expression.expression.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, expression.type);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is TypeName,
+ TypeName,
+ expression.type);
expect(expression.type.isSynthetic, isTrue);
}
void test_relationalExpression_missing_RHS() {
- IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]);
- EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, expression.type);
+ IsExpression expression =
+ ParserTestCase.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", [
- ParserErrorCode.EXPECTED_TYPE_NAME,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.expression);
+ IsExpression expression = ParserTestCase.parseExpression(
+ "<< is",
+ [
+ ParserErrorCode.EXPECTED_TYPE_NAME,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.expression);
}
void test_shiftExpression_missing_LHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("<< y", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.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("<<", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "<<",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.leftOperand);
expect(expression.leftOperand.isSynthetic, isTrue);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ expression.rightOperand);
expect(expression.rightOperand.isSynthetic, isTrue);
}
void test_shiftExpression_missing_RHS() {
- BinaryExpression expression = ParserTestCase.parseExpression("x <<", [ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.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("+ <<", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "+ <<",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_shiftExpression_precedence_unary_right() {
- BinaryExpression expression = ParserTestCase.parseExpression("<< +", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "<< +",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.rightOperand);
}
void test_shiftExpression_super() {
- BinaryExpression expression = ParserTestCase.parseExpression("super << <<", [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.MISSING_IDENTIFIER]);
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.leftOperand);
+ BinaryExpression expression = ParserTestCase.parseExpression(
+ "super << <<",
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.MISSING_IDENTIFIER]);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression.leftOperand);
}
void test_typedef_eof() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ "typedef n",
+ [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember member = declarations[0];
- EngineTestCase.assertInstanceOf((obj) => obj is FunctionTypeAlias, FunctionTypeAlias, member);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FunctionTypeAlias,
+ FunctionTypeAlias,
+ member);
}
void test_unaryPlus() {
- ParserTestCase.parseExpression("+2", [
- ParserErrorCode.MISSING_IDENTIFIER]);
+ ParserTestCase.parseExpression("+2", [ParserErrorCode.MISSING_IDENTIFIER]);
}
}
class ResolutionCopierTest extends EngineTestCase {
void test_visitAnnotation() {
String annotationName = "proxy";
- Annotation fromNode = AstFactory.annotation(AstFactory.identifier3(annotationName));
+ Annotation fromNode =
+ AstFactory.annotation(AstFactory.identifier3(annotationName));
Element element = ElementFactory.topLevelVariableElement2(annotationName);
fromNode.element = element;
- Annotation toNode = AstFactory.annotation(AstFactory.identifier3(annotationName));
+ Annotation toNode =
+ AstFactory.annotation(AstFactory.identifier3(annotationName));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitAsExpression() {
- AsExpression fromNode = AstFactory.asExpression(AstFactory.identifier3("x"), AstFactory.typeName4("A"));
+ AsExpression fromNode = AstFactory.asExpression(
+ AstFactory.identifier3("x"),
+ AstFactory.typeName4("A"));
DartType propagatedType = ElementFactory.classElement2("A").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("B").type;
fromNode.staticType = staticType;
- AsExpression toNode = AstFactory.asExpression(AstFactory.identifier3("x"), AstFactory.typeName4("A"));
+ AsExpression toNode = AstFactory.asExpression(
+ AstFactory.identifier3("x"),
+ AstFactory.typeName4("A"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitAssignmentExpression() {
- AssignmentExpression fromNode = AstFactory.assignmentExpression(AstFactory.identifier3("a"), TokenType.PLUS_EQ, AstFactory.identifier3("b"));
+ AssignmentExpression fromNode = AstFactory.assignmentExpression(
+ AstFactory.identifier3("a"),
+ TokenType.PLUS_EQ,
+ AstFactory.identifier3("b"));
DartType propagatedType = ElementFactory.classElement2("C").type;
- MethodElement propagatedElement = ElementFactory.methodElement("+", propagatedType);
+ MethodElement propagatedElement =
+ ElementFactory.methodElement("+", propagatedType);
fromNode.propagatedElement = propagatedElement;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
MethodElement staticElement = ElementFactory.methodElement("+", staticType);
fromNode.staticElement = staticElement;
fromNode.staticType = staticType;
- AssignmentExpression toNode = AstFactory.assignmentExpression(AstFactory.identifier3("a"), TokenType.PLUS_EQ, AstFactory.identifier3("b"));
+ AssignmentExpression toNode = AstFactory.assignmentExpression(
+ AstFactory.identifier3("a"),
+ TokenType.PLUS_EQ,
+ AstFactory.identifier3("b"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -2975,16 +4417,23 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitBinaryExpression() {
- BinaryExpression fromNode = AstFactory.binaryExpression(AstFactory.identifier3("a"), TokenType.PLUS, AstFactory.identifier3("b"));
+ BinaryExpression fromNode = AstFactory.binaryExpression(
+ AstFactory.identifier3("a"),
+ TokenType.PLUS,
+ AstFactory.identifier3("b"));
DartType propagatedType = ElementFactory.classElement2("C").type;
- MethodElement propagatedElement = ElementFactory.methodElement("+", propagatedType);
+ MethodElement propagatedElement =
+ ElementFactory.methodElement("+", propagatedType);
fromNode.propagatedElement = propagatedElement;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
MethodElement staticElement = ElementFactory.methodElement("+", staticType);
fromNode.staticElement = staticElement;
fromNode.staticType = staticType;
- BinaryExpression toNode = AstFactory.binaryExpression(AstFactory.identifier3("a"), TokenType.PLUS, AstFactory.identifier3("b"));
+ BinaryExpression toNode = AstFactory.binaryExpression(
+ AstFactory.identifier3("a"),
+ TokenType.PLUS,
+ AstFactory.identifier3("b"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -3005,12 +4454,16 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitCascadeExpression() {
- CascadeExpression fromNode = AstFactory.cascadeExpression(AstFactory.identifier3("a"), [AstFactory.identifier3("b")]);
+ CascadeExpression fromNode = AstFactory.cascadeExpression(
+ AstFactory.identifier3("a"),
+ [AstFactory.identifier3("b")]);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- CascadeExpression toNode = AstFactory.cascadeExpression(AstFactory.identifier3("a"), [AstFactory.identifier3("b")]);
+ CascadeExpression toNode = AstFactory.cascadeExpression(
+ AstFactory.identifier3("a"),
+ [AstFactory.identifier3("b")]);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -3018,7 +4471,8 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitCompilationUnit() {
CompilationUnit fromNode = AstFactory.compilationUnit();
- CompilationUnitElement element = new CompilationUnitElementImpl("test.dart");
+ CompilationUnitElement element =
+ new CompilationUnitElementImpl("test.dart");
fromNode.element = element;
CompilationUnit toNode = AstFactory.compilationUnit();
ResolutionCopier.copyResolutionData(fromNode, toNode);
@@ -3026,12 +4480,18 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitConditionalExpression() {
- ConditionalExpression fromNode = AstFactory.conditionalExpression(AstFactory.identifier3("c"), AstFactory.identifier3("a"), AstFactory.identifier3("b"));
+ ConditionalExpression fromNode = AstFactory.conditionalExpression(
+ AstFactory.identifier3("c"),
+ AstFactory.identifier3("a"),
+ AstFactory.identifier3("b"));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- ConditionalExpression toNode = AstFactory.conditionalExpression(AstFactory.identifier3("c"), AstFactory.identifier3("a"), AstFactory.identifier3("b"));
+ ConditionalExpression toNode = AstFactory.conditionalExpression(
+ AstFactory.identifier3("c"),
+ AstFactory.identifier3("a"),
+ AstFactory.identifier3("b"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -3040,19 +4500,32 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitConstructorDeclaration() {
String className = "A";
String constructorName = "c";
- ConstructorDeclaration fromNode = AstFactory.constructorDeclaration(AstFactory.identifier3(className), constructorName, AstFactory.formalParameterList(), null);
- ConstructorElement element = ElementFactory.constructorElement2(ElementFactory.classElement2(className), constructorName);
+ ConstructorDeclaration fromNode = AstFactory.constructorDeclaration(
+ AstFactory.identifier3(className),
+ constructorName,
+ AstFactory.formalParameterList(),
+ null);
+ ConstructorElement element = ElementFactory.constructorElement2(
+ ElementFactory.classElement2(className),
+ constructorName);
fromNode.element = element;
- ConstructorDeclaration toNode = AstFactory.constructorDeclaration(AstFactory.identifier3(className), constructorName, AstFactory.formalParameterList(), null);
+ ConstructorDeclaration toNode = AstFactory.constructorDeclaration(
+ AstFactory.identifier3(className),
+ constructorName,
+ AstFactory.formalParameterList(),
+ null);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitConstructorName() {
- ConstructorName fromNode = AstFactory.constructorName(AstFactory.typeName4("A"), "c");
- ConstructorElement staticElement = ElementFactory.constructorElement2(ElementFactory.classElement2("A"), "c");
+ ConstructorName fromNode =
+ AstFactory.constructorName(AstFactory.typeName4("A"), "c");
+ ConstructorElement staticElement =
+ ElementFactory.constructorElement2(ElementFactory.classElement2("A"), "c");
fromNode.staticElement = staticElement;
- ConstructorName toNode = AstFactory.constructorName(AstFactory.typeName4("A"), "c");
+ ConstructorName toNode =
+ AstFactory.constructorName(AstFactory.typeName4("A"), "c");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.staticElement, same(staticElement));
}
@@ -3079,14 +4552,19 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitFunctionExpression() {
- FunctionExpression fromNode = AstFactory.functionExpression2(AstFactory.formalParameterList(), AstFactory.emptyFunctionBody());
- MethodElement element = ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
+ FunctionExpression fromNode = AstFactory.functionExpression2(
+ AstFactory.formalParameterList(),
+ AstFactory.emptyFunctionBody());
+ MethodElement element =
+ ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
fromNode.element = element;
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- FunctionExpression toNode = AstFactory.functionExpression2(AstFactory.formalParameterList(), AstFactory.emptyFunctionBody());
+ FunctionExpression toNode = AstFactory.functionExpression2(
+ AstFactory.formalParameterList(),
+ AstFactory.emptyFunctionBody());
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
expect(toNode.propagatedType, same(propagatedType));
@@ -3094,16 +4572,20 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitFunctionExpressionInvocation() {
- FunctionExpressionInvocation fromNode = AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"));
- MethodElement propagatedElement = ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
+ FunctionExpressionInvocation fromNode =
+ AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"));
+ MethodElement propagatedElement =
+ ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
fromNode.propagatedElement = propagatedElement;
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
- MethodElement staticElement = ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
+ MethodElement staticElement =
+ ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
fromNode.staticElement = staticElement;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- FunctionExpressionInvocation toNode = AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"));
+ FunctionExpressionInvocation toNode =
+ AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -3121,10 +4603,14 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitIndexExpression() {
- IndexExpression fromNode = AstFactory.indexExpression(AstFactory.identifier3("a"), AstFactory.integer(0));
- MethodElement propagatedElement = ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
- MethodElement staticElement = ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
- AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, propagatedElement);
+ IndexExpression fromNode =
+ AstFactory.indexExpression(AstFactory.identifier3("a"), AstFactory.integer(0));
+ MethodElement propagatedElement =
+ ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
+ MethodElement staticElement =
+ ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
+ AuxiliaryElements auxiliaryElements =
+ new AuxiliaryElements(staticElement, propagatedElement);
fromNode.auxiliaryElements = auxiliaryElements;
fromNode.propagatedElement = propagatedElement;
DartType propagatedType = ElementFactory.classElement2("C").type;
@@ -3132,7 +4618,8 @@ class ResolutionCopierTest extends EngineTestCase {
fromNode.staticElement = staticElement;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- IndexExpression toNode = AstFactory.indexExpression(AstFactory.identifier3("a"), AstFactory.integer(0));
+ IndexExpression toNode =
+ AstFactory.indexExpression(AstFactory.identifier3("a"), AstFactory.integer(0));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.auxiliaryElements, same(auxiliaryElements));
expect(toNode.propagatedElement, same(propagatedElement));
@@ -3142,14 +4629,17 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitInstanceCreationExpression() {
- InstanceCreationExpression fromNode = AstFactory.instanceCreationExpression2(Keyword.NEW, AstFactory.typeName4("C"));
+ InstanceCreationExpression fromNode =
+ AstFactory.instanceCreationExpression2(Keyword.NEW, AstFactory.typeName4("C"));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
- ConstructorElement staticElement = ElementFactory.constructorElement2(ElementFactory.classElement2("C"), null);
+ ConstructorElement staticElement =
+ ElementFactory.constructorElement2(ElementFactory.classElement2("C"), null);
fromNode.staticElement = staticElement;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- InstanceCreationExpression toNode = AstFactory.instanceCreationExpression2(Keyword.NEW, AstFactory.typeName4("C"));
+ InstanceCreationExpression toNode =
+ AstFactory.instanceCreationExpression2(Keyword.NEW, AstFactory.typeName4("C"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticElement, same(staticElement));
@@ -3169,24 +4659,32 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitIsExpression() {
- IsExpression fromNode = AstFactory.isExpression(AstFactory.identifier3("x"), false, AstFactory.typeName4("A"));
+ IsExpression fromNode = AstFactory.isExpression(
+ AstFactory.identifier3("x"),
+ false,
+ AstFactory.typeName4("A"));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- IsExpression toNode = AstFactory.isExpression(AstFactory.identifier3("x"), false, AstFactory.typeName4("A"));
+ IsExpression toNode = AstFactory.isExpression(
+ AstFactory.identifier3("x"),
+ false,
+ AstFactory.typeName4("A"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitLibraryIdentifier() {
- LibraryIdentifier fromNode = AstFactory.libraryIdentifier([AstFactory.identifier3("lib")]);
+ LibraryIdentifier fromNode =
+ AstFactory.libraryIdentifier([AstFactory.identifier3("lib")]);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- LibraryIdentifier toNode = AstFactory.libraryIdentifier([AstFactory.identifier3("lib")]);
+ LibraryIdentifier toNode =
+ AstFactory.libraryIdentifier([AstFactory.identifier3("lib")]);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -3229,12 +4727,14 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitNamedExpression() {
- NamedExpression fromNode = AstFactory.namedExpression2("n", AstFactory.integer(0));
+ NamedExpression fromNode =
+ AstFactory.namedExpression2("n", AstFactory.integer(0));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- NamedExpression toNode = AstFactory.namedExpression2("n", AstFactory.integer(0));
+ NamedExpression toNode =
+ AstFactory.namedExpression2("n", AstFactory.integer(0));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -3253,12 +4753,14 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitParenthesizedExpression() {
- ParenthesizedExpression fromNode = AstFactory.parenthesizedExpression(AstFactory.integer(0));
+ ParenthesizedExpression fromNode =
+ AstFactory.parenthesizedExpression(AstFactory.integer(0));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- ParenthesizedExpression toNode = AstFactory.parenthesizedExpression(AstFactory.integer(0));
+ ParenthesizedExpression toNode =
+ AstFactory.parenthesizedExpression(AstFactory.integer(0));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -3266,7 +4768,8 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitPartDirective() {
PartDirective fromNode = AstFactory.partDirective2("part.dart");
- LibraryElement element = new LibraryElementImpl.forNode(null, AstFactory.libraryIdentifier2(["lib"]));
+ LibraryElement element =
+ new LibraryElementImpl.forNode(null, AstFactory.libraryIdentifier2(["lib"]));
fromNode.element = element;
PartDirective toNode = AstFactory.partDirective2("part.dart");
ResolutionCopier.copyResolutionData(fromNode, toNode);
@@ -3274,26 +4777,35 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitPartOfDirective() {
- PartOfDirective fromNode = AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["lib"]));
- LibraryElement element = new LibraryElementImpl.forNode(null, AstFactory.libraryIdentifier2(["lib"]));
+ PartOfDirective fromNode =
+ AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["lib"]));
+ LibraryElement element =
+ new LibraryElementImpl.forNode(null, AstFactory.libraryIdentifier2(["lib"]));
fromNode.element = element;
- PartOfDirective toNode = AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["lib"]));
+ PartOfDirective toNode =
+ AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["lib"]));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitPostfixExpression() {
String variableName = "x";
- PostfixExpression fromNode = AstFactory.postfixExpression(AstFactory.identifier3(variableName), TokenType.PLUS_PLUS);
- MethodElement propagatedElement = ElementFactory.methodElement("+", ElementFactory.classElement2("C").type);
+ PostfixExpression fromNode = AstFactory.postfixExpression(
+ AstFactory.identifier3(variableName),
+ TokenType.PLUS_PLUS);
+ MethodElement propagatedElement =
+ ElementFactory.methodElement("+", ElementFactory.classElement2("C").type);
fromNode.propagatedElement = propagatedElement;
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
- MethodElement staticElement = ElementFactory.methodElement("+", ElementFactory.classElement2("C").type);
+ MethodElement staticElement =
+ ElementFactory.methodElement("+", ElementFactory.classElement2("C").type);
fromNode.staticElement = staticElement;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- PostfixExpression toNode = AstFactory.postfixExpression(AstFactory.identifier3(variableName), TokenType.PLUS_PLUS);
+ PostfixExpression toNode = AstFactory.postfixExpression(
+ AstFactory.identifier3(variableName),
+ TokenType.PLUS_PLUS);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -3314,16 +4826,20 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitPrefixExpression() {
- PrefixExpression fromNode = AstFactory.prefixExpression(TokenType.PLUS_PLUS, AstFactory.identifier3("x"));
- MethodElement propagatedElement = ElementFactory.methodElement("+", ElementFactory.classElement2("C").type);
+ PrefixExpression fromNode =
+ AstFactory.prefixExpression(TokenType.PLUS_PLUS, AstFactory.identifier3("x"));
+ MethodElement propagatedElement =
+ ElementFactory.methodElement("+", ElementFactory.classElement2("C").type);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedElement = propagatedElement;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
- MethodElement staticElement = ElementFactory.methodElement("+", ElementFactory.classElement2("C").type);
+ MethodElement staticElement =
+ ElementFactory.methodElement("+", ElementFactory.classElement2("C").type);
fromNode.staticElement = staticElement;
fromNode.staticType = staticType;
- PrefixExpression toNode = AstFactory.prefixExpression(TokenType.PLUS_PLUS, AstFactory.identifier3("x"));
+ PrefixExpression toNode =
+ AstFactory.prefixExpression(TokenType.PLUS_PLUS, AstFactory.identifier3("x"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -3332,22 +4848,27 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitPropertyAccess() {
- PropertyAccess fromNode = AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y");
+ PropertyAccess fromNode =
+ AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y");
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- PropertyAccess toNode = AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y");
+ PropertyAccess toNode =
+ AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitRedirectingConstructorInvocation() {
- RedirectingConstructorInvocation fromNode = AstFactory.redirectingConstructorInvocation();
- ConstructorElement staticElement = ElementFactory.constructorElement2(ElementFactory.classElement2("C"), null);
+ RedirectingConstructorInvocation fromNode =
+ AstFactory.redirectingConstructorInvocation();
+ ConstructorElement staticElement =
+ ElementFactory.constructorElement2(ElementFactory.classElement2("C"), null);
fromNode.staticElement = staticElement;
- RedirectingConstructorInvocation toNode = AstFactory.redirectingConstructorInvocation();
+ RedirectingConstructorInvocation toNode =
+ AstFactory.redirectingConstructorInvocation();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.staticElement, same(staticElement));
}
@@ -3366,9 +4887,12 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitSimpleIdentifier() {
SimpleIdentifier fromNode = AstFactory.identifier3("x");
- MethodElement propagatedElement = ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
- MethodElement staticElement = ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
- AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, propagatedElement);
+ MethodElement propagatedElement =
+ ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
+ MethodElement staticElement =
+ ElementFactory.methodElement("m", ElementFactory.classElement2("C").type);
+ AuxiliaryElements auxiliaryElements =
+ new AuxiliaryElements(staticElement, propagatedElement);
fromNode.auxiliaryElements = auxiliaryElements;
fromNode.propagatedElement = propagatedElement;
DartType propagatedType = ElementFactory.classElement2("C").type;
@@ -3398,20 +4922,24 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitStringInterpolation() {
- StringInterpolation fromNode = AstFactory.string([AstFactory.interpolationString("a", "'a'")]);
+ StringInterpolation fromNode =
+ AstFactory.string([AstFactory.interpolationString("a", "'a'")]);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- StringInterpolation toNode = AstFactory.string([AstFactory.interpolationString("a", "'a'")]);
+ StringInterpolation toNode =
+ AstFactory.string([AstFactory.interpolationString("a", "'a'")]);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitSuperConstructorInvocation() {
- SuperConstructorInvocation fromNode = AstFactory.superConstructorInvocation();
- ConstructorElement staticElement = ElementFactory.constructorElement2(ElementFactory.classElement2("C"), null);
+ SuperConstructorInvocation fromNode =
+ AstFactory.superConstructorInvocation();
+ ConstructorElement staticElement =
+ ElementFactory.constructorElement2(ElementFactory.classElement2("C"), null);
fromNode.staticElement = staticElement;
SuperConstructorInvocation toNode = AstFactory.superConstructorInvocation();
ResolutionCopier.copyResolutionData(fromNode, toNode);
@@ -3485,10 +5013,14 @@ class ResolutionCopierTest extends EngineTestCase {
*/
class SimpleParserTest extends ParserTestCase {
void fail_parseCommentReference_this() {
- // 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], "");
- SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, reference.identifier);
+ // 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], "");
+ SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ reference.identifier);
expect(identifier.token, isNotNull);
expect(identifier.name, "a");
expect(identifier.offset, 5);
@@ -3575,7 +5107,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_constFactory() {
- ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;");
+ ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "const factory C() = A;");
}
void test_createSyntheticIdentifier() {
@@ -3592,27 +5127,34 @@ class SimpleParserTest extends ParserTestCase {
ParserTestCase.parseCompilationUnit("var x = () {};");
}
- void test_function_literal_allowed_in_ArgumentList_in_ConstructorFieldInitializer() {
+ void
+ test_function_literal_allowed_in_ArgumentList_in_ConstructorFieldInitializer() {
ParserTestCase.parseCompilationUnit("class C { C() : a = f(() {}); }");
}
- void test_function_literal_allowed_in_IndexExpression_in_ConstructorFieldInitializer() {
+ void
+ test_function_literal_allowed_in_IndexExpression_in_ConstructorFieldInitializer() {
ParserTestCase.parseCompilationUnit("class C { C() : a = x[() {}]; }");
}
- void test_function_literal_allowed_in_ListLiteral_in_ConstructorFieldInitializer() {
+ void
+ test_function_literal_allowed_in_ListLiteral_in_ConstructorFieldInitializer() {
ParserTestCase.parseCompilationUnit("class C { C() : a = [() {}]; }");
}
- void test_function_literal_allowed_in_MapLiteral_in_ConstructorFieldInitializer() {
- ParserTestCase.parseCompilationUnit("class C { C() : a = {'key': () {}}; }");
+ void
+ test_function_literal_allowed_in_MapLiteral_in_ConstructorFieldInitializer() {
+ ParserTestCase.parseCompilationUnit(
+ "class C { C() : a = {'key': () {}}; }");
}
- void test_function_literal_allowed_in_ParenthesizedExpression_in_ConstructorFieldInitializer() {
+ void
+ test_function_literal_allowed_in_ParenthesizedExpression_in_ConstructorFieldInitializer() {
ParserTestCase.parseCompilationUnit("class C { C() : a = (() {}); }");
}
- void test_function_literal_allowed_in_StringInterpolation_in_ConstructorFieldInitializer() {
+ void
+ test_function_literal_allowed_in_StringInterpolation_in_ConstructorFieldInitializer() {
ParserTestCase.parseCompilationUnit("class C { C() : a = \"\${(){}}\"; }");
}
@@ -3698,7 +5240,9 @@ class SimpleParserTest extends ParserTestCase {
}
void test_isInitializedVariableDeclaration_conditional() {
- expect(_isInitializedVariableDeclaration("a == null ? init() : update();"), isFalse);
+ expect(
+ _isInitializedVariableDeclaration("a == null ? init() : update();"),
+ isFalse);
}
void test_isInitializedVariableDeclaration_const_noType_initialized() {
@@ -3778,7 +5322,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAdditiveExpression_normal() {
- BinaryExpression expression = ParserTestCase.parse4("parseAdditiveExpression", "x + y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseAdditiveExpression", "x + y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS);
@@ -3786,8 +5331,12 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAdditiveExpression_super() {
- BinaryExpression expression = ParserTestCase.parse4("parseAdditiveExpression", "super + y");
- EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseAdditiveExpression", "super + y");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SuperExpression,
+ SuperExpression,
+ expression.leftOperand);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS);
expect(expression.rightOperand, isNotNull);
@@ -3821,7 +5370,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAnnotation_n2_a() {
- Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B(x,y)");
+ Annotation annotation =
+ ParserTestCase.parse4("parseAnnotation", "@A.B(x,y)");
expect(annotation.atSign, isNotNull);
expect(annotation.name, isNotNull);
expect(annotation.period, isNull);
@@ -3839,7 +5389,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAnnotation_n3_a() {
- Annotation annotation = ParserTestCase.parse4("parseAnnotation", "@A.B.C(x,y)");
+ Annotation annotation =
+ ParserTestCase.parse4("parseAnnotation", "@A.B.C(x,y)");
expect(annotation.atSign, isNotNull);
expect(annotation.name, isNotNull);
expect(annotation.period, isNotNull);
@@ -3858,36 +5409,42 @@ class SimpleParserTest extends ParserTestCase {
void test_parseArgument_unnamed() {
String lexeme = "x";
- SimpleIdentifier identifier = ParserTestCase.parse4("parseArgument", lexeme);
+ SimpleIdentifier identifier =
+ ParserTestCase.parse4("parseArgument", lexeme);
expect(identifier.name, lexeme);
}
void test_parseArgumentList_empty() {
- ArgumentList argumentList = ParserTestCase.parse4("parseArgumentList", "()");
+ ArgumentList argumentList =
+ ParserTestCase.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)");
+ ArgumentList argumentList =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseAssertStatement", "assert (x);");
expect(statement.keyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -3896,8 +5453,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_expression_args_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "(x)(y).z");
- FunctionExpressionInvocation invocation = propertyAccess.target as FunctionExpressionInvocation;
+ PropertyAccess propertyAccess =
+ ParserTestCase.parse("parseAssignableExpression", <Object>[false], "(x)(y).z");
+ FunctionExpressionInvocation invocation =
+ propertyAccess.target as FunctionExpressionInvocation;
expect(invocation.function, isNotNull);
ArgumentList argumentList = invocation.argumentList;
expect(argumentList, isNotNull);
@@ -3907,14 +5466,16 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_expression_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "(x).y");
+ PropertyAccess propertyAccess =
+ ParserTestCase.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 =
+ ParserTestCase.parse("parseAssignableExpression", <Object>[false], "(x)[y]");
expect(expression.target, isNotNull);
expect(expression.leftBracket, isNotNull);
expect(expression.index, isNotNull);
@@ -3922,12 +5483,14 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_identifier() {
- SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "x");
+ SimpleIdentifier identifier =
+ ParserTestCase.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 =
+ ParserTestCase.parse("parseAssignableExpression", <Object>[false], "x(y).z");
MethodInvocation invocation = propertyAccess.target as MethodInvocation;
expect(invocation.methodName.name, "x");
ArgumentList argumentList = invocation.argumentList;
@@ -3938,14 +5501,16 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_identifier_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "x.y");
+ PropertyAccess propertyAccess =
+ ParserTestCase.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 =
+ ParserTestCase.parse("parseAssignableExpression", <Object>[false], "x[y]");
expect(expression.target, isNotNull);
expect(expression.leftBracket, isNotNull);
expect(expression.index, isNotNull);
@@ -3953,78 +5518,130 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseAssignableExpression_super_dot() {
- PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "super.y");
- EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpression, propertyAccess.target);
+ PropertyAccess propertyAccess =
+ ParserTestCase.parse("parseAssignableExpression", <Object>[false], "super.y");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SuperExpression,
+ SuperExpression,
+ propertyAccess.target);
expect(propertyAccess.operator, isNotNull);
expect(propertyAccess.propertyName, isNotNull);
}
void test_parseAssignableExpression_super_index() {
- IndexExpression expression = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "super[y]");
- EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpression, expression.target);
+ IndexExpression expression =
+ ParserTestCase.parse("parseAssignableExpression", <Object>[false], "super[y]");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SuperExpression,
+ SuperExpression,
+ expression.target);
expect(expression.leftBracket, isNotNull);
expect(expression.index, isNotNull);
expect(expression.rightBracket, isNotNull);
}
void test_parseAssignableSelector_dot() {
- PropertyAccess selector = ParserTestCase.parse("parseAssignableSelector", <Object> [null, true], ".x");
+ PropertyAccess selector =
+ ParserTestCase.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 =
+ ParserTestCase.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 = ParserTestCase.parse(
+ "parseAssignableSelector",
+ <Object>[new SimpleIdentifier(null), true],
+ ";");
expect(selector, isNotNull);
}
void test_parseAwaitExpression() {
- AwaitExpression expression = ParserTestCase.parse4("parseAwaitExpression", "await x;");
+ AwaitExpression expression =
+ ParserTestCase.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 = ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "m() async { await x; }");
FunctionBody body = method.body;
- EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunctionBody, body);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BlockFunctionBody,
+ BlockFunctionBody,
+ body);
Statement statement = (body as BlockFunctionBody).block.statements[0];
- EngineTestCase.assertInstanceOf((obj) => obj is ExpressionStatement, ExpressionStatement, statement);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ExpressionStatement,
+ ExpressionStatement,
+ statement);
Expression expression = (statement as ExpressionStatement).expression;
- EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpression, expression);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is AwaitExpression,
+ AwaitExpression,
+ expression);
expect((expression as AwaitExpression).awaitKeyword, isNotNull);
expect((expression as AwaitExpression).expression, isNotNull);
}
void test_parseAwaitExpression_asStatement_inSync() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "m() { await x; }");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "m() { await x; }");
FunctionBody body = method.body;
- EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunctionBody, body);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BlockFunctionBody,
+ BlockFunctionBody,
+ body);
Statement statement = (body as BlockFunctionBody).block.statements[0];
- EngineTestCase.assertInstanceOf((obj) => obj is VariableDeclarationStatement, VariableDeclarationStatement, statement);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is VariableDeclarationStatement,
+ VariableDeclarationStatement,
+ statement);
}
void test_parseAwaitExpression_inSync() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "m() { return await x + await y; }");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "m() { return await x + await y; }");
FunctionBody body = method.body;
- EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunctionBody, body);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BlockFunctionBody,
+ BlockFunctionBody,
+ body);
Statement statement = (body as BlockFunctionBody).block.statements[0];
- EngineTestCase.assertInstanceOf((obj) => obj is ReturnStatement, ReturnStatement, statement);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ReturnStatement,
+ ReturnStatement,
+ statement);
Expression expression = (statement as ReturnStatement).expression;
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression);
- EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpression, (expression as BinaryExpression).leftOperand);
- EngineTestCase.assertInstanceOf((obj) => obj is AwaitExpression, AwaitExpression, (expression as BinaryExpression).rightOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BinaryExpression,
+ BinaryExpression,
+ expression);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is AwaitExpression,
+ AwaitExpression,
+ (expression as BinaryExpression).leftOperand);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is AwaitExpression,
+ AwaitExpression,
+ (expression as BinaryExpression).rightOperand);
}
void test_parseBitwiseAndExpression_normal() {
- BinaryExpression expression = ParserTestCase.parse4("parseBitwiseAndExpression", "x & y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseBitwiseAndExpression", "x & y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.AMPERSAND);
@@ -4032,15 +5649,20 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseBitwiseAndExpression_super() {
- BinaryExpression expression = ParserTestCase.parse4("parseBitwiseAndExpression", "super & y");
- EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseBitwiseAndExpression", "super & y");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SuperExpression,
+ SuperExpression,
+ expression.leftOperand);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.AMPERSAND);
expect(expression.rightOperand, isNotNull);
}
void test_parseBitwiseOrExpression_normal() {
- BinaryExpression expression = ParserTestCase.parse4("parseBitwiseOrExpression", "x | y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseBitwiseOrExpression", "x | y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.BAR);
@@ -4048,15 +5670,20 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseBitwiseOrExpression_super() {
- BinaryExpression expression = ParserTestCase.parse4("parseBitwiseOrExpression", "super | y");
- EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseBitwiseOrExpression", "super | y");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SuperExpression,
+ SuperExpression,
+ expression.leftOperand);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.BAR);
expect(expression.rightOperand, isNotNull);
}
void test_parseBitwiseXorExpression_normal() {
- BinaryExpression expression = ParserTestCase.parse4("parseBitwiseXorExpression", "x ^ y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseBitwiseXorExpression", "x ^ y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.CARET);
@@ -4064,8 +5691,12 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseBitwiseXorExpression_super() {
- BinaryExpression expression = ParserTestCase.parse4("parseBitwiseXorExpression", "super ^ y");
- EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseBitwiseXorExpression", "super ^ y");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SuperExpression,
+ SuperExpression,
+ expression.leftOperand);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.CARET);
expect(expression.rightOperand, isNotNull);
@@ -4086,21 +5717,26 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseBreakStatement_label() {
- BreakStatement statement = ParserTestCase.parse4("parseBreakStatement", "break foo;");
+ BreakStatement statement =
+ ParserTestCase.parse4("parseBreakStatement", "break foo;");
expect(statement.keyword, 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 = ParserTestCase.parse4(
+ "parseBreakStatement",
+ "break;",
+ [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
expect(statement.keyword, isNotNull);
expect(statement.label, isNull);
expect(statement.semicolon, isNotNull);
}
void test_parseCascadeSection_i() {
- IndexExpression section = ParserTestCase.parse4("parseCascadeSection", "..[i]");
+ IndexExpression section =
+ ParserTestCase.parse4("parseCascadeSection", "..[i]");
expect(section.target, isNull);
expect(section.leftBracket, isNotNull);
expect(section.index, isNotNull);
@@ -4108,14 +5744,22 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCascadeSection_ia() {
- FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSection", "..[i](b)");
- EngineTestCase.assertInstanceOf((obj) => obj is IndexExpression, IndexExpression, section.function);
+ FunctionExpressionInvocation section =
+ ParserTestCase.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)");
- EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, section.target);
+ MethodInvocation section =
+ ParserTestCase.parse4("parseCascadeSection", "..a(b).c(d)");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is MethodInvocation,
+ MethodInvocation,
+ section.target);
expect(section.period, isNotNull);
expect(section.methodName, isNotNull);
expect(section.argumentList, isNotNull);
@@ -4123,14 +5767,16 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCascadeSection_p() {
- PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a");
+ PropertyAccess section =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseCascadeSection", "..a = 3");
expect(section.leftHandSide, isNotNull);
expect(section.operator, isNotNull);
Expression rhs = section.rightHandSide;
@@ -4138,22 +5784,28 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCascadeSection_p_assign_withCascade() {
- AssignmentExpression section = ParserTestCase.parse4("parseCascadeSection", "..a = 3..m()");
+ AssignmentExpression section =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseCascadeSection", "..a(b)");
expect(section.target, isNull);
expect(section.period, isNotNull);
expect(section.methodName, isNotNull);
@@ -4162,30 +5814,42 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCascadeSection_paa() {
- FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a(b)(c)");
- EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, section.function);
+ FunctionExpressionInvocation section =
+ ParserTestCase.parse4("parseCascadeSection", "..a(b)(c)");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is MethodInvocation,
+ MethodInvocation,
+ section.function);
expect(section.argumentList, isNotNull);
expect(section.argumentList.arguments, hasLength(1));
}
void test_parseCascadeSection_paapaa() {
- FunctionExpressionInvocation section = ParserTestCase.parse4("parseCascadeSection", "..a(b)(c).d(e)(f)");
- EngineTestCase.assertInstanceOf((obj) => obj is MethodInvocation, MethodInvocation, section.function);
+ FunctionExpressionInvocation section =
+ ParserTestCase.parse4("parseCascadeSection", "..a(b)(c).d(e)(f)");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is MethodInvocation,
+ MethodInvocation,
+ section.function);
expect(section.argumentList, isNotNull);
expect(section.argumentList.arguments, hasLength(1));
}
void test_parseCascadeSection_pap() {
- PropertyAccess section = ParserTestCase.parse4("parseCascadeSection", "..a(b).c");
+ PropertyAccess section =
+ ParserTestCase.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> [
- emptyCommentAndMetadata(),
- TokenFactory.tokenFromKeyword(Keyword.ABSTRACT)], "class A {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[
+ emptyCommentAndMetadata(),
+ TokenFactory.tokenFromKeyword(Keyword.ABSTRACT)],
+ "class A {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNotNull);
expect(declaration.extendsClause, isNull);
@@ -4199,7 +5863,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_empty() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNull);
@@ -4213,7 +5880,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_extends() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A extends B {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNotNull);
@@ -4227,7 +5897,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_extendsAndImplements() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B implements C {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A extends B implements C {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNotNull);
@@ -4241,7 +5914,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_extendsAndWith() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A extends B with C {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.classKeyword, isNotNull);
@@ -4256,7 +5932,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_extendsAndWithAndImplements() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C implements D {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A extends B with C implements D {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.classKeyword, isNotNull);
@@ -4271,7 +5950,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_implements() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A implements C {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A implements C {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNull);
@@ -4285,7 +5967,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_native() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A native 'nativeValue' {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A native 'nativeValue' {}");
NativeClause nativeClause = declaration.nativeClause;
expect(nativeClause, isNotNull);
expect(nativeClause.keyword, isNotNull);
@@ -4295,7 +5980,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_nonEmpty() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {var f;}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A {var f;}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNull);
@@ -4309,7 +5997,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_typeAlias_implementsC() {
- ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A = Object with B implements C;");
+ ClassTypeAlias typeAlias = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A = Object with B implements C;");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
@@ -4321,7 +6012,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 = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A = Object with B;");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
@@ -4333,7 +6027,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassDeclaration_typeParameters() {
- ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A<B> {}");
+ ClassDeclaration declaration = ParserTestCase.parse(
+ "parseClassDeclaration",
+ <Object>[emptyCommentAndMetadata(), null],
+ "class A<B> {}");
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.extendsClause, isNull);
@@ -4348,8 +6045,12 @@ 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 = _ + _\$ {}");
+ // TODO(brianwilkerson) Test other kinds of class members: fields, getters
+ // and setters.
+ ConstructorDeclaration constructor = ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "C(_, _\$, this.__) : _a = _ + _\$ {}");
expect(constructor.body, isNotNull);
expect(constructor.separator, isNotNull);
expect(constructor.externalKeyword, isNull);
@@ -4363,7 +6064,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_field_instance_prefixedType() {
- FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "p.A f;");
+ FieldDeclaration field =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "p.A f;");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -4376,7 +6078,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_field_namedGet() {
- FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "var get;");
+ FieldDeclaration field =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "var get;");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -4389,7 +6092,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_field_namedOperator() {
- FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "var operator;");
+ FieldDeclaration field =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "var operator;");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -4402,7 +6106,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_field_namedOperator_withAssignment() {
- FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "var operator = (5);");
+ FieldDeclaration field =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "var operator = (5);");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -4416,7 +6121,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_field_namedSet() {
- FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "var set;");
+ FieldDeclaration field =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "var set;");
expect(field.documentationComment, isNull);
expect(field.metadata, hasLength(0));
expect(field.staticKeyword, isNull);
@@ -4429,7 +6135,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_getter_void() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get g {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "void get g {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4441,7 +6148,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_external() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external m();");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "external m();");
expect(method.body, isNotNull);
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNotNull);
@@ -4454,7 +6162,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_external_withTypeAndArgs() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external int m(int a);");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "external int m(int a);");
expect(method.body, isNotNull);
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNotNull);
@@ -4467,7 +6178,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_get_noType() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "get() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "get() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4480,7 +6192,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_get_type() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int get() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "int get() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4493,7 +6206,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_get_void() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "void get() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4506,7 +6220,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_operator_noType() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "operator() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "operator() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4519,7 +6234,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_operator_type() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "int operator() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4532,7 +6248,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_operator_void() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void operator() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "void operator() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4545,7 +6262,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_returnType_parameterized() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "p.A m() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "p.A m() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4558,7 +6276,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_set_noType() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "set() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "set() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4571,7 +6290,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_set_type() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int set() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "int set() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4584,7 +6304,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_method_set_void() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void set() {}");
+ MethodDeclaration method =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "void set() {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4597,7 +6318,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_operator_index() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator [](int i) {}");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "int operator [](int i) {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4610,7 +6334,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_operator_indexAssign() {
- MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator []=(int i) {}");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "int operator []=(int i) {}");
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
@@ -4623,7 +6350,10 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_redirectingFactory_const() {
- ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = B;");
+ ConstructorDeclaration constructor = ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "const factory C() = B;");
expect(constructor.externalKeyword, isNull);
expect(constructor.constKeyword, isNotNull);
expect(constructor.factoryKeyword, isNotNull);
@@ -4638,7 +6368,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseClassMember_redirectingFactory_nonConst() {
- ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember", <Object> ["C"], "factory C() = B;");
+ ConstructorDeclaration constructor =
+ ParserTestCase.parse("parseClassMember", <Object>["C"], "factory C() = B;");
expect(constructor.externalKeyword, isNull);
expect(constructor.constKeyword, isNull);
expect(constructor.factoryKeyword, isNotNull);
@@ -4655,7 +6386,10 @@ 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> [emptyCommentAndMetadata(), abstractToken, classToken], "A = B with C;");
+ ClassTypeAlias classTypeAlias = ParserTestCase.parse(
+ "parseClassTypeAlias",
+ <Object>[emptyCommentAndMetadata(), abstractToken, classToken],
+ "A = B with C;");
expect(classTypeAlias.keyword, isNotNull);
expect(classTypeAlias.name.name, "A");
expect(classTypeAlias.equals, isNotNull);
@@ -4668,7 +6402,10 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassTypeAlias_implements() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
- ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C implements D;");
+ ClassTypeAlias classTypeAlias = ParserTestCase.parse(
+ "parseClassTypeAlias",
+ <Object>[emptyCommentAndMetadata(), null, token],
+ "A = B with C implements D;");
expect(classTypeAlias.keyword, isNotNull);
expect(classTypeAlias.name.name, "A");
expect(classTypeAlias.equals, isNotNull);
@@ -4681,7 +6418,10 @@ 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 = ParserTestCase.parse(
+ "parseClassTypeAlias",
+ <Object>[emptyCommentAndMetadata(), null, token],
+ "A = B with C;");
expect(classTypeAlias.keyword, isNotNull);
expect(classTypeAlias.name.name, "A");
expect(classTypeAlias.equals, isNotNull);
@@ -4694,7 +6434,10 @@ class SimpleParserTest extends ParserTestCase {
void test_parseClassTypeAlias_with_implements() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
- ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), null, token], "A = B with C implements D;");
+ ClassTypeAlias classTypeAlias = ParserTestCase.parse(
+ "parseClassTypeAlias",
+ <Object>[emptyCommentAndMetadata(), null, token],
+ "A = B with C implements D;");
expect(classTypeAlias.keyword, isNotNull);
expect(classTypeAlias.name.name, "A");
expect(classTypeAlias.equals, isNotNull);
@@ -4706,7 +6449,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCombinators_h() {
- List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hide a;");
+ List<Combinator> combinators =
+ ParserTestCase.parse4("parseCombinators", "hide a;");
expect(combinators, hasLength(1));
HideCombinator combinator = combinators[0] as HideCombinator;
expect(combinator, isNotNull);
@@ -4715,7 +6459,8 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCombinators_hs() {
- List<Combinator> combinators = ParserTestCase.parse4("parseCombinators", "hide a show b;");
+ List<Combinator> combinators =
+ ParserTestCase.parse4("parseCombinators", "hide a show b;");
expect(combinators, hasLength(2));
HideCombinator hideCombinator = combinators[0] as HideCombinator;
expect(hideCombinator, isNotNull);
@@ -4728,12 +6473,14 @@ 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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseCombinators", "show a;");
expect(combinators, hasLength(1));
ShowCombinator combinator = combinators[0] as ShowCombinator;
expect(combinator, isNotNull);
@@ -4742,61 +6489,73 @@ class SimpleParserTest extends ParserTestCase {
}
void test_parseCommentAndMetadata_c() {
- CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentAndMetadata", "/** 1 */ void");
+ CommentAndMetadata commentAndMetadata =
+ ParserTestCase.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 =
+ ParserTestCase.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 = ParserTestCase.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");
+ CommentAndMetadata commentAndMetadata =
+ ParserTestCase.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");
+ CommentAndMetadata commentAndMetadata =
+ ParserTestCase.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");
+ CommentAndMetadata commentAndMetadata =
+ ParserTestCase.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 = ParserTestCase.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");
+ CommentAndMetadata commentAndMetadata =
+ ParserTestCase.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");
+ CommentAndMetadata commentAndMetadata =
+ ParserTestCase.parse4("parseCommentAndMetadata", "void");
expect(commentAndMetadata.comment, isNull);
expect(commentAndMetadata.metadata, hasLength(0));
}
void test_parseCommentAndMetadata_singleLine() {
- CommentAndMetadata commentAndMetadata = ParserTestCase.parse4("parseCommentAndMetadata", r'''
+ CommentAndMetadata commentAndMetadata =
+ ParserTestCase.parse4("parseCommentAndMetadata", r'''
/// 1
/// 2
void''');
@@ -4805,8 +6564,12 @@ void''');
}
void test_parseCommentReference_new_prefixed() {
- CommentReference reference = ParserTestCase.parse("parseCommentReference", <Object> ["new a.b", 7], "");
- PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf((obj) => obj is PrefixedIdentifier, PrefixedIdentifier, reference.identifier);
+ CommentReference reference =
+ ParserTestCase.parse("parseCommentReference", <Object>["new a.b", 7], "");
+ PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is PrefixedIdentifier,
+ PrefixedIdentifier,
+ reference.identifier);
SimpleIdentifier prefix = prefixedIdentifier.prefix;
expect(prefix.token, isNotNull);
expect(prefix.name, "a");
@@ -4819,16 +6582,24 @@ void''');
}
void test_parseCommentReference_new_simple() {
- CommentReference reference = ParserTestCase.parse("parseCommentReference", <Object> ["new a", 5], "");
- SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, reference.identifier);
+ CommentReference reference =
+ ParserTestCase.parse("parseCommentReference", <Object>["new a", 5], "");
+ SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ reference.identifier);
expect(identifier.token, isNotNull);
expect(identifier.name, "a");
expect(identifier.offset, 9);
}
void test_parseCommentReference_prefixed() {
- CommentReference reference = ParserTestCase.parse("parseCommentReference", <Object> ["a.b", 7], "");
- PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf((obj) => obj is PrefixedIdentifier, PrefixedIdentifier, reference.identifier);
+ CommentReference reference =
+ ParserTestCase.parse("parseCommentReference", <Object>["a.b", 7], "");
+ PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is PrefixedIdentifier,
+ PrefixedIdentifier,
+ reference.identifier);
SimpleIdentifier prefix = prefixedIdentifier.prefix;
expect(prefix.token, isNotNull);
expect(prefix.name, "a");
@@ -4841,16 +6612,24 @@ void''');
}
void test_parseCommentReference_simple() {
- CommentReference reference = ParserTestCase.parse("parseCommentReference", <Object> ["a", 5], "");
- SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, reference.identifier);
+ CommentReference reference =
+ ParserTestCase.parse("parseCommentReference", <Object>["a", 5], "");
+ SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ reference.identifier);
expect(identifier.token, isNotNull);
expect(identifier.name, "a");
expect(identifier.offset, 5);
}
void test_parseCommentReference_synthetic() {
- CommentReference reference = ParserTestCase.parse("parseCommentReference", <Object> ["", 5], "");
- SimpleIdentifier identifier = EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, reference.identifier);
+ CommentReference reference =
+ ParserTestCase.parse("parseCommentReference", <Object>["", 5], "");
+ SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ reference.identifier);
expect(identifier, isNotNull);
expect(identifier.isSynthetic, isTrue);
expect(identifier.token, isNotNull);
@@ -4859,8 +6638,10 @@ void''');
}
void test_parseCommentReferences_multiLine() {
- List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** xxx [a] yyy [b] zzz */", 3)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<Token> tokens = <Token>[
+ new StringToken(TokenType.MULTI_LINE_COMMENT, "/** xxx [a] yyy [b] zzz */", 3)];
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(2));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4873,8 +6654,10 @@ void''');
}
void test_parseCommentReferences_notClosed_noIdentifier() {
- List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [ some text", 5)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<Token> tokens = <Token>[
+ new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [ some text", 5)];
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4884,8 +6667,10 @@ void''');
}
void test_parseCommentReferences_notClosed_withIdentifier() {
- List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [namePrefix some text", 5)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<Token> tokens = <Token>[
+ new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [namePrefix some text", 5)];
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4895,10 +6680,11 @@ void''');
}
void test_parseCommentReferences_singleLine() {
- List<Token> tokens = <Token> [
+ List<Token> tokens = <Token>[
new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// xxx [a] yyy [b] zzz", 3),
new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(3));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4915,8 +6701,13 @@ void''');
}
void test_parseCommentReferences_skipCodeBlock_bracketed() {
- List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [:xxx [a] yyy:] [b] zzz */", 3)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<Token> tokens = <Token>[
+ new StringToken(
+ TokenType.MULTI_LINE_COMMENT,
+ "/** [:xxx [a] yyy:] [b] zzz */",
+ 3)];
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4925,8 +6716,13 @@ void''');
}
void test_parseCommentReferences_skipCodeBlock_spaces() {
- List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/**\n * a[i]\n * xxx [i] zzz\n */", 3)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<Token> tokens = <Token>[
+ new StringToken(
+ TokenType.MULTI_LINE_COMMENT,
+ "/**\n * a[i]\n * xxx [i] zzz\n */",
+ 3)];
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4935,8 +6731,13 @@ void''');
}
void test_parseCommentReferences_skipLinkDefinition() {
- List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a]: http://www.google.com (Google) [b] zzz */", 3)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<Token> tokens = <Token>[
+ new StringToken(
+ TokenType.MULTI_LINE_COMMENT,
+ "/** [a]: http://www.google.com (Google) [b] zzz */",
+ 3)];
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4945,8 +6746,13 @@ void''');
}
void test_parseCommentReferences_skipLinked() {
- List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a](http://www.google.com) [b] zzz */", 3)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<Token> tokens = <Token>[
+ new StringToken(
+ TokenType.MULTI_LINE_COMMENT,
+ "/** [a](http://www.google.com) [b] zzz */",
+ 3)];
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4955,8 +6761,10 @@ void''');
}
void test_parseCommentReferences_skipReferenceLink() {
- List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a][c] [b] zzz */", 3)];
- List<CommentReference> references = ParserTestCase.parse("parseCommentReferences", <Object> [tokens], "");
+ List<Token> tokens = <Token>[
+ new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a][c] [b] zzz */", 3)];
+ List<CommentReference> references =
+ ParserTestCase.parse("parseCommentReferences", <Object>[tokens], "");
expect(references, hasLength(1));
CommentReference reference = references[0];
expect(reference, isNotNull);
@@ -4965,7 +6773,9 @@ void''');
}
void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "abstract<dynamic> _abstract = new abstract.A();");
+ CompilationUnit unit = ParserTestCase.parse4(
+ "parseCompilationUnit",
+ "abstract<dynamic> _abstract = new abstract.A();");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(1));
@@ -4990,14 +6800,16 @@ void''');
}
void test_parseCompilationUnit_directives_multiple() {
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "library l;\npart 'a.dart';");
+ CompilationUnit unit =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseCompilationUnit", "library l;");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(1));
expect(unit.declarations, hasLength(0));
@@ -5011,28 +6823,35 @@ void''');
}
void test_parseCompilationUnit_exportAsPrefix() {
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "export.A _export = new export.A();");
+ CompilationUnit unit = ParserTestCase.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("parseCompilationUnit", "export<dynamic> _export = new export.A();");
+ CompilationUnit unit = ParserTestCase.parse4(
+ "parseCompilationUnit",
+ "export<dynamic> _export = new export.A();");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(1));
}
void test_parseCompilationUnit_operatorAsPrefix_parameterized() {
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "operator<dynamic> _operator = new operator.A();");
+ CompilationUnit unit = ParserTestCase.parse4(
+ "parseCompilationUnit",
+ "operator<dynamic> _operator = new operator.A();");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(1));
}
void test_parseCompilationUnit_script() {
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "#! /bin/dart");
+ CompilationUnit unit =
+ ParserTestCase.parse4("parseCompilationUnit", "#! /bin/dart");
expect(unit.scriptTag, isNotNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(0));
@@ -5040,141 +6859,202 @@ void''');
void test_parseCompilationUnit_skipFunctionBody_withInterpolation() {
ParserTestCase.parseFunctionBodies = false;
- CompilationUnit unit = ParserTestCase.parse4("parseCompilationUnit", "f() { '\${n}'; }");
+ CompilationUnit unit =
+ ParserTestCase.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 =
+ ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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", <Object> [emptyCommentAndMetadata()], "abstract class A = B with C;");
+ ClassTypeAlias alias = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.parse(
+ "parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "abstract class C = S with M;");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name.name, "C");
expect(typeAlias.typeParameters, isNull);
@@ -5187,7 +7067,10 @@ 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 = ParserTestCase.parse(
+ "parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "class C<E> = S<E> with M<E> implements I<E>;");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name.name, "C");
expect(typeAlias.typeParameters.typeParameters, hasLength(1));
@@ -5200,7 +7083,10 @@ void''');
}
void test_parseCompilationUnitMember_typeAlias_implements() {
- ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember", <Object> [emptyCommentAndMetadata()], "class C = S with M implements I;");
+ ClassTypeAlias typeAlias = ParserTestCase.parse(
+ "parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "class C = S with M implements I;");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name.name, "C");
expect(typeAlias.typeParameters, isNull);
@@ -5213,7 +7099,10 @@ void''');
}
void test_parseCompilationUnitMember_typeAlias_noImplements() {
- ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember", <Object> [emptyCommentAndMetadata()], "class C = S with M;");
+ ClassTypeAlias typeAlias = ParserTestCase.parse(
+ "parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()],
+ "class C = S with M;");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name.name, "C");
expect(typeAlias.typeParameters, isNull);
@@ -5226,31 +7115,44 @@ void''');
}
void test_parseCompilationUnitMember_typedef() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember", <Object> [emptyCommentAndMetadata()], "typedef F();");
+ FunctionTypeAlias typeAlias = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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");
+ ConditionalExpression expression =
+ ParserTestCase.parse4("parseConditionalExpression", "x ? y : z");
expect(expression.condition, isNotNull);
expect(expression.question, isNotNull);
expect(expression.thenExpression, isNotNull);
@@ -5259,7 +7161,8 @@ void''');
}
void test_parseConstExpression_instanceCreation() {
- InstanceCreationExpression expression = ParserTestCase.parse4("parseConstExpression", "const A()");
+ InstanceCreationExpression expression =
+ ParserTestCase.parse4("parseConstExpression", "const A()");
expect(expression.keyword, isNotNull);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -5270,7 +7173,8 @@ void''');
}
void test_parseConstExpression_listLiteral_typed() {
- ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const <A> []");
+ ListLiteral literal =
+ ParserTestCase.parse4("parseConstExpression", "const <A> []");
expect(literal.constKeyword, isNotNull);
expect(literal.typeArguments, isNotNull);
expect(literal.leftBracket, isNotNull);
@@ -5279,7 +7183,8 @@ void''');
}
void test_parseConstExpression_listLiteral_untyped() {
- ListLiteral literal = ParserTestCase.parse4("parseConstExpression", "const []");
+ ListLiteral literal =
+ ParserTestCase.parse4("parseConstExpression", "const []");
expect(literal.constKeyword, isNotNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -5288,7 +7193,8 @@ void''');
}
void test_parseConstExpression_mapLiteral_typed() {
- MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const <A, B> {}");
+ MapLiteral literal =
+ ParserTestCase.parse4("parseConstExpression", "const <A, B> {}");
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(0));
expect(literal.rightBracket, isNotNull);
@@ -5296,7 +7202,8 @@ void''');
}
void test_parseConstExpression_mapLiteral_untyped() {
- MapLiteral literal = ParserTestCase.parse4("parseConstExpression", "const {}");
+ MapLiteral literal =
+ ParserTestCase.parse4("parseConstExpression", "const {}");
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(0));
expect(literal.rightBracket, isNotNull);
@@ -5305,27 +7212,42 @@ void''');
void test_parseConstructor() {
// TODO(brianwilkerson) Implement tests for this method.
- // parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class,
- // Token.class, Token.class, SimpleIdentifier.class, Token.class,
- // SimpleIdentifier.class, FormalParameterList.class}, new Object[] {emptyCommentAndMetadata(),
- // null, null, null, null, null, null}, "");
+// parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class,
+// Token.class, Token.class, SimpleIdentifier.class, Token.class,
+// SimpleIdentifier.class, FormalParameterList.class}, new Object[] {emptyCommentAndMetadata(),
+// null, null, null, null, null, null}, "");
}
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) {}");
- EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, ConstructorDeclaration, classMember);
+ // "(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) {}");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ConstructorDeclaration,
+ ConstructorDeclaration,
+ classMember);
ConstructorDeclaration constructor = classMember as ConstructorDeclaration;
NodeList<ConstructorInitializer> initializers = constructor.initializers;
expect(initializers, hasLength(1));
ConstructorInitializer initializer = initializers[0];
- EngineTestCase.assertInstanceOf((obj) => obj is ConstructorFieldInitializer, ConstructorFieldInitializer, initializer);
- EngineTestCase.assertInstanceOf((obj) => obj is ParenthesizedExpression, ParenthesizedExpression, (initializer as ConstructorFieldInitializer).expression);
- EngineTestCase.assertInstanceOf((obj) => obj is BlockFunctionBody, BlockFunctionBody, constructor.body);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ConstructorFieldInitializer,
+ ConstructorFieldInitializer,
+ initializer);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ParenthesizedExpression,
+ ParenthesizedExpression,
+ (initializer as ConstructorFieldInitializer).expression);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is BlockFunctionBody,
+ BlockFunctionBody,
+ constructor.body);
}
void test_parseConstructorFieldInitializer_qualified() {
- ConstructorFieldInitializer invocation = ParserTestCase.parse4("parseConstructorFieldInitializer", "this.a = b");
+ ConstructorFieldInitializer invocation =
+ ParserTestCase.parse4("parseConstructorFieldInitializer", "this.a = b");
expect(invocation.equals, isNotNull);
expect(invocation.expression, isNotNull);
expect(invocation.fieldName, isNotNull);
@@ -5334,7 +7256,8 @@ void''');
}
void test_parseConstructorFieldInitializer_unqualified() {
- ConstructorFieldInitializer invocation = ParserTestCase.parse4("parseConstructorFieldInitializer", "a = b");
+ ConstructorFieldInitializer invocation =
+ ParserTestCase.parse4("parseConstructorFieldInitializer", "a = b");
expect(invocation.equals, isNotNull);
expect(invocation.expression, isNotNull);
expect(invocation.fieldName, isNotNull);
@@ -5343,14 +7266,16 @@ void''');
}
void test_parseConstructorName_named_noPrefix() {
- ConstructorName name = ParserTestCase.parse4("parseConstructorName", "A.n;");
+ ConstructorName name =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseConstructorName", "p.A.n;");
expect(name.type, isNotNull);
expect(name.period, isNotNull);
expect(name.name, isNotNull);
@@ -5364,28 +7289,38 @@ void''');
}
void test_parseConstructorName_unnamed_prefixed() {
- ConstructorName name = ParserTestCase.parse4("parseConstructorName", "p.A;");
+ ConstructorName name =
+ ParserTestCase.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 = ParserTestCase.parse4(
+ "parseContinueStatement",
+ "continue foo;",
+ [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
expect(statement.keyword, 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 = ParserTestCase.parse4(
+ "parseContinueStatement",
+ "continue;",
+ [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
expect(statement.keyword, 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 = ParserTestCase.parse(
+ "parseDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "export 'lib/lib.dart';");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(0));
@@ -5393,7 +7328,10 @@ void''');
}
void test_parseDirective_import() {
- ImportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart';");
+ ImportDirective directive = ParserTestCase.parse(
+ "parseDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart';");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.asToken, isNull);
@@ -5403,21 +7341,30 @@ void''');
}
void test_parseDirective_library() {
- LibraryDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "library l;");
+ LibraryDirective directive = ParserTestCase.parse(
+ "parseDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "library l;");
expect(directive.libraryToken, isNotNull);
expect(directive.name, isNotNull);
expect(directive.semicolon, isNotNull);
}
void test_parseDirective_part() {
- PartDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "part 'lib/lib.dart';");
+ PartDirective directive = ParserTestCase.parse(
+ "parseDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "part 'lib/lib.dart';");
expect(directive.partToken, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.semicolon, isNotNull);
}
void test_parseDirective_partOf() {
- PartOfDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "part of l;");
+ PartOfDirective directive = ParserTestCase.parse(
+ "parseDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "part of l;");
expect(directive.partToken, isNotNull);
expect(directive.ofToken, isNotNull);
expect(directive.libraryName, isNotNull);
@@ -5425,7 +7372,8 @@ void''');
}
void test_parseDirectives_complete() {
- CompilationUnit unit = _parseDirectives("#! /bin/dart\nlibrary l;\nclass A {}");
+ CompilationUnit unit =
+ _parseDirectives("#! /bin/dart\nlibrary l;\nclass A {}");
expect(unit.scriptTag, isNotNull);
expect(unit.directives, hasLength(1));
}
@@ -5437,7 +7385,8 @@ void''');
}
void test_parseDirectives_mixed() {
- CompilationUnit unit = _parseDirectives("library l; class A {} part 'foo.dart';");
+ CompilationUnit unit =
+ _parseDirectives("library l; class A {} part 'foo.dart';");
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(1));
}
@@ -5467,14 +7416,16 @@ void''');
}
void test_parseDocumentationComment_block() {
- Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/** */ class");
+ Comment comment =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseDocumentationComment", "/** [a] */ class");
expect(comment.isBlock, isFalse);
expect(comment.isDocumentation, isTrue);
expect(comment.isEndOfLine, isFalse);
@@ -5486,14 +7437,16 @@ void''');
}
void test_parseDocumentationComment_endOfLine() {
- Comment comment = ParserTestCase.parse4("parseDocumentationComment", "/// \n/// \n class");
+ Comment comment =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseDoStatement", "do {} while (x);");
expect(statement.doKeyword, isNotNull);
expect(statement.body, isNotNull);
expect(statement.whileKeyword, isNotNull);
@@ -5504,12 +7457,16 @@ void''');
}
void test_parseEmptyStatement() {
- EmptyStatement statement = ParserTestCase.parse4("parseEmptyStatement", ";");
+ EmptyStatement statement =
+ ParserTestCase.parse4("parseEmptyStatement", ";");
expect(statement.semicolon, isNotNull);
}
void test_parseEnumDeclaration_one() {
- EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", <Object> [emptyCommentAndMetadata()], "enum E {ONE}");
+ EnumDeclaration declaration = ParserTestCase.parse(
+ "parseEnumDeclaration",
+ <Object>[emptyCommentAndMetadata()],
+ "enum E {ONE}");
expect(declaration.documentationComment, isNull);
expect(declaration.keyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
@@ -5519,7 +7476,10 @@ void''');
}
void test_parseEnumDeclaration_trailingComma() {
- EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", <Object> [emptyCommentAndMetadata()], "enum E {ONE,}");
+ EnumDeclaration declaration = ParserTestCase.parse(
+ "parseEnumDeclaration",
+ <Object>[emptyCommentAndMetadata()],
+ "enum E {ONE,}");
expect(declaration.documentationComment, isNull);
expect(declaration.keyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
@@ -5529,7 +7489,10 @@ void''');
}
void test_parseEnumDeclaration_two() {
- EnumDeclaration declaration = ParserTestCase.parse("parseEnumDeclaration", <Object> [emptyCommentAndMetadata()], "enum E {ONE, TWO}");
+ EnumDeclaration declaration = ParserTestCase.parse(
+ "parseEnumDeclaration",
+ <Object>[emptyCommentAndMetadata()],
+ "enum E {ONE, TWO}");
expect(declaration.documentationComment, isNull);
expect(declaration.keyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
@@ -5539,7 +7502,8 @@ void''');
}
void test_parseEqualityExpression_normal() {
- BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression", "x == y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseEqualityExpression", "x == y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ_EQ);
@@ -5547,15 +7511,22 @@ void''');
}
void test_parseEqualityExpression_super() {
- BinaryExpression expression = ParserTestCase.parse4("parseEqualityExpression", "super == y");
- EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseEqualityExpression", "super == y");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SuperExpression,
+ SuperExpression,
+ expression.leftOperand);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ_EQ);
expect(expression.rightOperand, isNotNull);
}
void test_parseExportDirective_hide() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A, B;");
+ ExportDirective directive = ParserTestCase.parse(
+ "parseExportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "export 'lib/lib.dart' hide A, B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(1));
@@ -5563,7 +7534,10 @@ void''');
}
void test_parseExportDirective_hide_show() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A show B;");
+ ExportDirective directive = ParserTestCase.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));
@@ -5571,7 +7545,10 @@ void''');
}
void test_parseExportDirective_noCombinator() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart';");
+ ExportDirective directive = ParserTestCase.parse(
+ "parseExportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "export 'lib/lib.dart';");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(0));
@@ -5579,7 +7556,10 @@ void''');
}
void test_parseExportDirective_show() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show A, B;");
+ ExportDirective directive = ParserTestCase.parse(
+ "parseExportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "export 'lib/lib.dart' show A, B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.combinators, hasLength(1));
@@ -5587,7 +7567,10 @@ void''');
}
void test_parseExportDirective_show_hide() {
- ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show B hide A;");
+ ExportDirective directive = ParserTestCase.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));
@@ -5596,7 +7579,8 @@ void''');
void test_parseExpression_assign() {
// TODO(brianwilkerson) Implement more tests for this method.
- AssignmentExpression expression = ParserTestCase.parse4("parseExpression", "x = y");
+ AssignmentExpression expression =
+ ParserTestCase.parse4("parseExpression", "x = y");
expect(expression.leftHandSide, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ);
@@ -5604,7 +7588,8 @@ void''');
}
void test_parseExpression_comparison() {
- BinaryExpression expression = ParserTestCase.parse4("parseExpression", "--a.b == c");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseExpression", "--a.b == c");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ_EQ);
@@ -5612,7 +7597,8 @@ void''');
}
void test_parseExpression_function_async() {
- FunctionExpression expression = ParserTestCase.parseExpression("() async {}");
+ FunctionExpression expression =
+ ParserTestCase.parseExpression("() async {}");
expect(expression.body, isNotNull);
expect(expression.body.isAsynchronous, isTrue);
expect(expression.body.isGenerator, isFalse);
@@ -5620,7 +7606,8 @@ void''');
}
void test_parseExpression_function_asyncStar() {
- FunctionExpression expression = ParserTestCase.parseExpression("() async* {}");
+ FunctionExpression expression =
+ ParserTestCase.parseExpression("() async* {}");
expect(expression.body, isNotNull);
expect(expression.body.isAsynchronous, isTrue);
expect(expression.body.isGenerator, isTrue);
@@ -5636,7 +7623,8 @@ void''');
}
void test_parseExpression_function_syncStar() {
- FunctionExpression expression = ParserTestCase.parseExpression("() sync* {}");
+ FunctionExpression expression =
+ ParserTestCase.parseExpression("() sync* {}");
expect(expression.body, isNotNull);
expect(expression.body.isAsynchronous, isFalse);
expect(expression.body.isGenerator, isTrue);
@@ -5644,8 +7632,12 @@ void''');
}
void test_parseExpression_invokeFunctionExpression() {
- FunctionExpressionInvocation invocation = ParserTestCase.parse4("parseExpression", "(a) {return a + a;} (3)");
- EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, FunctionExpression, invocation.function);
+ FunctionExpressionInvocation invocation =
+ ParserTestCase.parse4("parseExpression", "(a) {return a + a;} (3)");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FunctionExpression,
+ FunctionExpression,
+ invocation.function);
FunctionExpression expression = invocation.function as FunctionExpression;
expect(expression.parameters, isNotNull);
expect(expression.body, isNotNull);
@@ -5655,14 +7647,16 @@ void''');
}
void test_parseExpression_superMethodInvocation() {
- MethodInvocation invocation = ParserTestCase.parse4("parseExpression", "super.m()");
+ MethodInvocation invocation =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseExpressionList", "1, 2, 3");
expect(result, hasLength(3));
}
@@ -5673,7 +7667,8 @@ void''');
void test_parseExpressionWithoutCascade_assign() {
// TODO(brianwilkerson) Implement more tests for this method.
- AssignmentExpression expression = ParserTestCase.parse4("parseExpressionWithoutCascade", "x = y");
+ AssignmentExpression expression =
+ ParserTestCase.parse4("parseExpressionWithoutCascade", "x = y");
expect(expression.leftHandSide, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ);
@@ -5681,7 +7676,8 @@ void''');
}
void test_parseExpressionWithoutCascade_comparison() {
- BinaryExpression expression = ParserTestCase.parse4("parseExpressionWithoutCascade", "--a.b == c");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseExpressionWithoutCascade", "--a.b == c");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.EQ_EQ);
@@ -5689,21 +7685,27 @@ void''');
}
void test_parseExpressionWithoutCascade_superMethodInvocation() {
- MethodInvocation invocation = ParserTestCase.parse4("parseExpressionWithoutCascade", "super.m()");
+ MethodInvocation invocation =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseExtendsClause", "extends B");
expect(clause.keyword, isNotNull);
expect(clause.superclass, isNotNull);
- EngineTestCase.assertInstanceOf((obj) => obj is TypeName, TypeName, clause.superclass);
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is TypeName,
+ TypeName,
+ clause.superclass);
}
void test_parseFinalConstVarOrType_const_noType() {
- FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType", <Object> [false], "const");
+ FinalConstVarOrType result =
+ ParserTestCase.parse("parseFinalConstVarOrType", <Object>[false], "const");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -5712,7 +7714,8 @@ void''');
}
void test_parseFinalConstVarOrType_const_type() {
- FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType", <Object> [false], "const A a");
+ FinalConstVarOrType result =
+ ParserTestCase.parse("parseFinalConstVarOrType", <Object>[false], "const A a");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -5721,7 +7724,8 @@ void''');
}
void test_parseFinalConstVarOrType_final_noType() {
- FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType", <Object> [false], "final");
+ FinalConstVarOrType result =
+ ParserTestCase.parse("parseFinalConstVarOrType", <Object>[false], "final");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -5730,7 +7734,10 @@ void''');
}
void test_parseFinalConstVarOrType_final_prefixedType() {
- FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType", <Object> [false], "final p.A a");
+ FinalConstVarOrType result = ParserTestCase.parse(
+ "parseFinalConstVarOrType",
+ <Object>[false],
+ "final p.A a");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -5739,7 +7746,8 @@ void''');
}
void test_parseFinalConstVarOrType_final_type() {
- FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType", <Object> [false], "final A a");
+ FinalConstVarOrType result =
+ ParserTestCase.parse("parseFinalConstVarOrType", <Object>[false], "final A a");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -5748,37 +7756,43 @@ void''');
}
void test_parseFinalConstVarOrType_type_parameterized() {
- FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType", <Object> [false], "A<B> a");
+ FinalConstVarOrType result =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse("parseFinalConstVarOrType", <Object>[false], "var");
Token keyword = result.keyword;
expect(keyword, isNotNull);
expect(keyword.type, TokenType.KEYWORD);
@@ -5787,21 +7801,27 @@ void''');
}
void test_parseFinalConstVarOrType_void() {
- FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType", <Object> [false], "void f()");
+ FinalConstVarOrType result =
+ ParserTestCase.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 =
+ ParserTestCase.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");
- SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalParameter;
+ DefaultFormalParameter parameter = ParserTestCase.parse(
+ "parseFormalParameter",
+ <Object>[kind],
+ "final A a : null");
+ SimpleFormalParameter simpleParameter =
+ parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
expect(simpleParameter.keyword, isNotNull);
expect(simpleParameter.type, isNotNull);
@@ -5813,7 +7833,8 @@ void''');
void test_parseFormalParameter_final_withType_normal() {
ParameterKind kind = ParameterKind.REQUIRED;
- SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter", <Object> [kind], "final A a");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse("parseFormalParameter", <Object>[kind], "final A a");
expect(parameter.identifier, isNotNull);
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
@@ -5822,8 +7843,12 @@ void''');
void test_parseFormalParameter_final_withType_positional() {
ParameterKind kind = ParameterKind.POSITIONAL;
- DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParameter", <Object> [kind], "final A a = null");
- SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalParameter;
+ DefaultFormalParameter parameter = ParserTestCase.parse(
+ "parseFormalParameter",
+ <Object>[kind],
+ "final A a = null");
+ SimpleFormalParameter simpleParameter =
+ parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
expect(simpleParameter.keyword, isNotNull);
expect(simpleParameter.type, isNotNull);
@@ -5835,8 +7860,10 @@ void''');
void test_parseFormalParameter_nonFinal_withType_named() {
ParameterKind kind = ParameterKind.NAMED;
- DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParameter", <Object> [kind], "A a : null");
- SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalParameter;
+ DefaultFormalParameter parameter =
+ ParserTestCase.parse("parseFormalParameter", <Object>[kind], "A a : null");
+ SimpleFormalParameter simpleParameter =
+ parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
expect(simpleParameter.keyword, isNull);
expect(simpleParameter.type, isNotNull);
@@ -5848,7 +7875,8 @@ void''');
void test_parseFormalParameter_nonFinal_withType_normal() {
ParameterKind kind = ParameterKind.REQUIRED;
- SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter", <Object> [kind], "A a");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse("parseFormalParameter", <Object>[kind], "A a");
expect(parameter.identifier, isNotNull);
expect(parameter.keyword, isNull);
expect(parameter.type, isNotNull);
@@ -5857,8 +7885,10 @@ void''');
void test_parseFormalParameter_nonFinal_withType_positional() {
ParameterKind kind = ParameterKind.POSITIONAL;
- DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParameter", <Object> [kind], "A a = null");
- SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalParameter;
+ DefaultFormalParameter parameter =
+ ParserTestCase.parse("parseFormalParameter", <Object>[kind], "A a = null");
+ SimpleFormalParameter simpleParameter =
+ parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
expect(simpleParameter.keyword, isNull);
expect(simpleParameter.type, isNotNull);
@@ -5870,7 +7900,8 @@ void''');
void test_parseFormalParameter_var() {
ParameterKind kind = ParameterKind.REQUIRED;
- SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter", <Object> [kind], "var a");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse("parseFormalParameter", <Object>[kind], "var a");
expect(parameter.identifier, isNotNull);
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
@@ -5879,8 +7910,10 @@ void''');
void test_parseFormalParameter_var_named() {
ParameterKind kind = ParameterKind.NAMED;
- DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParameter", <Object> [kind], "var a : null");
- SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalParameter;
+ DefaultFormalParameter parameter =
+ ParserTestCase.parse("parseFormalParameter", <Object>[kind], "var a : null");
+ SimpleFormalParameter simpleParameter =
+ parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
expect(simpleParameter.keyword, isNotNull);
expect(simpleParameter.type, isNull);
@@ -5892,8 +7925,10 @@ void''');
void test_parseFormalParameter_var_positional() {
ParameterKind kind = ParameterKind.POSITIONAL;
- DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParameter", <Object> [kind], "var a = null");
- SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalParameter;
+ DefaultFormalParameter parameter =
+ ParserTestCase.parse("parseFormalParameter", <Object>[kind], "var a = null");
+ SimpleFormalParameter simpleParameter =
+ parameter.parameter as SimpleFormalParameter;
expect(simpleParameter.identifier, isNotNull);
expect(simpleParameter.keyword, isNotNull);
expect(simpleParameter.type, isNull);
@@ -5904,7 +7939,8 @@ void''');
}
void test_parseFormalParameterList_empty() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "()");
+ FormalParameterList parameterList =
+ ParserTestCase.parse4("parseFormalParameterList", "()");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNull);
expect(parameterList.parameters, hasLength(0));
@@ -5913,7 +7949,8 @@ void''');
}
void test_parseFormalParameterList_named_multiple() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "({A a : 1, B b, C c : 3})");
+ FormalParameterList parameterList =
+ ParserTestCase.parse4("parseFormalParameterList", "({A a : 1, B b, C c : 3})");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(3));
@@ -5922,7 +7959,8 @@ void''');
}
void test_parseFormalParameterList_named_single() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "({A a})");
+ FormalParameterList parameterList =
+ ParserTestCase.parse4("parseFormalParameterList", "({A a})");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(1));
@@ -5931,7 +7969,8 @@ void''');
}
void test_parseFormalParameterList_normal_multiple() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "(A a, B b, C c)");
+ FormalParameterList parameterList =
+ ParserTestCase.parse4("parseFormalParameterList", "(A a, B b, C c)");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNull);
expect(parameterList.parameters, hasLength(3));
@@ -5940,7 +7979,8 @@ void''');
}
void test_parseFormalParameterList_normal_named() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "(A a, {B b})");
+ FormalParameterList parameterList =
+ ParserTestCase.parse4("parseFormalParameterList", "(A a, {B b})");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(2));
@@ -5949,7 +7989,8 @@ void''');
}
void test_parseFormalParameterList_normal_positional() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "(A a, [B b])");
+ FormalParameterList parameterList =
+ ParserTestCase.parse4("parseFormalParameterList", "(A a, [B b])");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(2));
@@ -5958,7 +7999,8 @@ void''');
}
void test_parseFormalParameterList_normal_single() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "(A a)");
+ FormalParameterList parameterList =
+ ParserTestCase.parse4("parseFormalParameterList", "(A a)");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNull);
expect(parameterList.parameters, hasLength(1));
@@ -5967,7 +8009,9 @@ void''');
}
void test_parseFormalParameterList_positional_multiple() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "([A a = null, B b, C c = null])");
+ FormalParameterList parameterList = ParserTestCase.parse4(
+ "parseFormalParameterList",
+ "([A a = null, B b, C c = null])");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(3));
@@ -5976,7 +8020,8 @@ void''');
}
void test_parseFormalParameterList_positional_single() {
- FormalParameterList parameterList = ParserTestCase.parse4("parseFormalParameterList", "([A a = null])");
+ FormalParameterList parameterList =
+ ParserTestCase.parse4("parseFormalParameterList", "([A a = null])");
expect(parameterList.leftParenthesis, isNotNull);
expect(parameterList.leftDelimiter, isNotNull);
expect(parameterList.parameters, hasLength(1));
@@ -5985,7 +8030,8 @@ void''');
}
void test_parseForStatement_each_await() {
- ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "await for (element in list) {}");
+ ForEachStatement statement =
+ ParserTestCase.parse4("parseForStatement", "await for (element in list) {}");
expect(statement.awaitKeyword, isNotNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -5998,7 +8044,8 @@ void''');
}
void test_parseForStatement_each_identifier() {
- ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (element in list) {}");
+ ForEachStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (element in list) {}");
expect(statement.awaitKeyword, isNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -6011,7 +8058,8 @@ void''');
}
void test_parseForStatement_each_noType_metadata() {
- ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var element in list) {}");
+ ForEachStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (@A var element in list) {}");
expect(statement.awaitKeyword, isNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -6025,7 +8073,8 @@ void''');
}
void test_parseForStatement_each_type() {
- ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (A element in list) {}");
+ ForEachStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (A element in list) {}");
expect(statement.awaitKeyword, isNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -6038,7 +8087,8 @@ void''');
}
void test_parseForStatement_each_var() {
- ForEachStatement statement = ParserTestCase.parse4("parseForStatement", "for (var element in list) {}");
+ ForEachStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (var element in list) {}");
expect(statement.awaitKeyword, isNull);
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
@@ -6051,7 +8101,8 @@ void''');
}
void test_parseForStatement_loop_c() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count;) {}");
+ ForStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (; i < count;) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.variables, isNull);
@@ -6065,7 +8116,8 @@ void''');
}
void test_parseForStatement_loop_cu() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (; i < count; i++) {}");
+ ForStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (; i < count; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.variables, isNull);
@@ -6079,7 +8131,8 @@ void''');
}
void test_parseForStatement_loop_ecu() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (i--; i < count; i++) {}");
+ ForStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (i--; i < count; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.variables, isNull);
@@ -6093,7 +8146,8 @@ void''');
}
void test_parseForStatement_loop_i() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (var i = 0;;) {}");
+ ForStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (var i = 0;;) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -6110,7 +8164,8 @@ void''');
}
void test_parseForStatement_loop_i_withMetadata() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (@A var i = 0;;) {}");
+ ForStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (@A var i = 0;;) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -6127,7 +8182,8 @@ void''');
}
void test_parseForStatement_loop_ic() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (var i = 0; i < count;) {}");
+ ForStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (var i = 0; i < count;) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -6143,7 +8199,9 @@ void''');
}
void test_parseForStatement_loop_icu() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (var i = 0; i < count; i++) {}");
+ ForStatement statement = ParserTestCase.parse4(
+ "parseForStatement",
+ "for (var i = 0; i < count; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -6159,7 +8217,9 @@ void''');
}
void test_parseForStatement_loop_iicuu() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (int i = 0, j = count; i < j; i++, j--) {}");
+ ForStatement statement = ParserTestCase.parse4(
+ "parseForStatement",
+ "for (int i = 0, j = count; i < j; i++, j--) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -6175,7 +8235,8 @@ void''');
}
void test_parseForStatement_loop_iu() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (var i = 0;; i++) {}");
+ ForStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (var i = 0;; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
VariableDeclarationList variables = statement.variables;
@@ -6191,7 +8252,8 @@ void''');
}
void test_parseForStatement_loop_u() {
- ForStatement statement = ParserTestCase.parse4("parseForStatement", "for (;; i++) {}");
+ ForStatement statement =
+ ParserTestCase.parse4("parseForStatement", "for (;; i++) {}");
expect(statement.forKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.variables, isNull);
@@ -6205,7 +8267,8 @@ void''');
}
void test_parseFunctionBody_block() {
- BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "{}");
+ BlockFunctionBody functionBody =
+ ParserTestCase.parse("parseFunctionBody", <Object>[false, null, false], "{}");
expect(functionBody.keyword, isNull);
expect(functionBody.star, isNull);
expect(functionBody.block, isNotNull);
@@ -6215,7 +8278,10 @@ void''');
}
void test_parseFunctionBody_block_async() {
- BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "async {}");
+ BlockFunctionBody functionBody = ParserTestCase.parse(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "async {}");
expect(functionBody.keyword, isNotNull);
expect(functionBody.keyword.lexeme, Parser.ASYNC);
expect(functionBody.star, isNull);
@@ -6226,7 +8292,10 @@ void''');
}
void test_parseFunctionBody_block_asyncGenerator() {
- BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "async* {}");
+ BlockFunctionBody functionBody = ParserTestCase.parse(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "async* {}");
expect(functionBody.keyword, isNotNull);
expect(functionBody.keyword.lexeme, Parser.ASYNC);
expect(functionBody.star, isNotNull);
@@ -6237,7 +8306,10 @@ void''');
}
void test_parseFunctionBody_block_syncGenerator() {
- BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "sync* {}");
+ BlockFunctionBody functionBody = ParserTestCase.parse(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "sync* {}");
expect(functionBody.keyword, isNotNull);
expect(functionBody.keyword.lexeme, Parser.SYNC);
expect(functionBody.star, isNotNull);
@@ -6248,12 +8320,16 @@ void''');
}
void test_parseFunctionBody_empty() {
- EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [true, null, false], ";");
+ EmptyFunctionBody functionBody =
+ ParserTestCase.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 = ParserTestCase.parse(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "=> y;");
expect(functionBody.keyword, isNull);
expect(functionBody.functionDefinition, isNotNull);
expect(functionBody.expression, isNotNull);
@@ -6264,7 +8340,10 @@ void''');
}
void test_parseFunctionBody_expression_async() {
- ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "async => y;");
+ ExpressionFunctionBody functionBody = ParserTestCase.parse(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "async => y;");
expect(functionBody.keyword, isNotNull);
expect(functionBody.keyword.lexeme, Parser.ASYNC);
expect(functionBody.functionDefinition, isNotNull);
@@ -6276,7 +8355,10 @@ void''');
}
void test_parseFunctionBody_nativeFunctionBody() {
- NativeFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "native 'str';");
+ NativeFunctionBody functionBody = ParserTestCase.parse(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "native 'str';");
expect(functionBody.nativeToken, isNotNull);
expect(functionBody.stringLiteral, isNotNull);
expect(functionBody.semicolon, isNotNull);
@@ -6284,32 +8366,58 @@ void''');
void test_parseFunctionBody_skip_block() {
ParserTestCase.parseFunctionBodies = false;
- FunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "{}");
- EngineTestCase.assertInstanceOf((obj) => obj is EmptyFunctionBody, EmptyFunctionBody, functionBody);
+ FunctionBody functionBody =
+ ParserTestCase.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]);
- EngineTestCase.assertInstanceOf((obj) => obj is EmptyFunctionBody, EmptyFunctionBody, functionBody);
+ FunctionBody functionBody = ParserTestCase.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], "{ {} }");
- EngineTestCase.assertInstanceOf((obj) => obj is EmptyFunctionBody, EmptyFunctionBody, functionBody);
+ FunctionBody functionBody = ParserTestCase.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;");
- EngineTestCase.assertInstanceOf((obj) => obj is EmptyFunctionBody, EmptyFunctionBody, functionBody);
+ FunctionBody functionBody = ParserTestCase.parse(
+ "parseFunctionBody",
+ <Object>[false, null, false],
+ "=> y;");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is EmptyFunctionBody,
+ EmptyFunctionBody,
+ functionBody);
}
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 = ParserTestCase.parse(
+ "parseFunctionDeclaration",
+ <Object>[commentAndMetadata(comment), null, returnType],
+ "f() {}");
expect(declaration.documentationComment, comment);
expect(declaration.returnType, returnType);
expect(declaration.name, isNotNull);
@@ -6323,7 +8431,10 @@ 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 = ParserTestCase.parse(
+ "parseFunctionDeclaration",
+ <Object>[commentAndMetadata(comment), null, returnType],
+ "get p => 0;");
expect(declaration.documentationComment, comment);
expect(declaration.returnType, returnType);
expect(declaration.name, isNotNull);
@@ -6337,7 +8448,10 @@ 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 = ParserTestCase.parse(
+ "parseFunctionDeclaration",
+ <Object>[commentAndMetadata(comment), null, returnType],
+ "set p(v) {}");
expect(declaration.documentationComment, comment);
expect(declaration.returnType, returnType);
expect(declaration.name, isNotNull);
@@ -6349,12 +8463,15 @@ void''');
}
void test_parseFunctionDeclarationStatement() {
- FunctionDeclarationStatement statement = ParserTestCase.parse4("parseFunctionDeclarationStatement", "void f(int p) => p * 2;");
+ FunctionDeclarationStatement statement = ParserTestCase.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++");
+ FunctionExpression expression =
+ ParserTestCase.parse4("parseFunctionExpression", "(int i) => i++");
expect(expression.body, isNotNull);
expect(expression.parameters, isNotNull);
expect((expression.body as ExpressionFunctionBody).semicolon, isNull);
@@ -6363,7 +8480,10 @@ 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> [commentAndMetadata(comment), null, null, returnType], "get a;");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseGetter",
+ <Object>[commentAndMetadata(comment), null, null, returnType],
+ "get a;");
expect(method.body, isNotNull);
expect(method.documentationComment, comment);
expect(method.externalKeyword, isNull);
@@ -6379,11 +8499,10 @@ 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> [
- commentAndMetadata(comment),
- null,
- staticKeyword,
- returnType], "get a => 42;");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseGetter",
+ <Object>[commentAndMetadata(comment), null, staticKeyword, returnType],
+ "get a => 42;");
expect(method.body, isNotNull);
expect(method.documentationComment, comment);
expect(method.externalKeyword, isNull);
@@ -6396,17 +8515,20 @@ void''');
}
void test_parseIdentifierList_multiple() {
- List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", "a, b, c");
+ List<SimpleIdentifier> list =
+ ParserTestCase.parse4("parseIdentifierList", "a, b, c");
expect(list, hasLength(3));
}
void test_parseIdentifierList_single() {
- List<SimpleIdentifier> list = ParserTestCase.parse4("parseIdentifierList", "a");
+ List<SimpleIdentifier> list =
+ ParserTestCase.parse4("parseIdentifierList", "a");
expect(list, hasLength(1));
}
void test_parseIfStatement_else_block() {
- IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) {} else {}");
+ IfStatement statement =
+ ParserTestCase.parse4("parseIfStatement", "if (x) {} else {}");
expect(statement.ifKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -6417,7 +8539,8 @@ void''');
}
void test_parseIfStatement_else_statement() {
- IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) f(x); else f(y);");
+ IfStatement statement =
+ ParserTestCase.parse4("parseIfStatement", "if (x) f(x); else f(y);");
expect(statement.ifKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -6428,7 +8551,8 @@ void''');
}
void test_parseIfStatement_noElse_block() {
- IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) {}");
+ IfStatement statement =
+ ParserTestCase.parse4("parseIfStatement", "if (x) {}");
expect(statement.ifKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -6439,7 +8563,8 @@ void''');
}
void test_parseIfStatement_noElse_statement() {
- IfStatement statement = ParserTestCase.parse4("parseIfStatement", "if (x) f(x);");
+ IfStatement statement =
+ ParserTestCase.parse4("parseIfStatement", "if (x) f(x);");
expect(statement.ifKeyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -6450,19 +8575,24 @@ void''');
}
void test_parseImplementsClause_multiple() {
- ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "implements A, B, C");
+ ImplementsClause clause =
+ ParserTestCase.parse4("parseImplementsClause", "implements A, B, C");
expect(clause.interfaces, hasLength(3));
expect(clause.keyword, isNotNull);
}
void test_parseImplementsClause_single() {
- ImplementsClause clause = ParserTestCase.parse4("parseImplementsClause", "implements A");
+ ImplementsClause clause =
+ ParserTestCase.parse4("parseImplementsClause", "implements A");
expect(clause.interfaces, hasLength(1));
expect(clause.keyword, isNotNull);
}
void test_parseImportDirective_deferred() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart' deferred as a;");
+ ImportDirective directive = ParserTestCase.parse(
+ "parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' deferred as a;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredToken, isNotNull);
@@ -6473,7 +8603,10 @@ void''');
}
void test_parseImportDirective_hide() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart' hide A, B;");
+ ImportDirective directive = ParserTestCase.parse(
+ "parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' hide A, B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredToken, isNull);
@@ -6484,7 +8617,10 @@ void''');
}
void test_parseImportDirective_noCombinator() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart';");
+ ImportDirective directive = ParserTestCase.parse(
+ "parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart';");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredToken, isNull);
@@ -6495,7 +8631,10 @@ void''');
}
void test_parseImportDirective_prefix() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a;");
+ ImportDirective directive = ParserTestCase.parse(
+ "parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' as a;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredToken, isNull);
@@ -6506,7 +8645,10 @@ 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 = ParserTestCase.parse(
+ "parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' as a hide A show B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredToken, isNull);
@@ -6517,7 +8659,10 @@ 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 = ParserTestCase.parse(
+ "parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' as a show B hide A;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredToken, isNull);
@@ -6528,7 +8673,10 @@ void''');
}
void test_parseImportDirective_show() {
- ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart' show A, B;");
+ ImportDirective directive = ParserTestCase.parse(
+ "parseImportDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "import 'lib/lib.dart' show A, B;");
expect(directive.keyword, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.deferredToken, isNull);
@@ -6542,11 +8690,10 @@ 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> [
- commentAndMetadata(comment),
- staticKeyword,
- null,
- type], "a = 1, b, c = 3;");
+ FieldDeclaration declaration = ParserTestCase.parse(
+ "parseInitializedIdentifierList",
+ <Object>[commentAndMetadata(comment), staticKeyword, null, type],
+ "a = 1, b, c = 3;");
expect(declaration.documentationComment, comment);
VariableDeclarationList fields = declaration.fields;
expect(fields, isNotNull);
@@ -6561,11 +8708,10 @@ 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> [
- commentAndMetadata(comment),
- staticKeyword,
- varKeyword,
- null], "a = 1, b, c = 3;");
+ FieldDeclaration declaration = ParserTestCase.parse(
+ "parseInitializedIdentifierList",
+ <Object>[commentAndMetadata(comment), staticKeyword, varKeyword, null],
+ "a = 1, b, c = 3;");
expect(declaration.documentationComment, comment);
VariableDeclarationList fields = declaration.fields;
expect(fields, isNotNull);
@@ -6578,7 +8724,10 @@ void''');
void test_parseInstanceCreationExpression_qualifiedType() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceCreationExpression", <Object> [token], "A.B()");
+ InstanceCreationExpression expression = ParserTestCase.parse(
+ "parseInstanceCreationExpression",
+ <Object>[token],
+ "A.B()");
expect(expression.keyword, token);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -6590,7 +8739,10 @@ void''');
void test_parseInstanceCreationExpression_qualifiedType_named() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceCreationExpression", <Object> [token], "A.B.c()");
+ InstanceCreationExpression expression = ParserTestCase.parse(
+ "parseInstanceCreationExpression",
+ <Object>[token],
+ "A.B.c()");
expect(expression.keyword, token);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -6602,7 +8754,10 @@ void''');
void test_parseInstanceCreationExpression_type() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceCreationExpression", <Object> [token], "A()");
+ InstanceCreationExpression expression = ParserTestCase.parse(
+ "parseInstanceCreationExpression",
+ <Object>[token],
+ "A()");
expect(expression.keyword, token);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -6614,7 +8769,10 @@ void''');
void test_parseInstanceCreationExpression_type_named() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceCreationExpression", <Object> [token], "A<B>.c()");
+ InstanceCreationExpression expression = ParserTestCase.parse(
+ "parseInstanceCreationExpression",
+ <Object>[token],
+ "A<B>.c()");
expect(expression.keyword, token);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -6625,7 +8783,10 @@ void''');
}
void test_parseLibraryDirective() {
- LibraryDirective directive = ParserTestCase.parse("parseLibraryDirective", <Object> [emptyCommentAndMetadata()], "library l;");
+ LibraryDirective directive = ParserTestCase.parse(
+ "parseLibraryDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "library l;");
expect(directive.libraryToken, isNotNull);
expect(directive.name, isNotNull);
expect(directive.semicolon, isNotNull);
@@ -6633,20 +8794,23 @@ void''');
void test_parseLibraryIdentifier_multiple() {
String name = "a.b.c";
- LibraryIdentifier identifier = ParserTestCase.parse4("parseLibraryIdentifier", name);
+ LibraryIdentifier identifier =
+ ParserTestCase.parse4("parseLibraryIdentifier", name);
expect(identifier.name, name);
}
void test_parseLibraryIdentifier_single() {
String name = "a";
- LibraryIdentifier identifier = ParserTestCase.parse4("parseLibraryIdentifier", name);
+ LibraryIdentifier identifier =
+ ParserTestCase.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 =
+ ParserTestCase.parse("parseListLiteral", <Object>[token, typeArguments], "[]");
expect(literal.constKeyword, token);
expect(literal.typeArguments, typeArguments);
expect(literal.leftBracket, isNotNull);
@@ -6657,7 +8821,10 @@ 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 = ParserTestCase.parse(
+ "parseListLiteral",
+ <Object>[token, typeArguments],
+ "[ ]");
expect(literal.constKeyword, token);
expect(literal.typeArguments, typeArguments);
expect(literal.leftBracket, isNotNull);
@@ -6666,7 +8833,8 @@ void''');
}
void test_parseListLiteral_multiple() {
- ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [null, null], "[1, 2, 3]");
+ ListLiteral literal =
+ ParserTestCase.parse("parseListLiteral", <Object>[null, null], "[1, 2, 3]");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -6675,7 +8843,8 @@ void''');
}
void test_parseListLiteral_single() {
- ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [null, null], "[1]");
+ ListLiteral literal =
+ ParserTestCase.parse("parseListLiteral", <Object>[null, null], "[1]");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -6684,7 +8853,8 @@ void''');
}
void test_parseListOrMapLiteral_list_noType() {
- ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "[1]");
+ ListLiteral literal =
+ ParserTestCase.parse("parseListOrMapLiteral", <Object>[null], "[1]");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -6693,7 +8863,8 @@ void''');
}
void test_parseListOrMapLiteral_list_type() {
- ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> [1]");
+ ListLiteral literal =
+ ParserTestCase.parse("parseListOrMapLiteral", <Object>[null], "<int> [1]");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNotNull);
expect(literal.leftBracket, isNotNull);
@@ -6702,7 +8873,8 @@ void''');
}
void test_parseListOrMapLiteral_map_noType() {
- MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}");
+ MapLiteral literal =
+ ParserTestCase.parse("parseListOrMapLiteral", <Object>[null], "{'1' : 1}");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -6711,7 +8883,10 @@ void''');
}
void test_parseListOrMapLiteral_map_type() {
- MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}");
+ MapLiteral literal = ParserTestCase.parse(
+ "parseListOrMapLiteral",
+ <Object>[null],
+ "<String, int> {'1' : 1}");
expect(literal.constKeyword, isNull);
expect(literal.typeArguments, isNotNull);
expect(literal.leftBracket, isNotNull);
@@ -6720,7 +8895,8 @@ void''');
}
void test_parseLogicalAndExpression() {
- BinaryExpression expression = ParserTestCase.parse4("parseLogicalAndExpression", "x && y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseLogicalAndExpression", "x && y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.AMPERSAND_AMPERSAND);
@@ -6728,7 +8904,8 @@ void''');
}
void test_parseLogicalOrExpression() {
- BinaryExpression expression = ParserTestCase.parse4("parseLogicalOrExpression", "x || y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseLogicalOrExpression", "x || y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.BAR_BAR);
@@ -6737,10 +8914,10 @@ void''');
void test_parseMapLiteral_empty() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
- TypeArgumentList typeArguments = AstFactory.typeArgumentList([
- AstFactory.typeName4("String"),
- AstFactory.typeName4("int")]);
- MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token, typeArguments], "{}");
+ TypeArgumentList typeArguments = AstFactory.typeArgumentList(
+ [AstFactory.typeName4("String"), AstFactory.typeName4("int")]);
+ MapLiteral literal =
+ ParserTestCase.parse("parseMapLiteral", <Object>[token, typeArguments], "{}");
expect(literal.constKeyword, token);
expect(literal.typeArguments, typeArguments);
expect(literal.leftBracket, isNotNull);
@@ -6749,35 +8926,42 @@ void''');
}
void test_parseMapLiteral_multiple() {
- MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}");
+ MapLiteral literal = ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseMapLiteralEntry", "'x' : y");
expect(entry.key, isNotNull);
expect(entry.separator, isNotNull);
expect(entry.value, isNotNull);
@@ -6819,7 +9003,8 @@ void''');
}
void test_parseMultiplicativeExpression_normal() {
- BinaryExpression expression = ParserTestCase.parse4("parseMultiplicativeExpression", "x * y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseMultiplicativeExpression", "x * y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.STAR);
@@ -6827,15 +9012,20 @@ void''');
}
void test_parseMultiplicativeExpression_super() {
- BinaryExpression expression = ParserTestCase.parse4("parseMultiplicativeExpression", "super * y");
- EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression, SuperExpression, expression.leftOperand);
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseMultiplicativeExpression", "super * y");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is SuperExpression,
+ SuperExpression,
+ expression.leftOperand);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.STAR);
expect(expression.rightOperand, isNotNull);
}
void test_parseNewExpression() {
- InstanceCreationExpression expression = ParserTestCase.parse4("parseNewExpression", "new A()");
+ InstanceCreationExpression expression =
+ ParserTestCase.parse4("parseNewExpression", "new A()");
expect(expression.keyword, isNotNull);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
@@ -6846,43 +9036,51 @@ void''');
}
void test_parseNonLabeledStatement_const_list_empty() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "const [];");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "const [];");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_list_nonEmpty() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "const [1, 2];");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "const [1, 2];");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_map_empty() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "const {};");
+ ExpressionStatement statement =
+ ParserTestCase.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};");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "const {'a' : 1};");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_object() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "const A();");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "const A();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_const_object_named_typeParameters() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "const A<B>.c();");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "const A<B>.c();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_constructorInvocation() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "new C().m();");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "new C().m();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_false() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "false;");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "false;");
expect(statement.expression, isNotNull);
}
@@ -6899,15 +9097,24 @@ void''');
}
void test_parseNonLabeledStatement_functionInvocation() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "f();");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "f();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_invokeFunctionExpression() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "(a) {return a + a;} (3);");
- EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpressionInvocation, FunctionExpressionInvocation, statement.expression);
- FunctionExpressionInvocation invocation = statement.expression as FunctionExpressionInvocation;
- EngineTestCase.assertInstanceOf((obj) => obj is FunctionExpression, FunctionExpression, invocation.function);
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "(a) {return a + a;} (3);");
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FunctionExpressionInvocation,
+ FunctionExpressionInvocation,
+ statement.expression);
+ FunctionExpressionInvocation invocation =
+ statement.expression as FunctionExpressionInvocation;
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FunctionExpression,
+ FunctionExpression,
+ invocation.function);
FunctionExpression expression = invocation.function as FunctionExpression;
expect(expression.parameters, isNotNull);
expect(expression.body, isNotNull);
@@ -6917,27 +9124,32 @@ void''');
}
void test_parseNonLabeledStatement_null() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "null;");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "null;");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "library.getName();");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "library.getName();");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_true() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "true;");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "true;");
expect(statement.expression, isNotNull);
}
void test_parseNonLabeledStatement_typeCast() {
- ExpressionStatement statement = ParserTestCase.parse4("parseNonLabeledStatement", "double.NAN as num;");
+ ExpressionStatement statement =
+ ParserTestCase.parse4("parseNonLabeledStatement", "double.NAN as num;");
expect(statement.expression, isNotNull);
}
void test_parseNormalFormalParameter_field_const_noType() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "const this.a)");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "const this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -6945,7 +9157,8 @@ void''');
}
void test_parseNormalFormalParameter_field_const_type() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "const A this.a)");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "const A this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -6953,7 +9166,8 @@ void''');
}
void test_parseNormalFormalParameter_field_final_noType() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "final this.a)");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "final this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -6961,7 +9175,8 @@ void''');
}
void test_parseNormalFormalParameter_field_final_type() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "final A this.a)");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "final A this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -6969,7 +9184,8 @@ void''');
}
void test_parseNormalFormalParameter_field_function_nested() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "this.a(B b))");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "this.a(B b))");
expect(parameter.keyword, isNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -6979,7 +9195,8 @@ void''');
}
void test_parseNormalFormalParameter_field_function_noNested() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "this.a())");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "this.a())");
expect(parameter.keyword, isNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -6989,7 +9206,8 @@ void''');
}
void test_parseNormalFormalParameter_field_noType() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "this.a)");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "this.a)");
expect(parameter.keyword, isNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -6997,7 +9215,8 @@ void''');
}
void test_parseNormalFormalParameter_field_type() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "A this.a)");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "A this.a)");
expect(parameter.keyword, isNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -7005,7 +9224,8 @@ void''');
}
void test_parseNormalFormalParameter_field_var() {
- FieldFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "var this.a)");
+ FieldFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "var this.a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
@@ -7013,63 +9233,72 @@ void''');
}
void test_parseNormalFormalParameter_function_noType() {
- FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "a())");
+ FunctionTypedFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "a())");
expect(parameter.returnType, isNull);
expect(parameter.identifier, isNotNull);
expect(parameter.parameters, isNotNull);
}
void test_parseNormalFormalParameter_function_type() {
- FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "A a())");
+ FunctionTypedFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "A a())");
expect(parameter.returnType, isNotNull);
expect(parameter.identifier, isNotNull);
expect(parameter.parameters, isNotNull);
}
void test_parseNormalFormalParameter_function_void() {
- FunctionTypedFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "void a())");
+ FunctionTypedFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "void a())");
expect(parameter.returnType, isNotNull);
expect(parameter.identifier, isNotNull);
expect(parameter.parameters, isNotNull);
}
void test_parseNormalFormalParameter_simple_const_noType() {
- SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "const a)");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "const a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
}
void test_parseNormalFormalParameter_simple_const_type() {
- SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "const A a)");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "const A a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
}
void test_parseNormalFormalParameter_simple_final_noType() {
- SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "final a)");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "final a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
}
void test_parseNormalFormalParameter_simple_final_type() {
- SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "final A a)");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "final A a)");
expect(parameter.keyword, isNotNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
}
void test_parseNormalFormalParameter_simple_noType() {
- SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "a)");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "a)");
expect(parameter.keyword, isNull);
expect(parameter.type, isNull);
expect(parameter.identifier, isNotNull);
}
void test_parseNormalFormalParameter_simple_type() {
- SimpleFormalParameter parameter = ParserTestCase.parse4("parseNormalFormalParameter", "A a)");
+ SimpleFormalParameter parameter =
+ ParserTestCase.parse4("parseNormalFormalParameter", "A a)");
expect(parameter.keyword, isNull);
expect(parameter.type, isNotNull);
expect(parameter.identifier, isNotNull);
@@ -7078,7 +9307,10 @@ 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> [commentAndMetadata(comment), null, returnType], "operator +(A a);");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseOperator",
+ <Object>[commentAndMetadata(comment), null, returnType],
+ "operator +(A a);");
expect(method.body, isNotNull);
expect(method.documentationComment, comment);
expect(method.externalKeyword, isNull);
@@ -7095,14 +9327,20 @@ void''');
}
void test_parsePartDirective_part() {
- PartDirective directive = ParserTestCase.parse("parsePartDirective", <Object> [emptyCommentAndMetadata()], "part 'lib/lib.dart';");
+ PartDirective directive = ParserTestCase.parse(
+ "parsePartDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "part 'lib/lib.dart';");
expect(directive.partToken, isNotNull);
expect(directive.uri, isNotNull);
expect(directive.semicolon, isNotNull);
}
void test_parsePartDirective_partOf() {
- PartOfDirective directive = ParserTestCase.parse("parsePartDirective", <Object> [emptyCommentAndMetadata()], "part of l;");
+ PartOfDirective directive = ParserTestCase.parse(
+ "parsePartDirective",
+ <Object>[emptyCommentAndMetadata()],
+ "part of l;");
expect(directive.partToken, isNotNull);
expect(directive.ofToken, isNotNull);
expect(directive.libraryName, isNotNull);
@@ -7110,104 +9348,120 @@ void''');
}
void test_parsePostfixExpression_decrement() {
- PostfixExpression expression = ParserTestCase.parse4("parsePostfixExpression", "i--");
+ PostfixExpression expression =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parsePrefixedIdentifier", lexeme);
expect(identifier.prefix.name, "foo");
expect(identifier.period, isNotNull);
expect(identifier.identifier.name, "bar");
}
void test_parsePrimaryExpression_const() {
- InstanceCreationExpression expression = ParserTestCase.parse4("parsePrimaryExpression", "const A()");
+ InstanceCreationExpression expression =
+ ParserTestCase.parse4("parsePrimaryExpression", "const A()");
expect(expression, isNotNull);
}
void test_parsePrimaryExpression_double() {
String doubleLiteral = "3.2e4";
- DoubleLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", doubleLiteral);
+ DoubleLiteral literal =
+ ParserTestCase.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 =
+ ParserTestCase.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");
+ FunctionExpression expression =
+ ParserTestCase.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");
+ FunctionExpression expression =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parsePrimaryExpression", "a");
expect(identifier, isNotNull);
}
void test_parsePrimaryExpression_int() {
String intLiteral = "472";
- IntegerLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", intLiteral);
+ IntegerLiteral literal =
+ ParserTestCase.parse4("parsePrimaryExpression", intLiteral);
expect(literal.literal, isNotNull);
expect(literal.value, int.parse(intLiteral));
}
void test_parsePrimaryExpression_listLiteral() {
- ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "[ ]");
+ ListLiteral literal =
+ ParserTestCase.parse4("parsePrimaryExpression", "[ ]");
expect(literal, isNotNull);
}
@@ -7217,7 +9471,8 @@ void''');
}
void test_parsePrimaryExpression_listLiteral_typed() {
- ListLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A>[ ]");
+ ListLiteral literal =
+ ParserTestCase.parse4("parsePrimaryExpression", "<A>[ ]");
expect(literal.typeArguments, isNotNull);
expect(literal.typeArguments.arguments, hasLength(1));
}
@@ -7228,49 +9483,57 @@ void''');
}
void test_parsePrimaryExpression_mapLiteral_typed() {
- MapLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "<A, B>{}");
+ MapLiteral literal =
+ ParserTestCase.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()");
+ InstanceCreationExpression expression =
+ ParserTestCase.parse4("parsePrimaryExpression", "new A()");
expect(expression, isNotNull);
}
void test_parsePrimaryExpression_null() {
- NullLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "null");
+ NullLiteral literal =
+ ParserTestCase.parse4("parsePrimaryExpression", "null");
expect(literal.literal, isNotNull);
}
void test_parsePrimaryExpression_parenthesized() {
- ParenthesizedExpression expression = ParserTestCase.parse4("parsePrimaryExpression", "(x)");
+ ParenthesizedExpression expression =
+ ParserTestCase.parse4("parsePrimaryExpression", "(x)");
expect(expression, isNotNull);
}
void test_parsePrimaryExpression_string() {
- SimpleStringLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "\"string\"");
+ SimpleStringLiteral literal =
+ ParserTestCase.parse4("parsePrimaryExpression", "\"string\"");
expect(literal.isMultiline, isFalse);
expect(literal.isRaw, isFalse);
expect(literal.value, "string");
}
void test_parsePrimaryExpression_string_multiline() {
- SimpleStringLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "'''string'''");
+ SimpleStringLiteral literal =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parsePrimaryExpression", "super.x");
expect(propertyAccess.target is SuperExpression, isTrue);
expect(propertyAccess.operator, isNotNull);
expect(propertyAccess.operator.type, TokenType.PERIOD);
@@ -7278,12 +9541,14 @@ void''');
}
void test_parsePrimaryExpression_this() {
- ThisExpression expression = ParserTestCase.parse4("parsePrimaryExpression", "this");
+ ThisExpression expression =
+ ParserTestCase.parse4("parsePrimaryExpression", "this");
expect(expression.keyword, isNotNull);
}
void test_parsePrimaryExpression_true() {
- BooleanLiteral literal = ParserTestCase.parse4("parsePrimaryExpression", "true");
+ BooleanLiteral literal =
+ ParserTestCase.parse4("parsePrimaryExpression", "true");
expect(literal.literal, isNotNull);
expect(literal.value, isTrue);
}
@@ -7293,7 +9558,8 @@ void''');
}
void test_parseRedirectingConstructorInvocation_named() {
- RedirectingConstructorInvocation invocation = ParserTestCase.parse4("parseRedirectingConstructorInvocation", "this.a()");
+ RedirectingConstructorInvocation invocation =
+ ParserTestCase.parse4("parseRedirectingConstructorInvocation", "this.a()");
expect(invocation.argumentList, isNotNull);
expect(invocation.constructorName, isNotNull);
expect(invocation.keyword, isNotNull);
@@ -7301,7 +9567,8 @@ void''');
}
void test_parseRedirectingConstructorInvocation_unnamed() {
- RedirectingConstructorInvocation invocation = ParserTestCase.parse4("parseRedirectingConstructorInvocation", "this()");
+ RedirectingConstructorInvocation invocation =
+ ParserTestCase.parse4("parseRedirectingConstructorInvocation", "this()");
expect(invocation.argumentList, isNotNull);
expect(invocation.constructorName, isNull);
expect(invocation.keyword, isNotNull);
@@ -7309,14 +9576,16 @@ void''');
}
void test_parseRelationalExpression_as() {
- AsExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x as Y");
+ AsExpression expression =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseRelationalExpression", "x is y");
expect(expression.expression, isNotNull);
expect(expression.isOperator, isNotNull);
expect(expression.notOperator, isNull);
@@ -7324,7 +9593,8 @@ void''');
}
void test_parseRelationalExpression_isNot() {
- IsExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x is! y");
+ IsExpression expression =
+ ParserTestCase.parse4("parseRelationalExpression", "x is! y");
expect(expression.expression, isNotNull);
expect(expression.isOperator, isNotNull);
expect(expression.notOperator, isNotNull);
@@ -7332,7 +9602,8 @@ void''');
}
void test_parseRelationalExpression_normal() {
- BinaryExpression expression = ParserTestCase.parse4("parseRelationalExpression", "x < y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseRelationalExpression", "x < y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.LT);
@@ -7340,7 +9611,8 @@ void''');
}
void test_parseRelationalExpression_super() {
- BinaryExpression expression = ParserTestCase.parse4("parseRelationalExpression", "super < y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseRelationalExpression", "super < y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.LT);
@@ -7348,19 +9620,22 @@ void''');
}
void test_parseRethrowExpression() {
- RethrowExpression expression = ParserTestCase.parse4("parseRethrowExpression", "rethrow;");
+ RethrowExpression expression =
+ ParserTestCase.parse4("parseRethrowExpression", "rethrow;");
expect(expression.keyword, isNotNull);
}
void test_parseReturnStatement_noValue() {
- ReturnStatement statement = ParserTestCase.parse4("parseReturnStatement", "return;");
+ ReturnStatement statement =
+ ParserTestCase.parse4("parseReturnStatement", "return;");
expect(statement.keyword, isNotNull);
expect(statement.expression, isNull);
expect(statement.semicolon, isNotNull);
}
void test_parseReturnStatement_value() {
- ReturnStatement statement = ParserTestCase.parse4("parseReturnStatement", "return x;");
+ ReturnStatement statement =
+ ParserTestCase.parse4("parseReturnStatement", "return x;");
expect(statement.keyword, isNotNull);
expect(statement.expression, isNotNull);
expect(statement.semicolon, isNotNull);
@@ -7381,7 +9656,10 @@ 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> [commentAndMetadata(comment), null, null, returnType], "set a(var x);");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseSetter",
+ <Object>[commentAndMetadata(comment), null, null, returnType],
+ "set a(var x);");
expect(method.body, isNotNull);
expect(method.documentationComment, comment);
expect(method.externalKeyword, isNull);
@@ -7397,11 +9675,10 @@ 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> [
- commentAndMetadata(comment),
- null,
- staticKeyword,
- returnType], "set a(var x) {}");
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseSetter",
+ <Object>[commentAndMetadata(comment), null, staticKeyword, returnType],
+ "set a(var x) {}");
expect(method.body, isNotNull);
expect(method.documentationComment, comment);
expect(method.externalKeyword, isNull);
@@ -7414,7 +9691,8 @@ void''');
}
void test_parseShiftExpression_normal() {
- BinaryExpression expression = ParserTestCase.parse4("parseShiftExpression", "x << y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseShiftExpression", "x << y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.LT_LT);
@@ -7422,39 +9700,44 @@ void''');
}
void test_parseShiftExpression_super() {
- BinaryExpression expression = ParserTestCase.parse4("parseShiftExpression", "super << y");
+ BinaryExpression expression =
+ ParserTestCase.parse4("parseShiftExpression", "super << y");
expect(expression.leftOperand, isNotNull);
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.LT_LT);
expect(expression.rightOperand, isNotNull);
}
+ void test_parseSimpleIdentifier1_normalIdentifier() {
+ // TODO(brianwilkerson) Implement tests for this method.
+ }
+
void test_parseSimpleIdentifier_builtInIdentifier() {
String lexeme = "as";
- SimpleIdentifier identifier = ParserTestCase.parse4("parseSimpleIdentifier", lexeme);
+ SimpleIdentifier identifier =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseSimpleIdentifier", lexeme);
expect(identifier.token, isNotNull);
expect(identifier.name, lexeme);
}
- void test_parseSimpleIdentifier1_normalIdentifier() {
- // TODO(brianwilkerson) Implement tests for this method.
- }
-
void test_parseStatement_functionDeclaration() {
// TODO(brianwilkerson) Implement more tests for this method.
- FunctionDeclarationStatement statement = ParserTestCase.parse4("parseStatement", "int f(a, b) {};");
+ FunctionDeclarationStatement statement =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseStatement", "l: m: return x;");
expect(statement.labels, hasLength(2));
expect(statement.statement, isNotNull);
}
@@ -7464,13 +9747,15 @@ void''');
}
void test_parseStatement_singleLabel() {
- LabeledStatement statement = ParserTestCase.parse4("parseStatement", "l: return x;");
+ LabeledStatement statement =
+ ParserTestCase.parse4("parseStatement", "l: return x;");
expect(statement.labels, hasLength(1));
expect(statement.statement, isNotNull);
}
void test_parseStatements_multiple() {
- List<Statement> statements = ParserTestCase.parseStatements("return; return;", 2);
+ List<Statement> statements =
+ ParserTestCase.parseStatements("return; return;", 2);
expect(statements, hasLength(2));
}
@@ -7480,7 +9765,8 @@ void''');
}
void test_parseStringLiteral_adjacent() {
- AdjacentStrings literal = ParserTestCase.parse4("parseStringLiteral", "'a' 'b'");
+ AdjacentStrings literal =
+ ParserTestCase.parse4("parseStringLiteral", "'a' 'b'");
NodeList<StringLiteral> strings = literal.strings;
expect(strings, hasLength(2));
StringLiteral firstString = strings[0];
@@ -7490,7 +9776,8 @@ void''');
}
void test_parseStringLiteral_interpolated() {
- StringInterpolation literal = ParserTestCase.parse4("parseStringLiteral", "'a \${b} c \$this d'");
+ StringInterpolation literal =
+ ParserTestCase.parse4("parseStringLiteral", "'a \${b} c \$this d'");
NodeList<InterpolationElement> elements = literal.elements;
expect(elements, hasLength(5));
expect(elements[0] is InterpolationString, isTrue);
@@ -7501,13 +9788,15 @@ void''');
}
void test_parseStringLiteral_single() {
- SimpleStringLiteral literal = ParserTestCase.parse4("parseStringLiteral", "'a'");
+ SimpleStringLiteral literal =
+ ParserTestCase.parse4("parseStringLiteral", "'a'");
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseSuperConstructorInvocation_named() {
- SuperConstructorInvocation invocation = ParserTestCase.parse4("parseSuperConstructorInvocation", "super.a()");
+ SuperConstructorInvocation invocation =
+ ParserTestCase.parse4("parseSuperConstructorInvocation", "super.a()");
expect(invocation.argumentList, isNotNull);
expect(invocation.constructorName, isNotNull);
expect(invocation.keyword, isNotNull);
@@ -7515,7 +9804,8 @@ void''');
}
void test_parseSuperConstructorInvocation_unnamed() {
- SuperConstructorInvocation invocation = ParserTestCase.parse4("parseSuperConstructorInvocation", "super()");
+ SuperConstructorInvocation invocation =
+ ParserTestCase.parse4("parseSuperConstructorInvocation", "super()");
expect(invocation.argumentList, isNotNull);
expect(invocation.constructorName, isNull);
expect(invocation.keyword, isNotNull);
@@ -7523,7 +9813,9 @@ void''');
}
void test_parseSwitchStatement_case() {
- SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "switch (a) {case 1: return 'I';}");
+ SwitchStatement statement = ParserTestCase.parse4(
+ "parseSwitchStatement",
+ "switch (a) {case 1: return 'I';}");
expect(statement.keyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.expression, isNotNull);
@@ -7534,7 +9826,8 @@ void''');
}
void test_parseSwitchStatement_empty() {
- SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "switch (a) {}");
+ SwitchStatement statement =
+ ParserTestCase.parse4("parseSwitchStatement", "switch (a) {}");
expect(statement.keyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.expression, isNotNull);
@@ -7545,7 +9838,9 @@ void''');
}
void test_parseSwitchStatement_labeledCase() {
- SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "switch (a) {l1: l2: l3: case(1):}");
+ SwitchStatement statement = ParserTestCase.parse4(
+ "parseSwitchStatement",
+ "switch (a) {l1: l2: l3: case(1):}");
expect(statement.keyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.expression, isNotNull);
@@ -7557,7 +9852,9 @@ void''');
}
void test_parseSwitchStatement_labeledStatementInCase() {
- SwitchStatement statement = ParserTestCase.parse4("parseSwitchStatement", "switch (a) {case 0: f(); l1: g(); break;}");
+ SwitchStatement statement = ParserTestCase.parse4(
+ "parseSwitchStatement",
+ "switch (a) {case 0: f(); l1: g(); break;}");
expect(statement.keyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.expression, isNotNull);
@@ -7569,7 +9866,8 @@ void''');
}
void test_parseSymbolLiteral_builtInIdentifier() {
- SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#dynamic.static.abstract");
+ SymbolLiteral literal =
+ ParserTestCase.parse4("parseSymbolLiteral", "#dynamic.static.abstract");
expect(literal.poundSign, isNotNull);
List<Token> components = literal.components;
expect(components, hasLength(3));
@@ -7579,7 +9877,8 @@ void''');
}
void test_parseSymbolLiteral_multiple() {
- SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#a.b.c");
+ SymbolLiteral literal =
+ ParserTestCase.parse4("parseSymbolLiteral", "#a.b.c");
expect(literal.poundSign, isNotNull);
List<Token> components = literal.components;
expect(components, hasLength(3));
@@ -7605,7 +9904,8 @@ void''');
}
void test_parseSymbolLiteral_void() {
- SymbolLiteral literal = ParserTestCase.parse4("parseSymbolLiteral", "#void");
+ SymbolLiteral literal =
+ ParserTestCase.parse4("parseSymbolLiteral", "#void");
expect(literal.poundSign, isNotNull);
List<Token> components = literal.components;
expect(components, hasLength(1));
@@ -7613,19 +9913,22 @@ void''');
}
void test_parseThrowExpression() {
- ThrowExpression expression = ParserTestCase.parse4("parseThrowExpression", "throw x;");
+ ThrowExpression expression =
+ ParserTestCase.parse4("parseThrowExpression", "throw x;");
expect(expression.keyword, isNotNull);
expect(expression.expression, isNotNull);
}
void test_parseThrowExpressionWithoutCascade() {
- ThrowExpression expression = ParserTestCase.parse4("parseThrowExpressionWithoutCascade", "throw x;");
+ ThrowExpression expression =
+ ParserTestCase.parse4("parseThrowExpressionWithoutCascade", "throw x;");
expect(expression.keyword, isNotNull);
expect(expression.expression, isNotNull);
}
void test_parseTryStatement_catch() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e) {}");
+ TryStatement statement =
+ ParserTestCase.parse4("parseTryStatement", "try {} catch (e) {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -7643,7 +9946,9 @@ void''');
}
void test_parseTryStatement_catch_finally() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} catch (e, s) {} finally {}");
+ TryStatement statement = ParserTestCase.parse4(
+ "parseTryStatement",
+ "try {} catch (e, s) {} finally {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -7661,7 +9966,8 @@ void''');
}
void test_parseTryStatement_finally() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} finally {}");
+ TryStatement statement =
+ ParserTestCase.parse4("parseTryStatement", "try {} finally {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
expect(statement.catchClauses, hasLength(0));
@@ -7670,7 +9976,9 @@ void''');
}
void test_parseTryStatement_multiple() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on NPE catch (e) {} on Error {} catch (e) {}");
+ TryStatement statement = ParserTestCase.parse4(
+ "parseTryStatement",
+ "try {} on NPE catch (e) {} on Error {} catch (e) {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
expect(statement.catchClauses, hasLength(3));
@@ -7679,7 +9987,8 @@ void''');
}
void test_parseTryStatement_on() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error {}");
+ TryStatement statement =
+ ParserTestCase.parse4("parseTryStatement", "try {} on Error {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -7697,7 +10006,8 @@ void''');
}
void test_parseTryStatement_on_catch() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {}");
+ TryStatement statement =
+ ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -7715,7 +10025,9 @@ void''');
}
void test_parseTryStatement_on_catch_finally() {
- TryStatement statement = ParserTestCase.parse4("parseTryStatement", "try {} on Error catch (e, s) {} finally {}");
+ TryStatement statement = ParserTestCase.parse4(
+ "parseTryStatement",
+ "try {} on Error catch (e, s) {} finally {}");
expect(statement.tryKeyword, isNotNull);
expect(statement.body, isNotNull);
NodeList<CatchClause> catchClauses = statement.catchClauses;
@@ -7733,7 +10045,10 @@ void''');
}
void test_parseTypeAlias_function_noParameters() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef bool F();");
+ FunctionTypeAlias typeAlias = ParserTestCase.parse(
+ "parseTypeAlias",
+ <Object>[emptyCommentAndMetadata()],
+ "typedef bool F();");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
@@ -7743,7 +10058,10 @@ void''');
}
void test_parseTypeAlias_function_noReturnType() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef F();");
+ FunctionTypeAlias typeAlias = ParserTestCase.parse(
+ "parseTypeAlias",
+ <Object>[emptyCommentAndMetadata()],
+ "typedef F();");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
@@ -7753,7 +10071,10 @@ void''');
}
void test_parseTypeAlias_function_parameterizedReturnType() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef A<B> F();");
+ FunctionTypeAlias typeAlias = ParserTestCase.parse(
+ "parseTypeAlias",
+ <Object>[emptyCommentAndMetadata()],
+ "typedef A<B> F();");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
@@ -7763,7 +10084,10 @@ void''');
}
void test_parseTypeAlias_function_parameters() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef bool F(Object value);");
+ FunctionTypeAlias typeAlias = ParserTestCase.parse(
+ "parseTypeAlias",
+ <Object>[emptyCommentAndMetadata()],
+ "typedef bool F(Object value);");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
@@ -7773,7 +10097,10 @@ void''');
}
void test_parseTypeAlias_function_typeParameters() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef bool F<E>();");
+ FunctionTypeAlias typeAlias = ParserTestCase.parse(
+ "parseTypeAlias",
+ <Object>[emptyCommentAndMetadata()],
+ "typedef bool F<E>();");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
@@ -7783,7 +10110,10 @@ void''');
}
void test_parseTypeAlias_function_voidReturnType() {
- FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef void F();");
+ FunctionTypeAlias typeAlias = ParserTestCase.parse(
+ "parseTypeAlias",
+ <Object>[emptyCommentAndMetadata()],
+ "typedef void F();");
expect(typeAlias.keyword, isNotNull);
expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
@@ -7793,14 +10123,16 @@ void''');
}
void test_parseTypeArgumentList_multiple() {
- TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList", "<int, int, int>");
+ TypeArgumentList argumentList =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseTypeArgumentList", "<A<B>>");
expect(argumentList.leftBracket, isNotNull);
expect(argumentList.arguments, hasLength(1));
TypeName argument = argumentList.arguments[0];
@@ -7812,7 +10144,8 @@ void''');
}
void test_parseTypeArgumentList_single() {
- TypeArgumentList argumentList = ParserTestCase.parse4("parseTypeArgumentList", "<int>");
+ TypeArgumentList argumentList =
+ ParserTestCase.parse4("parseTypeArgumentList", "<int>");
expect(argumentList.leftBracket, isNotNull);
expect(argumentList.arguments, hasLength(1));
expect(argumentList.rightBracket, isNotNull);
@@ -7831,7 +10164,8 @@ void''');
}
void test_parseTypeParameter_bounded() {
- TypeParameter parameter = ParserTestCase.parse4("parseTypeParameter", "A extends B");
+ TypeParameter parameter =
+ ParserTestCase.parse4("parseTypeParameter", "A extends B");
expect(parameter.bound, isNotNull);
expect(parameter.keyword, isNotNull);
expect(parameter.name, isNotNull);
@@ -7845,42 +10179,48 @@ void''');
}
void test_parseTypeParameterList_multiple() {
- TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterList", "<A, B extends C, D>");
+ TypeParameterList parameterList =
+ ParserTestCase.parse4("parseTypeParameterList", "<A, B extends C, D>");
expect(parameterList.leftBracket, isNotNull);
expect(parameterList.rightBracket, isNotNull);
expect(parameterList.typeParameters, hasLength(3));
}
void test_parseTypeParameterList_parameterizedWithTrailingEquals() {
- TypeParameterList parameterList = ParserTestCase.parse4("parseTypeParameterList", "<A extends B<E>>=");
+ TypeParameterList parameterList =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseUnaryExpression", "--super");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS);
Expression innerExpression = expression.operand;
@@ -7893,7 +10233,8 @@ void''');
}
void test_parseUnaryExpression_decrement_super_propertyAccess() {
- PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "--super.x");
+ PrefixExpression expression =
+ ParserTestCase.parse4("parseUnaryExpression", "--super.x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.MINUS_MINUS);
expect(expression.operand, isNotNull);
@@ -7903,14 +10244,16 @@ void''');
}
void test_parseUnaryExpression_increment_normal() {
- PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "++x");
+ PrefixExpression expression =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseUnaryExpression", "++super[0]");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS_PLUS);
expect(expression.operand, isNotNull);
@@ -7920,7 +10263,8 @@ void''');
}
void test_parseUnaryExpression_increment_super_propertyAccess() {
- PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "++super.x");
+ PrefixExpression expression =
+ ParserTestCase.parse4("parseUnaryExpression", "++super.x");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.PLUS_PLUS);
expect(expression.operand, isNotNull);
@@ -7930,112 +10274,144 @@ void''');
}
void test_parseUnaryExpression_minus_normal() {
- PrefixExpression expression = ParserTestCase.parse4("parseUnaryExpression", "-x");
+ PrefixExpression expression =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.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 =
+ ParserTestCase.parse4("parseUnaryExpression", "~super");
expect(expression.operator, isNotNull);
expect(expression.operator.type, TokenType.TILDE);
expect(expression.operand, isNotNull);
}
void test_parseVariableDeclaration_equals() {
- VariableDeclaration declaration = ParserTestCase.parse4("parseVariableDeclaration", "a = b");
+ VariableDeclaration declaration =
+ ParserTestCase.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 =
+ ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.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 = ParserTestCase.parse(
+ "parseVariableDeclarationListAfterMetadata",
+ <Object>[emptyCommentAndMetadata()],
+ "var a");
expect(declarationList.keyword, isNotNull);
expect(declarationList.type, isNull);
expect(declarationList.variables, hasLength(1));
@@ -8043,7 +10419,10 @@ void''');
void test_parseVariableDeclarationListAfterType_type() {
TypeName type = new TypeName(new SimpleIdentifier(null), null);
- VariableDeclarationList declarationList = ParserTestCase.parse("parseVariableDeclarationListAfterType", <Object> [emptyCommentAndMetadata(), null, type], "a");
+ VariableDeclarationList declarationList = ParserTestCase.parse(
+ "parseVariableDeclarationListAfterType",
+ <Object>[emptyCommentAndMetadata(), null, type],
+ "a");
expect(declarationList.keyword, isNull);
expect(declarationList.type, type);
expect(declarationList.variables, hasLength(1));
@@ -8051,14 +10430,20 @@ void''');
void test_parseVariableDeclarationListAfterType_var() {
Token keyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
- VariableDeclarationList declarationList = ParserTestCase.parse("parseVariableDeclarationListAfterType", <Object> [emptyCommentAndMetadata(), keyword, null], "a, b, c");
+ VariableDeclarationList declarationList = ParserTestCase.parse(
+ "parseVariableDeclarationListAfterType",
+ <Object>[emptyCommentAndMetadata(), keyword, null],
+ "a, b, c");
expect(declarationList.keyword, keyword);
expect(declarationList.type, isNull);
expect(declarationList.variables, hasLength(3));
}
void test_parseVariableDeclarationStatementAfterMetadata_multiple() {
- VariableDeclarationStatement statement = ParserTestCase.parse("parseVariableDeclarationStatementAfterMetadata", <Object> [emptyCommentAndMetadata()], "var x, y, z;");
+ VariableDeclarationStatement statement = ParserTestCase.parse(
+ "parseVariableDeclarationStatementAfterMetadata",
+ <Object>[emptyCommentAndMetadata()],
+ "var x, y, z;");
expect(statement.semicolon, isNotNull);
VariableDeclarationList variableList = statement.variables;
expect(variableList, isNotNull);
@@ -8066,7 +10451,10 @@ void''');
}
void test_parseVariableDeclarationStatementAfterMetadata_single() {
- VariableDeclarationStatement statement = ParserTestCase.parse("parseVariableDeclarationStatementAfterMetadata", <Object> [emptyCommentAndMetadata()], "var x;");
+ VariableDeclarationStatement statement = ParserTestCase.parse(
+ "parseVariableDeclarationStatementAfterMetadata",
+ <Object>[emptyCommentAndMetadata()],
+ "var x;");
expect(statement.semicolon, isNotNull);
VariableDeclarationList variableList = statement.variables;
expect(variableList, isNotNull);
@@ -8074,7 +10462,8 @@ void''');
}
void test_parseWhileStatement() {
- WhileStatement statement = ParserTestCase.parse4("parseWhileStatement", "while (x) {}");
+ WhileStatement statement =
+ ParserTestCase.parse4("parseWhileStatement", "while (x) {}");
expect(statement.keyword, isNotNull);
expect(statement.leftParenthesis, isNotNull);
expect(statement.condition, isNotNull);
@@ -8083,7 +10472,8 @@ void''');
}
void test_parseWithClause_multiple() {
- WithClause clause = ParserTestCase.parse4("parseWithClause", "with A, B, C");
+ WithClause clause =
+ ParserTestCase.parse4("parseWithClause", "with A, B, C");
expect(clause.withKeyword, isNotNull);
expect(clause.mixinTypes, hasLength(3));
}
@@ -8095,7 +10485,8 @@ void''');
}
void test_parseYieldStatement_each() {
- YieldStatement statement = ParserTestCase.parse4("parseYieldStatement", "yield* x;");
+ YieldStatement statement =
+ ParserTestCase.parse4("parseYieldStatement", "yield* x;");
expect(statement.yieldKeyword, isNotNull);
expect(statement.star, isNotNull);
expect(statement.expression, isNotNull);
@@ -8103,7 +10494,8 @@ void''');
}
void test_parseYieldStatement_normal() {
- YieldStatement statement = ParserTestCase.parse4("parseYieldStatement", "yield x;");
+ YieldStatement statement =
+ ParserTestCase.parse4("parseYieldStatement", "yield x;");
expect(statement.yieldKeyword, isNotNull);
expect(statement.star, isNull);
expect(statement.expression, isNotNull);
@@ -8228,9 +10620,14 @@ void''');
* @throws Exception if the method could not be invoked or throws an exception
*/
String _computeStringValue(String lexeme, bool first, bool last) {
- AnalysisErrorListener listener = new AnalysisErrorListener_SimpleParserTest_computeStringValue();
+ AnalysisErrorListener listener =
+ new AnalysisErrorListener_SimpleParserTest_computeStringValue();
Parser parser = new Parser(null, listener);
- return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme, first, last], null) as String;
+ return invokeParserMethodImpl(
+ parser,
+ "computeStringValue",
+ <Object>[lexeme, first, last],
+ null) as String;
}
/**
@@ -8243,7 +10640,10 @@ void''');
*/
SimpleIdentifier _createSyntheticIdentifier() {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2("createSyntheticIdentifier", "", listener);
+ return ParserTestCase.invokeParserMethod2(
+ "createSyntheticIdentifier",
+ "",
+ listener);
}
/**
@@ -8256,7 +10656,10 @@ void''');
*/
SimpleStringLiteral _createSyntheticStringLiteral() {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2("createSyntheticStringLiteral", "", listener);
+ return ParserTestCase.invokeParserMethod2(
+ "createSyntheticStringLiteral",
+ "",
+ listener);
}
/**
@@ -8269,7 +10672,10 @@ void''');
*/
bool _isFunctionDeclaration(String source) {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2("isFunctionDeclaration", source, listener) as bool;
+ return ParserTestCase.invokeParserMethod2(
+ "isFunctionDeclaration",
+ source,
+ listener) as bool;
}
/**
@@ -8285,13 +10691,18 @@ void''');
//
// Scan the source.
//
- Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener);
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
Token tokenStream = scanner.tokenize();
//
// 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;
}
/**
@@ -8304,7 +10715,10 @@ void''');
*/
bool _isInitializedVariableDeclaration(String source) {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2("isInitializedVariableDeclaration", source, listener) as bool;
+ return ParserTestCase.invokeParserMethod2(
+ "isInitializedVariableDeclaration",
+ source,
+ listener) as bool;
}
/**
@@ -8317,7 +10731,10 @@ void''');
*/
bool _isSwitchMember(String source) {
GatheringErrorListener listener = new GatheringErrorListener();
- return ParserTestCase.invokeParserMethod2("isSwitchMember", source, listener) as bool;
+ return ParserTestCase.invokeParserMethod2(
+ "isSwitchMember",
+ source,
+ listener) as bool;
}
/**
@@ -8329,9 +10746,11 @@ void''');
* @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`
*/
- CompilationUnit _parseDirectives(String source, [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
+ CompilationUnit _parseDirectives(String source, [List<ErrorCode> errorCodes =
+ ErrorCode.EMPTY_LIST]) {
GatheringErrorListener listener = new GatheringErrorListener();
- Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener);
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
listener.setLineInfo(new TestSource(), scanner.lineStarts);
Token token = scanner.tokenize();
Parser parser = new Parser(null, listener);
@@ -8357,23 +10776,17 @@ void''');
//
// Scan the source.
//
- Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener);
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
Token tokenStream = scanner.tokenize();
//
// Parse the source.
//
Parser parser = new Parser(null, listener);
- return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], tokenStream) as Token;
+ return invokeParserMethodImpl(
+ parser,
+ methodName,
+ <Object>[tokenStream],
+ tokenStream) as Token;
}
}
-
-main() {
- groupSep = ' | ';
- runReflectiveTests(ComplexParserTest);
- runReflectiveTests(ErrorParserTest);
- runReflectiveTests(IncrementalParserTest);
- runReflectiveTests(NonErrorParserTest);
- runReflectiveTests(RecoveryParserTest);
- runReflectiveTests(ResolutionCopierTest);
- runReflectiveTests(SimpleParserTest);
-}
« no previous file with comments | « pkg/analyzer/test/generated/non_error_resolver_test.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698