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

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

Issue 881403002: Fix for issue 22052 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ac43b31cb2ca71109d7e8a9f231abf6b6855cbbc..82cb665e7cce3c24e2146d865065fa1c3a317282 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -5165,6 +5165,39 @@ class ResolutionCopierTest extends EngineTestCase {
*/
@reflectiveTest
class SimpleParserTest extends ParserTestCase {
+ void fail_parseAwaitExpression_inSync() {
+ // This test requires better error recovery than we currently have. In
+ // particular, we need to be able to distinguish between an await expression
+ // in the wrong context, and the use of 'await' as an identifier.
+ MethodDeclaration method = ParserTestCase.parse(
+ "parseClassMember",
+ <Object>["C"],
+ "m() { return await x + await y; }");
+ FunctionBody body = method.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);
+ 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);
+ }
+
void fail_parseCommentReference_this() {
// This fails because we are returning null from the method and asserting
// that the return value is not null.
@@ -5762,36 +5795,6 @@ class SimpleParserTest extends ParserTestCase {
statement);
}
- void test_parseAwaitExpression_inSync() {
- 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);
- Statement statement = (body as BlockFunctionBody).block.statements[0];
- 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);
- }
-
void test_parseBitwiseAndExpression_normal() {
BinaryExpression expression =
ParserTestCase.parse4("parseBitwiseAndExpression", "x & y");
@@ -7844,6 +7847,11 @@ void''');
expect(list.arguments, hasLength(1));
}
+ void test_parseExpression_nonAwait() {
+ MethodInvocation expression = ParserTestCase.parseExpression("await()");
+ expect(expression.methodName.name, 'await');
+ }
+
void test_parseExpression_superMethodInvocation() {
MethodInvocation invocation =
ParserTestCase.parse4("parseExpression", "super.m()");

Powered by Google App Engine
This is Rietveld 408576698