mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
[parser] More recovery of await in non-async context
Fixes https://github.com/dart-lang/sdk/issues/49116 Change-Id: I6b3f4bd88b17da5703dc268df413b3e5bb2e7d87 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249605 Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
parent
68fc59b2a1
commit
183863e5bf
15 changed files with 3749 additions and 39 deletions
|
@ -5015,7 +5015,7 @@ class Parser {
|
|||
if (optional(':', token.next!.next!)) {
|
||||
return parseLabeledStatement(token);
|
||||
}
|
||||
if (looksLikeYieldStatement(token)) {
|
||||
if (looksLikeYieldStatement(token, AwaitOrYieldContext.Statement)) {
|
||||
// Recovery: looks like an expression preceded by `yield` but not
|
||||
// inside an Async or AsyncStar context. parseYieldStatement will
|
||||
// report the error.
|
||||
|
@ -5035,7 +5035,7 @@ class Parser {
|
|||
return parseExpressionStatementOrConstDeclaration(token);
|
||||
} else if (identical(value, 'await')) {
|
||||
if (inPlainSync) {
|
||||
if (!looksLikeAwaitExpression(token)) {
|
||||
if (!looksLikeAwaitExpression(token, AwaitOrYieldContext.Statement)) {
|
||||
return parseExpressionStatementOrDeclaration(token);
|
||||
}
|
||||
// Recovery: looks like an expression preceded by `await`
|
||||
|
@ -5648,7 +5648,8 @@ class Parser {
|
|||
// Prefix:
|
||||
if (identical(value, 'await')) {
|
||||
if (inPlainSync) {
|
||||
if (!looksLikeAwaitExpression(token)) {
|
||||
if (!looksLikeAwaitExpression(
|
||||
token, AwaitOrYieldContext.UnaryExpression)) {
|
||||
return parsePrimary(token, IdentifierContext.expression);
|
||||
}
|
||||
// Recovery: Looks like an expression preceded by `await`.
|
||||
|
@ -7562,7 +7563,8 @@ class Parser {
|
|||
|
||||
/// Determine if the following tokens look like an expression and not a local
|
||||
/// variable or local function declaration.
|
||||
bool looksLikeExpression(Token token) {
|
||||
bool looksLikeExpressionAfterAwaitOrYield(
|
||||
Token token, AwaitOrYieldContext context) {
|
||||
// TODO(srawlins): Consider parsing the potential expression once doing so
|
||||
// does not modify the token stream. For now, use simple look ahead and
|
||||
// ensure no false positives.
|
||||
|
@ -7572,14 +7574,36 @@ class Parser {
|
|||
token = token.next!;
|
||||
if (optional('(', token)) {
|
||||
token = token.endGroup!.next!;
|
||||
if (isOneOf(token, [';', '.', '..', '?', '?.'])) {
|
||||
if (isOneOf(token, const [';', '.', ',', '..', '?', '?.', ')'])) {
|
||||
// E.g. (in a non-async function): `await f();`.
|
||||
return true;
|
||||
} else if (token.type.isBinaryOperator) {
|
||||
// E.g. (in a non-async function):
|
||||
// `await returnsFuture() + await returnsFuture()`.
|
||||
return true;
|
||||
}
|
||||
} else if (isOneOf(token, ['.', ')', ']'])) {
|
||||
} else if (isOneOf(token, const ['.', ')', ']'])) {
|
||||
// TODO(srawlins): Also consider when `token` is `;`. There is still not
|
||||
// good error recovery on `yield x;`. This would also require
|
||||
// modification to analyzer's
|
||||
// test_parseCompilationUnit_pseudo_asTypeName.
|
||||
|
||||
// E.g. (in a non-async function): `if (await f) {}`.
|
||||
return true;
|
||||
} else if (optional(',', token) &&
|
||||
context == AwaitOrYieldContext.UnaryExpression) {
|
||||
// E.g. (in a non-async function): `xor(await f, await f, await f);`,
|
||||
// but not `await y, z` (`await` is a class here so it's declaring two
|
||||
// variables).
|
||||
return true;
|
||||
} else if (token.type.isBinaryOperator) {
|
||||
// E.g. (in a non-async function): (first part of) `await f + await f;`,
|
||||
return true;
|
||||
} else if (optional(';', token) &&
|
||||
context == AwaitOrYieldContext.UnaryExpression) {
|
||||
// E.g. (in a non-async function): (second part of) `await f + await f;`
|
||||
// but not `await f;` (`await` is a class here so it's a variable
|
||||
// declaration).
|
||||
return true;
|
||||
}
|
||||
} else if (token == Keyword.NULL) {
|
||||
|
@ -7596,20 +7620,20 @@ class Parser {
|
|||
|
||||
/// Determine if the following tokens look like an 'await' expression
|
||||
/// and not a local variable or local function declaration.
|
||||
bool looksLikeAwaitExpression(Token token) {
|
||||
bool looksLikeAwaitExpression(Token token, AwaitOrYieldContext context) {
|
||||
token = token.next!;
|
||||
assert(optional('await', token));
|
||||
|
||||
return looksLikeExpression(token);
|
||||
return looksLikeExpressionAfterAwaitOrYield(token, context);
|
||||
}
|
||||
|
||||
/// Determine if the following tokens look like a 'yield' expression and not a
|
||||
/// local variable or local function declaration.
|
||||
bool looksLikeYieldStatement(Token token) {
|
||||
bool looksLikeYieldStatement(Token token, AwaitOrYieldContext context) {
|
||||
token = token.next!;
|
||||
assert(optional('yield', token));
|
||||
|
||||
return looksLikeExpression(token);
|
||||
return looksLikeExpressionAfterAwaitOrYield(token, context);
|
||||
}
|
||||
|
||||
/// ```
|
||||
|
@ -8724,3 +8748,5 @@ class Parser {
|
|||
|
||||
// TODO(ahe): Remove when analyzer supports generalized function syntax.
|
||||
typedef _MessageWithArgument<T> = codes.Message Function(T);
|
||||
|
||||
enum AwaitOrYieldContext { Statement, UnaryExpression }
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/src/dart/scanner/scanner.dart';
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
@ -143,8 +144,8 @@ class ClassMemberParserTest extends FastaParserTestCase
|
|||
var method = parser.parseClassMember('C') as MethodDeclaration;
|
||||
expect(method, isNotNull);
|
||||
listener.assertErrors([
|
||||
expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 13, 5),
|
||||
expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 23, 5)
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 13, 5),
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 23, 5)
|
||||
]);
|
||||
FunctionBody body = method.body;
|
||||
expect(body, isBlockFunctionBody);
|
||||
|
@ -152,6 +153,134 @@ class ClassMemberParserTest extends FastaParserTestCase
|
|||
expect(statement, isReturnStatement);
|
||||
Expression expression = (statement as ReturnStatement).expression!;
|
||||
expect(expression, isBinaryExpression);
|
||||
expect((expression as BinaryExpression).leftOperand, isAwaitExpression);
|
||||
expect(expression.rightOperand, isAwaitExpression);
|
||||
}
|
||||
|
||||
void test_parseAwaitExpression_inSync_v1_49116() {
|
||||
createParser('m() { await returnsFuture(); }');
|
||||
var method = parser.parseClassMember('C') as MethodDeclaration;
|
||||
expect(method, isNotNull);
|
||||
listener.assertErrors([
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 6, 5),
|
||||
]);
|
||||
FunctionBody body = method.body;
|
||||
expect(body, isBlockFunctionBody);
|
||||
Statement statement = (body as BlockFunctionBody).block.statements[0];
|
||||
expect(statement, isExpressionStatement);
|
||||
Expression expression = (statement as ExpressionStatement).expression;
|
||||
expect(expression, isAwaitExpression);
|
||||
}
|
||||
|
||||
void test_parseAwaitExpression_inSync_v2_49116() {
|
||||
createParser('''m() {
|
||||
if (await returnsFuture()) {}
|
||||
else if (!await returnsFuture()) {}
|
||||
}''');
|
||||
var method = parser.parseClassMember('C') as MethodDeclaration;
|
||||
expect(method, isNotNull);
|
||||
listener.assertErrors([
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 16, 5),
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 58, 5),
|
||||
]);
|
||||
FunctionBody body = method.body;
|
||||
expect(body, isBlockFunctionBody);
|
||||
Statement statement = (body as BlockFunctionBody).block.statements[0];
|
||||
expect(statement, isIfStatement);
|
||||
Expression expression = (statement as IfStatement).condition;
|
||||
expect(expression, isAwaitExpression);
|
||||
expect(statement.elseStatement, isNotNull);
|
||||
Statement elseStatement = statement.elseStatement!;
|
||||
expect(elseStatement, isIfStatement);
|
||||
expression = (elseStatement as IfStatement).condition;
|
||||
expect(expression, isPrefixExpression);
|
||||
expect((expression as PrefixExpression).operator.lexeme, '!');
|
||||
expression = expression.operand;
|
||||
expect(expression, isAwaitExpression);
|
||||
}
|
||||
|
||||
void test_parseAwaitExpression_inSync_v3_49116() {
|
||||
createParser('m() { print(await returnsFuture()); }');
|
||||
var method = parser.parseClassMember('C') as MethodDeclaration;
|
||||
expect(method, isNotNull);
|
||||
listener.assertErrors([
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 12, 5),
|
||||
]);
|
||||
FunctionBody body = method.body;
|
||||
expect(body, isBlockFunctionBody);
|
||||
Statement statement = (body as BlockFunctionBody).block.statements[0];
|
||||
expect(statement, isExpressionStatement);
|
||||
Expression expression = (statement as ExpressionStatement).expression;
|
||||
expect(expression, isMethodInvocation);
|
||||
expression = (expression as MethodInvocation).argumentList.arguments.single;
|
||||
expect(expression, isAwaitExpression);
|
||||
}
|
||||
|
||||
void test_parseAwaitExpression_inSync_v4_49116() {
|
||||
createParser('''m() {
|
||||
xor(await returnsFuture(), await returnsFuture(), await returnsFuture());
|
||||
}''');
|
||||
var method = parser.parseClassMember('C') as MethodDeclaration;
|
||||
expect(method, isNotNull);
|
||||
listener.assertErrors([
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 16, 5),
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 39, 5),
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 62, 5),
|
||||
]);
|
||||
FunctionBody body = method.body;
|
||||
expect(body, isBlockFunctionBody);
|
||||
Statement statement = (body as BlockFunctionBody).block.statements[0];
|
||||
expect(statement, isExpressionStatement);
|
||||
Expression expression = (statement as ExpressionStatement).expression;
|
||||
expect(expression, isMethodInvocation);
|
||||
expect((expression as MethodInvocation).argumentList.arguments.length, 3);
|
||||
expect(expression.argumentList.arguments[0], isAwaitExpression);
|
||||
expect(expression.argumentList.arguments[1], isAwaitExpression);
|
||||
expect(expression.argumentList.arguments[2], isAwaitExpression);
|
||||
}
|
||||
|
||||
void test_parseAwaitExpression_inSync_v5_49116() {
|
||||
createParser('''m() {
|
||||
await returnsFuture() ^ await returnsFuture();
|
||||
}''');
|
||||
var method = parser.parseClassMember('C') as MethodDeclaration;
|
||||
expect(method, isNotNull);
|
||||
listener.assertErrors([
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 12, 5),
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 36, 5),
|
||||
]);
|
||||
FunctionBody body = method.body;
|
||||
expect(body, isBlockFunctionBody);
|
||||
Statement statement = (body as BlockFunctionBody).block.statements[0];
|
||||
expect(statement, isExpressionStatement);
|
||||
Expression expression = (statement as ExpressionStatement).expression;
|
||||
expect(expression, isBinaryExpression);
|
||||
expect((expression as BinaryExpression).leftOperand, isAwaitExpression);
|
||||
expect(expression.rightOperand, isAwaitExpression);
|
||||
expect(expression.operator.lexeme, '^');
|
||||
}
|
||||
|
||||
void test_parseAwaitExpression_inSync_v6_49116() {
|
||||
createParser('''m() {
|
||||
print(await returnsFuture() ^ await returnsFuture());
|
||||
}''');
|
||||
var method = parser.parseClassMember('C') as MethodDeclaration;
|
||||
expect(method, isNotNull);
|
||||
listener.assertErrors([
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 18, 5),
|
||||
expectedError(CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, 42, 5),
|
||||
]);
|
||||
FunctionBody body = method.body;
|
||||
expect(body, isBlockFunctionBody);
|
||||
Statement statement = (body as BlockFunctionBody).block.statements[0];
|
||||
expect(statement, isExpressionStatement);
|
||||
Expression expression = (statement as ExpressionStatement).expression;
|
||||
expect(expression, isMethodInvocation);
|
||||
expression = (expression as MethodInvocation).argumentList.arguments.single;
|
||||
expect(expression, isBinaryExpression);
|
||||
expect((expression as BinaryExpression).leftOperand, isAwaitExpression);
|
||||
expect(expression.rightOperand, isAwaitExpression);
|
||||
expect(expression.operator.lexeme, '^');
|
||||
}
|
||||
|
||||
void test_parseClassMember_constructor_initializers_conditional() {
|
||||
|
|
|
@ -1002,7 +1002,8 @@ class ForwardingTestListener extends ForwardingListener {
|
|||
@override
|
||||
void endInvalidAwaitExpression(
|
||||
Token beginToken, Token endToken, MessageCode errorCode) {
|
||||
end('InvalidAwaitExpression');
|
||||
// endInvalidAwaitExpression is started by beginAwaitExpression
|
||||
end('AwaitExpression');
|
||||
super.endInvalidAwaitExpression(beginToken, endToken, errorCode);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,7 @@ main() {
|
|||
|
||||
@reflectiveTest
|
||||
class AwaitInWrongContextTest extends PubPackageResolutionTest {
|
||||
@failingTest
|
||||
test_sync() async {
|
||||
// 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.
|
||||
await assertErrorsInCode(r'''
|
||||
f(x) {
|
||||
return await x;
|
||||
|
@ -30,9 +26,6 @@ f(x) {
|
|||
}
|
||||
|
||||
test_syncStar() async {
|
||||
// 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.
|
||||
await assertErrorsInCode(r'''
|
||||
f(x) sync* {
|
||||
yield await x;
|
||||
|
|
|
@ -90,15 +90,15 @@ parseUnit(Future)
|
|||
parseStatement({)
|
||||
parseStatementX({)
|
||||
inPlainSync()
|
||||
looksLikeAwaitExpression({)
|
||||
looksLikeExpression(await)
|
||||
looksLikeAwaitExpression({, AwaitOrYieldContext.Statement)
|
||||
looksLikeExpressionAfterAwaitOrYield(await, AwaitOrYieldContext.Statement)
|
||||
parseExpressionStatement({)
|
||||
parseExpression({)
|
||||
parsePrecedenceExpression({, 1, true)
|
||||
parseUnaryExpression({, true)
|
||||
inPlainSync()
|
||||
looksLikeAwaitExpression({)
|
||||
looksLikeExpression(await)
|
||||
looksLikeAwaitExpression({, AwaitOrYieldContext.UnaryExpression)
|
||||
looksLikeExpressionAfterAwaitOrYield(await, AwaitOrYieldContext.UnaryExpression)
|
||||
parseAwaitExpression({, true)
|
||||
listener: beginAwaitExpression(await)
|
||||
parsePrecedenceExpression(await, 16, true)
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
Future<bool> returnsFuture() => new Future.value(true);
|
||||
|
||||
// Notice the missing async marker.
|
||||
void foo() {
|
||||
await returnsFuture();
|
||||
if (await returnsFuture()) {}
|
||||
else if (!await returnsFuture()) {}
|
||||
print(await returnsFuture());
|
||||
xor(await returnsFuture(), await returnsFuture(), await returnsFuture());
|
||||
await returnsFuture() ^ await returnsFuture();
|
||||
print(await returnsFuture() ^ await returnsFuture());
|
||||
await returnsFuture() + await returnsFuture();
|
||||
print(await returnsFuture() + await returnsFuture());
|
||||
await returnsFuture() - await returnsFuture();
|
||||
print(await returnsFuture() - await returnsFuture());
|
||||
!await returnsFuture() ^ !await returnsFuture();
|
||||
print(!await returnsFuture() ^ !await returnsFuture());
|
||||
|
||||
var f = returnsFuture();
|
||||
await f; // valid variable declaration.
|
||||
if (await f) {}
|
||||
else if (!await f) {}
|
||||
print(await f);
|
||||
xor(await f, await f, await f);
|
||||
await f ^ await f;
|
||||
print(await f ^ await f);
|
||||
await f + await f;
|
||||
print(await f + await f);
|
||||
await f - await f;
|
||||
print(await f - await f);
|
||||
!await f ^ !await f;
|
||||
print(!await f ^ !await f);
|
||||
|
||||
// Valid:
|
||||
await x; // Valid.
|
||||
await y, z; // Valid.
|
||||
await x2 = await; // Valid.
|
||||
await y2 = await, z2 = await; // Valid.
|
||||
await foo(int bar) { // Valid.
|
||||
return new await(); // Valid.
|
||||
} // Valid.
|
||||
await bar(await baz, await baz2, await baz3) { // Valid.
|
||||
return baz; // Valid.
|
||||
} // Valid.
|
||||
}
|
||||
|
||||
bool xor(bool a, bool b, bool c) {
|
||||
return b ^ b ^ c;
|
||||
}
|
||||
|
||||
class await {}
|
|
@ -0,0 +1,978 @@
|
|||
Problems reported:
|
||||
|
||||
parser/error_recovery/issue_49116:5:3: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:6:7: 'await' can only be used in 'async' or 'async*' methods.
|
||||
if (await returnsFuture()) {}
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:7:13: 'await' can only be used in 'async' or 'async*' methods.
|
||||
else if (!await returnsFuture()) {}
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:8:9: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:9:7: 'await' can only be used in 'async' or 'async*' methods.
|
||||
xor(await returnsFuture(), await returnsFuture(), await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:9:30: 'await' can only be used in 'async' or 'async*' methods.
|
||||
xor(await returnsFuture(), await returnsFuture(), await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:9:53: 'await' can only be used in 'async' or 'async*' methods.
|
||||
xor(await returnsFuture(), await returnsFuture(), await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:10:3: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await returnsFuture() ^ await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:10:27: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await returnsFuture() ^ await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:11:9: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await returnsFuture() ^ await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:11:33: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await returnsFuture() ^ await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:12:3: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await returnsFuture() + await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:12:27: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await returnsFuture() + await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:13:9: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await returnsFuture() + await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:13:33: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await returnsFuture() + await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:14:3: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await returnsFuture() - await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:14:27: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await returnsFuture() - await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:15:9: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await returnsFuture() - await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:15:33: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await returnsFuture() - await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:16:4: 'await' can only be used in 'async' or 'async*' methods.
|
||||
!await returnsFuture() ^ !await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:16:29: 'await' can only be used in 'async' or 'async*' methods.
|
||||
!await returnsFuture() ^ !await returnsFuture();
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:17:10: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(!await returnsFuture() ^ !await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:17:35: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(!await returnsFuture() ^ !await returnsFuture());
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:21:7: 'await' can only be used in 'async' or 'async*' methods.
|
||||
if (await f) {}
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:22:13: 'await' can only be used in 'async' or 'async*' methods.
|
||||
else if (!await f) {}
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:23:9: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:24:7: 'await' can only be used in 'async' or 'async*' methods.
|
||||
xor(await f, await f, await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:24:16: 'await' can only be used in 'async' or 'async*' methods.
|
||||
xor(await f, await f, await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:24:25: 'await' can only be used in 'async' or 'async*' methods.
|
||||
xor(await f, await f, await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:25:3: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await f ^ await f;
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:25:13: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await f ^ await f;
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:26:9: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await f ^ await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:26:19: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await f ^ await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:27:3: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await f + await f;
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:27:13: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await f + await f;
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:28:9: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await f + await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:28:19: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await f + await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:29:3: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await f - await f;
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:29:13: 'await' can only be used in 'async' or 'async*' methods.
|
||||
await f - await f;
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:30:9: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await f - await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:30:19: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(await f - await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:31:4: 'await' can only be used in 'async' or 'async*' methods.
|
||||
!await f ^ !await f;
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:31:15: 'await' can only be used in 'async' or 'async*' methods.
|
||||
!await f ^ !await f;
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:32:10: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(!await f ^ !await f);
|
||||
^^^^^
|
||||
|
||||
parser/error_recovery/issue_49116:32:21: 'await' can only be used in 'async' or 'async*' methods.
|
||||
print(!await f ^ !await f);
|
||||
^^^^^
|
||||
|
||||
beginCompilationUnit(Future)
|
||||
beginMetadataStar(Future)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(Future)
|
||||
beginTopLevelMethod(, null, null)
|
||||
handleIdentifier(Future, typeReference)
|
||||
beginTypeArguments(<)
|
||||
handleIdentifier(bool, typeReference)
|
||||
handleNoTypeArguments(>)
|
||||
handleType(bool, null)
|
||||
endTypeArguments(1, <, >)
|
||||
handleType(Future, null)
|
||||
handleIdentifier(returnsFuture, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginNewExpression(new)
|
||||
handleIdentifier(Future, constructorReference)
|
||||
beginConstructorReference(Future)
|
||||
handleIdentifier(value, constructorReferenceContinuation)
|
||||
handleQualified(.)
|
||||
handleNoTypeArguments(()
|
||||
handleNoConstructorReferenceContinuationAfterTypeArguments(()
|
||||
endConstructorReference(Future, null, (, ConstructorReferenceContext.New)
|
||||
beginArguments(()
|
||||
handleLiteralBool(true)
|
||||
endArguments(1, (, ))
|
||||
endNewExpression(new)
|
||||
handleExpressionFunctionBody(=>, ;)
|
||||
endTopLevelMethod(Future, null, ;)
|
||||
endTopLevelDeclaration(void)
|
||||
beginMetadataStar(void)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(void)
|
||||
beginTopLevelMethod(;, null, null)
|
||||
handleVoidKeyword(void)
|
||||
handleIdentifier(foo, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
handleExpressionStatement(;)
|
||||
beginIfStatement(if)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
handleParenthesizedCondition(()
|
||||
beginThenStatement({)
|
||||
beginBlock({, BlockKind(statement))
|
||||
endBlock(0, {, }, BlockKind(statement))
|
||||
endThenStatement(})
|
||||
beginElseStatement(else)
|
||||
beginIfStatement(if)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
handleParenthesizedCondition(()
|
||||
beginThenStatement({)
|
||||
beginBlock({, BlockKind(statement))
|
||||
endBlock(0, {, }, BlockKind(statement))
|
||||
endThenStatement(})
|
||||
endIfStatement(if, null)
|
||||
endElseStatement(else)
|
||||
endIfStatement(if, else)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(xor, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ,)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ,, AwaitNotAsync)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ,)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ,, AwaitNotAsync)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endArguments(3, (, ))
|
||||
handleSend(xor, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ^)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ^, AwaitNotAsync)
|
||||
beginBinaryExpression(^)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
endBinaryExpression(^)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ^)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ^, AwaitNotAsync)
|
||||
beginBinaryExpression(^)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endBinaryExpression(^)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, +)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, +, AwaitNotAsync)
|
||||
beginBinaryExpression(+)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
endBinaryExpression(+)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, +)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, +, AwaitNotAsync)
|
||||
beginBinaryExpression(+)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endBinaryExpression(+)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, -)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, -, AwaitNotAsync)
|
||||
beginBinaryExpression(-)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
endBinaryExpression(-)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, -)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, -, AwaitNotAsync)
|
||||
beginBinaryExpression(-)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endBinaryExpression(-)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ^)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ^, AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
beginBinaryExpression(^)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
endBinaryExpression(^)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ^)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ^, AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
beginBinaryExpression(^)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
endBinaryExpression(^)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginMetadataStar(var)
|
||||
endMetadataStar(0)
|
||||
handleNoType(var)
|
||||
beginVariablesDeclaration(f, null, var)
|
||||
handleIdentifier(f, localVariableDeclaration)
|
||||
beginInitializedIdentifier(f)
|
||||
beginVariableInitializer(=)
|
||||
handleIdentifier(returnsFuture, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
handleSend(returnsFuture, ;)
|
||||
endVariableInitializer(=)
|
||||
endInitializedIdentifier(f)
|
||||
endVariablesDeclaration(1, ;)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(f)
|
||||
handleType(await, null)
|
||||
beginVariablesDeclaration(f, null, null)
|
||||
handleIdentifier(f, localVariableDeclaration)
|
||||
beginInitializedIdentifier(f)
|
||||
handleNoVariableInitializer(f)
|
||||
endInitializedIdentifier(f)
|
||||
endVariablesDeclaration(1, ;)
|
||||
beginIfStatement(if)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(f, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
handleParenthesizedCondition(()
|
||||
beginThenStatement({)
|
||||
beginBlock({, BlockKind(statement))
|
||||
endBlock(0, {, }, BlockKind(statement))
|
||||
endThenStatement(})
|
||||
beginElseStatement(else)
|
||||
beginIfStatement(if)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(f, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
handleParenthesizedCondition(()
|
||||
beginThenStatement({)
|
||||
beginBlock({, BlockKind(statement))
|
||||
endBlock(0, {, }, BlockKind(statement))
|
||||
endThenStatement(})
|
||||
endIfStatement(if, null)
|
||||
endElseStatement(else)
|
||||
endIfStatement(if, else)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(f, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(xor, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(,)
|
||||
handleNoArguments(,)
|
||||
handleSend(f, ,)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ,, AwaitNotAsync)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(,)
|
||||
handleNoArguments(,)
|
||||
handleSend(f, ,)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ,, AwaitNotAsync)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(f, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endArguments(3, (, ))
|
||||
handleSend(xor, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(^)
|
||||
handleNoArguments(^)
|
||||
handleSend(f, ^)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ^, AwaitNotAsync)
|
||||
beginBinaryExpression(^)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(;)
|
||||
handleNoArguments(;)
|
||||
handleSend(f, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
endBinaryExpression(^)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(^)
|
||||
handleNoArguments(^)
|
||||
handleSend(f, ^)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ^, AwaitNotAsync)
|
||||
beginBinaryExpression(^)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(f, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endBinaryExpression(^)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(+)
|
||||
handleNoArguments(+)
|
||||
handleSend(f, +)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, +, AwaitNotAsync)
|
||||
beginBinaryExpression(+)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(;)
|
||||
handleNoArguments(;)
|
||||
handleSend(f, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
endBinaryExpression(+)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(+)
|
||||
handleNoArguments(+)
|
||||
handleSend(f, +)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, +, AwaitNotAsync)
|
||||
beginBinaryExpression(+)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(f, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endBinaryExpression(+)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(-)
|
||||
handleNoArguments(-)
|
||||
handleSend(f, -)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, -, AwaitNotAsync)
|
||||
beginBinaryExpression(-)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(;)
|
||||
handleNoArguments(;)
|
||||
handleSend(f, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
endBinaryExpression(-)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(-)
|
||||
handleNoArguments(-)
|
||||
handleSend(f, -)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, -, AwaitNotAsync)
|
||||
beginBinaryExpression(-)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(f, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
endBinaryExpression(-)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(^)
|
||||
handleNoArguments(^)
|
||||
handleSend(f, ^)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ^, AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
beginBinaryExpression(^)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(;)
|
||||
handleNoArguments(;)
|
||||
handleSend(f, ;)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ;, AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
endBinaryExpression(^)
|
||||
handleExpressionStatement(;)
|
||||
handleIdentifier(print, expression)
|
||||
handleNoTypeArguments(()
|
||||
beginArguments(()
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments(^)
|
||||
handleNoArguments(^)
|
||||
handleSend(f, ^)
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ^, AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
beginBinaryExpression(^)
|
||||
beginAwaitExpression(await)
|
||||
handleIdentifier(f, expression)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(f, ))
|
||||
handleRecoverableError(AwaitNotAsync, await, await)
|
||||
endInvalidAwaitExpression(await, ), AwaitNotAsync)
|
||||
handleUnaryPrefixExpression(!)
|
||||
endBinaryExpression(^)
|
||||
endArguments(1, (, ))
|
||||
handleSend(print, ;)
|
||||
handleExpressionStatement(;)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(x)
|
||||
handleType(await, null)
|
||||
beginVariablesDeclaration(x, null, null)
|
||||
handleIdentifier(x, localVariableDeclaration)
|
||||
beginInitializedIdentifier(x)
|
||||
handleNoVariableInitializer(x)
|
||||
endInitializedIdentifier(x)
|
||||
endVariablesDeclaration(1, ;)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(y)
|
||||
handleType(await, null)
|
||||
beginVariablesDeclaration(y, null, null)
|
||||
handleIdentifier(y, localVariableDeclaration)
|
||||
beginInitializedIdentifier(y)
|
||||
handleNoVariableInitializer(y)
|
||||
endInitializedIdentifier(y)
|
||||
handleIdentifier(z, localVariableDeclaration)
|
||||
beginInitializedIdentifier(z)
|
||||
handleNoVariableInitializer(z)
|
||||
endInitializedIdentifier(z)
|
||||
endVariablesDeclaration(2, ;)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(x2)
|
||||
handleType(await, null)
|
||||
beginVariablesDeclaration(x2, null, null)
|
||||
handleIdentifier(x2, localVariableDeclaration)
|
||||
beginInitializedIdentifier(x2)
|
||||
beginVariableInitializer(=)
|
||||
handleIdentifier(await, expression)
|
||||
handleNoTypeArguments(;)
|
||||
handleNoArguments(;)
|
||||
handleSend(await, ;)
|
||||
endVariableInitializer(=)
|
||||
endInitializedIdentifier(x2)
|
||||
endVariablesDeclaration(1, ;)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(y2)
|
||||
handleType(await, null)
|
||||
beginVariablesDeclaration(y2, null, null)
|
||||
handleIdentifier(y2, localVariableDeclaration)
|
||||
beginInitializedIdentifier(y2)
|
||||
beginVariableInitializer(=)
|
||||
handleIdentifier(await, expression)
|
||||
handleNoTypeArguments(,)
|
||||
handleNoArguments(,)
|
||||
handleSend(await, ,)
|
||||
endVariableInitializer(=)
|
||||
endInitializedIdentifier(y2)
|
||||
handleIdentifier(z2, localVariableDeclaration)
|
||||
beginInitializedIdentifier(z2)
|
||||
beginVariableInitializer(=)
|
||||
handleIdentifier(await, expression)
|
||||
handleNoTypeArguments(;)
|
||||
handleNoArguments(;)
|
||||
handleSend(await, ;)
|
||||
endVariableInitializer(=)
|
||||
endInitializedIdentifier(z2)
|
||||
endVariablesDeclaration(2, ;)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
handleNoTypeVariables(()
|
||||
beginLocalFunctionDeclaration(await)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(foo)
|
||||
handleType(await, null)
|
||||
beginFunctionName(foo)
|
||||
handleIdentifier(foo, localFunctionDeclaration)
|
||||
endFunctionName(await, ()
|
||||
beginFormalParameters((, MemberKind.Local)
|
||||
beginMetadataStar(int)
|
||||
endMetadataStar(0)
|
||||
beginFormalParameter(int, MemberKind.Local, null, null, null)
|
||||
handleIdentifier(int, typeReference)
|
||||
handleNoTypeArguments(bar)
|
||||
handleType(int, null)
|
||||
handleIdentifier(bar, formalParameterDeclaration)
|
||||
handleFormalParameterWithoutValue())
|
||||
endFormalParameter(null, null, null, bar, null, null, FormalParameterKind.requiredPositional, MemberKind.Local)
|
||||
endFormalParameters(1, (, ), MemberKind.Local)
|
||||
handleNoInitializers()
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
beginReturnStatement(return)
|
||||
beginNewExpression(new)
|
||||
handleIdentifier(await, constructorReference)
|
||||
beginConstructorReference(await)
|
||||
handleNoTypeArguments(()
|
||||
handleNoConstructorReferenceContinuationAfterTypeArguments(()
|
||||
endConstructorReference(await, null, (, ConstructorReferenceContext.New)
|
||||
beginArguments(()
|
||||
endArguments(0, (, ))
|
||||
endNewExpression(new)
|
||||
endReturnStatement(true, return, ;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endLocalFunctionDeclaration(})
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
handleNoTypeVariables(()
|
||||
beginLocalFunctionDeclaration(await)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(bar)
|
||||
handleType(await, null)
|
||||
beginFunctionName(bar)
|
||||
handleIdentifier(bar, localFunctionDeclaration)
|
||||
endFunctionName(await, ()
|
||||
beginFormalParameters((, MemberKind.Local)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
beginFormalParameter(await, MemberKind.Local, null, null, null)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(baz)
|
||||
handleType(await, null)
|
||||
handleIdentifier(baz, formalParameterDeclaration)
|
||||
handleFormalParameterWithoutValue(,)
|
||||
endFormalParameter(null, null, null, baz, null, null, FormalParameterKind.requiredPositional, MemberKind.Local)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
beginFormalParameter(await, MemberKind.Local, null, null, null)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(baz2)
|
||||
handleType(await, null)
|
||||
handleIdentifier(baz2, formalParameterDeclaration)
|
||||
handleFormalParameterWithoutValue(,)
|
||||
endFormalParameter(null, null, null, baz2, null, null, FormalParameterKind.requiredPositional, MemberKind.Local)
|
||||
beginMetadataStar(await)
|
||||
endMetadataStar(0)
|
||||
beginFormalParameter(await, MemberKind.Local, null, null, null)
|
||||
handleIdentifier(await, typeReference)
|
||||
handleNoTypeArguments(baz3)
|
||||
handleType(await, null)
|
||||
handleIdentifier(baz3, formalParameterDeclaration)
|
||||
handleFormalParameterWithoutValue())
|
||||
endFormalParameter(null, null, null, baz3, null, null, FormalParameterKind.requiredPositional, MemberKind.Local)
|
||||
endFormalParameters(3, (, ), MemberKind.Local)
|
||||
handleNoInitializers()
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
beginReturnStatement(return)
|
||||
handleIdentifier(baz, expression)
|
||||
handleNoTypeArguments(;)
|
||||
handleNoArguments(;)
|
||||
handleSend(baz, ;)
|
||||
endReturnStatement(true, return, ;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endLocalFunctionDeclaration(})
|
||||
endBlockFunctionBody(31, {, })
|
||||
endTopLevelMethod(void, null, })
|
||||
endTopLevelDeclaration(bool)
|
||||
beginMetadataStar(bool)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(bool)
|
||||
beginTopLevelMethod(}, null, null)
|
||||
handleIdentifier(bool, typeReference)
|
||||
handleNoTypeArguments(xor)
|
||||
handleType(bool, null)
|
||||
handleIdentifier(xor, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
beginMetadataStar(bool)
|
||||
endMetadataStar(0)
|
||||
beginFormalParameter(bool, MemberKind.TopLevelMethod, null, null, null)
|
||||
handleIdentifier(bool, typeReference)
|
||||
handleNoTypeArguments(a)
|
||||
handleType(bool, null)
|
||||
handleIdentifier(a, formalParameterDeclaration)
|
||||
handleFormalParameterWithoutValue(,)
|
||||
endFormalParameter(null, null, null, a, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
|
||||
beginMetadataStar(bool)
|
||||
endMetadataStar(0)
|
||||
beginFormalParameter(bool, MemberKind.TopLevelMethod, null, null, null)
|
||||
handleIdentifier(bool, typeReference)
|
||||
handleNoTypeArguments(b)
|
||||
handleType(bool, null)
|
||||
handleIdentifier(b, formalParameterDeclaration)
|
||||
handleFormalParameterWithoutValue(,)
|
||||
endFormalParameter(null, null, null, b, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
|
||||
beginMetadataStar(bool)
|
||||
endMetadataStar(0)
|
||||
beginFormalParameter(bool, MemberKind.TopLevelMethod, null, null, null)
|
||||
handleIdentifier(bool, typeReference)
|
||||
handleNoTypeArguments(c)
|
||||
handleType(bool, null)
|
||||
handleIdentifier(c, formalParameterDeclaration)
|
||||
handleFormalParameterWithoutValue())
|
||||
endFormalParameter(null, null, null, c, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(3, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
beginReturnStatement(return)
|
||||
handleIdentifier(b, expression)
|
||||
handleNoTypeArguments(^)
|
||||
handleNoArguments(^)
|
||||
handleSend(b, ^)
|
||||
beginBinaryExpression(^)
|
||||
handleIdentifier(b, expression)
|
||||
handleNoTypeArguments(^)
|
||||
handleNoArguments(^)
|
||||
handleSend(b, ^)
|
||||
endBinaryExpression(^)
|
||||
beginBinaryExpression(^)
|
||||
handleIdentifier(c, expression)
|
||||
handleNoTypeArguments(;)
|
||||
handleNoArguments(;)
|
||||
handleSend(c, ;)
|
||||
endBinaryExpression(^)
|
||||
endReturnStatement(true, return, ;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(bool, null, })
|
||||
endTopLevelDeclaration(class)
|
||||
beginMetadataStar(class)
|
||||
endMetadataStar(0)
|
||||
beginClassOrMixinOrNamedMixinApplicationPrelude(class)
|
||||
handleIdentifier(await, classOrMixinDeclaration)
|
||||
handleNoTypeVariables({)
|
||||
beginClassDeclaration(class, null, null, null, await)
|
||||
handleNoType(await)
|
||||
handleClassExtends(null, 1)
|
||||
handleClassNoWithClause()
|
||||
handleImplements(null, 0)
|
||||
handleClassHeader(class, class, null)
|
||||
beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
|
||||
endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
|
||||
endClassDeclaration(class, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(4, )
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,105 @@
|
|||
Future<bool> returnsFuture() => new Future.value(true);
|
||||
|
||||
|
||||
void foo() {
|
||||
await returnsFuture();
|
||||
if (await returnsFuture()) {}
|
||||
else if (!await returnsFuture()) {}
|
||||
print(await returnsFuture());
|
||||
xor(await returnsFuture(), await returnsFuture(), await returnsFuture());
|
||||
await returnsFuture() ^ await returnsFuture();
|
||||
print(await returnsFuture() ^ await returnsFuture());
|
||||
await returnsFuture() + await returnsFuture();
|
||||
print(await returnsFuture() + await returnsFuture());
|
||||
await returnsFuture() - await returnsFuture();
|
||||
print(await returnsFuture() - await returnsFuture());
|
||||
!await returnsFuture() ^ !await returnsFuture();
|
||||
print(!await returnsFuture() ^ !await returnsFuture());
|
||||
|
||||
var f = returnsFuture();
|
||||
await f;
|
||||
if (await f) {}
|
||||
else if (!await f) {}
|
||||
print(await f);
|
||||
xor(await f, await f, await f);
|
||||
await f ^ await f;
|
||||
print(await f ^ await f);
|
||||
await f + await f;
|
||||
print(await f + await f);
|
||||
await f - await f;
|
||||
print(await f - await f);
|
||||
!await f ^ !await f;
|
||||
print(!await f ^ !await f);
|
||||
|
||||
|
||||
await x;
|
||||
await y, z;
|
||||
await x2 = await;
|
||||
await y2 = await, z2 = await;
|
||||
await foo(int bar) {
|
||||
return new await();
|
||||
}
|
||||
await bar(await baz, await baz2, await baz3) {
|
||||
return baz;
|
||||
}
|
||||
}
|
||||
|
||||
bool xor(bool a, bool b, bool c) {
|
||||
return b ^ b ^ c;
|
||||
}
|
||||
|
||||
class await {}
|
||||
|
||||
|
||||
Future[StringToken]<[BeginToken]bool[StringToken]>[SimpleToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] =>[SimpleToken] new[KeywordToken] Future[StringToken].[SimpleToken]value[StringToken]([BeginToken]true[KeywordToken])[SimpleToken];[SimpleToken]
|
||||
|
||||
|
||||
void[KeywordToken] foo[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
|
||||
await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
if[KeywordToken] ([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken] {[BeginToken]}[SimpleToken]
|
||||
else[KeywordToken] if[KeywordToken] ([BeginToken]![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken] {[BeginToken]}[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
xor[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken],[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken],[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] ^[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] ^[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] +[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] +[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] -[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] -[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] ^[SimpleToken] ![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] ^[SimpleToken] ![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
|
||||
var[KeywordToken] f[StringToken] =[SimpleToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
if[KeywordToken] ([BeginToken]await[KeywordToken] f[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
|
||||
else[KeywordToken] if[KeywordToken] ([BeginToken]![SimpleToken]await[KeywordToken] f[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
xor[StringToken]([BeginToken]await[KeywordToken] f[StringToken],[SimpleToken] await[KeywordToken] f[StringToken],[SimpleToken] await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] f[StringToken] ^[SimpleToken] await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] f[StringToken] ^[SimpleToken] await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] f[StringToken] +[SimpleToken] await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] f[StringToken] +[SimpleToken] await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] f[StringToken] -[SimpleToken] await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] f[StringToken] -[SimpleToken] await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
![SimpleToken]await[KeywordToken] f[StringToken] ^[SimpleToken] ![SimpleToken]await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]![SimpleToken]await[KeywordToken] f[StringToken] ^[SimpleToken] ![SimpleToken]await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
|
||||
|
||||
await[KeywordToken] x[StringToken];[SimpleToken]
|
||||
await[KeywordToken] y[StringToken],[SimpleToken] z[StringToken];[SimpleToken]
|
||||
await[KeywordToken] x2[StringToken] =[SimpleToken] await[KeywordToken];[SimpleToken]
|
||||
await[KeywordToken] y2[StringToken] =[SimpleToken] await[KeywordToken],[SimpleToken] z2[StringToken] =[SimpleToken] await[KeywordToken];[SimpleToken]
|
||||
await[KeywordToken] foo[StringToken]([BeginToken]int[StringToken] bar[StringToken])[SimpleToken] {[BeginToken]
|
||||
return[KeywordToken] new[KeywordToken] await[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
}[SimpleToken]
|
||||
await[KeywordToken] bar[StringToken]([BeginToken]await[KeywordToken] baz[StringToken],[SimpleToken] await[KeywordToken] baz2[StringToken],[SimpleToken] await[KeywordToken] baz3[StringToken])[SimpleToken] {[BeginToken]
|
||||
return[KeywordToken] baz[StringToken];[SimpleToken]
|
||||
}[SimpleToken]
|
||||
}[SimpleToken]
|
||||
|
||||
bool[StringToken] xor[StringToken]([BeginToken]bool[StringToken] a[StringToken],[SimpleToken] bool[StringToken] b[StringToken],[SimpleToken] bool[StringToken] c[StringToken])[SimpleToken] {[BeginToken]
|
||||
return[KeywordToken] b[StringToken] ^[SimpleToken] b[StringToken] ^[SimpleToken] c[StringToken];[SimpleToken]
|
||||
}[SimpleToken]
|
||||
|
||||
class[KeywordToken] await[KeywordToken] {[BeginToken]}[SimpleToken]
|
||||
[SimpleToken]
|
|
@ -0,0 +1,105 @@
|
|||
Future<bool> returnsFuture() => new Future.value(true);
|
||||
|
||||
|
||||
void foo() {
|
||||
await returnsFuture();
|
||||
if (await returnsFuture()) {}
|
||||
else if (!await returnsFuture()) {}
|
||||
print(await returnsFuture());
|
||||
xor(await returnsFuture(), await returnsFuture(), await returnsFuture());
|
||||
await returnsFuture() ^ await returnsFuture();
|
||||
print(await returnsFuture() ^ await returnsFuture());
|
||||
await returnsFuture() + await returnsFuture();
|
||||
print(await returnsFuture() + await returnsFuture());
|
||||
await returnsFuture() - await returnsFuture();
|
||||
print(await returnsFuture() - await returnsFuture());
|
||||
!await returnsFuture() ^ !await returnsFuture();
|
||||
print(!await returnsFuture() ^ !await returnsFuture());
|
||||
|
||||
var f = returnsFuture();
|
||||
await f;
|
||||
if (await f) {}
|
||||
else if (!await f) {}
|
||||
print(await f);
|
||||
xor(await f, await f, await f);
|
||||
await f ^ await f;
|
||||
print(await f ^ await f);
|
||||
await f + await f;
|
||||
print(await f + await f);
|
||||
await f - await f;
|
||||
print(await f - await f);
|
||||
!await f ^ !await f;
|
||||
print(!await f ^ !await f);
|
||||
|
||||
|
||||
await x;
|
||||
await y, z;
|
||||
await x2 = await;
|
||||
await y2 = await, z2 = await;
|
||||
await foo(int bar) {
|
||||
return new await();
|
||||
}
|
||||
await bar(await baz, await baz2, await baz3) {
|
||||
return baz;
|
||||
}
|
||||
}
|
||||
|
||||
bool xor(bool a, bool b, bool c) {
|
||||
return b ^ b ^ c;
|
||||
}
|
||||
|
||||
class await {}
|
||||
|
||||
|
||||
Future[StringToken]<[BeginToken]bool[StringToken]>[SimpleToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] =>[SimpleToken] new[KeywordToken] Future[StringToken].[SimpleToken]value[StringToken]([BeginToken]true[KeywordToken])[SimpleToken];[SimpleToken]
|
||||
|
||||
|
||||
void[KeywordToken] foo[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
|
||||
await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
if[KeywordToken] ([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken] {[BeginToken]}[SimpleToken]
|
||||
else[KeywordToken] if[KeywordToken] ([BeginToken]![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken] {[BeginToken]}[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
xor[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken],[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken],[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] ^[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] ^[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] +[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] +[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] -[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] -[SimpleToken] await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] ^[SimpleToken] ![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken] ^[SimpleToken] ![SimpleToken]await[KeywordToken] returnsFuture[StringToken]([BeginToken])[SimpleToken])[SimpleToken];[SimpleToken]
|
||||
|
||||
var[KeywordToken] f[StringToken] =[SimpleToken] returnsFuture[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
if[KeywordToken] ([BeginToken]await[KeywordToken] f[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
|
||||
else[KeywordToken] if[KeywordToken] ([BeginToken]![SimpleToken]await[KeywordToken] f[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
xor[StringToken]([BeginToken]await[KeywordToken] f[StringToken],[SimpleToken] await[KeywordToken] f[StringToken],[SimpleToken] await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] f[StringToken] ^[SimpleToken] await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] f[StringToken] ^[SimpleToken] await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] f[StringToken] +[SimpleToken] await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] f[StringToken] +[SimpleToken] await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
await[KeywordToken] f[StringToken] -[SimpleToken] await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]await[KeywordToken] f[StringToken] -[SimpleToken] await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
![SimpleToken]await[KeywordToken] f[StringToken] ^[SimpleToken] ![SimpleToken]await[KeywordToken] f[StringToken];[SimpleToken]
|
||||
print[StringToken]([BeginToken]![SimpleToken]await[KeywordToken] f[StringToken] ^[SimpleToken] ![SimpleToken]await[KeywordToken] f[StringToken])[SimpleToken];[SimpleToken]
|
||||
|
||||
|
||||
await[KeywordToken] x[StringToken];[SimpleToken]
|
||||
await[KeywordToken] y[StringToken],[SimpleToken] z[StringToken];[SimpleToken]
|
||||
await[KeywordToken] x2[StringToken] =[SimpleToken] await[KeywordToken];[SimpleToken]
|
||||
await[KeywordToken] y2[StringToken] =[SimpleToken] await[KeywordToken],[SimpleToken] z2[StringToken] =[SimpleToken] await[KeywordToken];[SimpleToken]
|
||||
await[KeywordToken] foo[StringToken]([BeginToken]int[StringToken] bar[StringToken])[SimpleToken] {[BeginToken]
|
||||
return[KeywordToken] new[KeywordToken] await[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
|
||||
}[SimpleToken]
|
||||
await[KeywordToken] bar[StringToken]([BeginToken]await[KeywordToken] baz[StringToken],[SimpleToken] await[KeywordToken] baz2[StringToken],[SimpleToken] await[KeywordToken] baz3[StringToken])[SimpleToken] {[BeginToken]
|
||||
return[KeywordToken] baz[StringToken];[SimpleToken]
|
||||
}[SimpleToken]
|
||||
}[SimpleToken]
|
||||
|
||||
bool[StringToken] xor[StringToken]([BeginToken]bool[StringToken] a[StringToken],[SimpleToken] bool[StringToken] b[StringToken],[SimpleToken] bool[StringToken] c[StringToken])[SimpleToken] {[BeginToken]
|
||||
return[KeywordToken] b[StringToken] ^[SimpleToken] b[StringToken] ^[SimpleToken] c[StringToken];[SimpleToken]
|
||||
}[SimpleToken]
|
||||
|
||||
class[KeywordToken] await[KeywordToken] {[BeginToken]}[SimpleToken]
|
||||
[SimpleToken]
|
|
@ -691,8 +691,8 @@ parseUnit(class)
|
|||
parsePrecedenceExpression(return, 1, true)
|
||||
parseUnaryExpression(return, true)
|
||||
inPlainSync()
|
||||
looksLikeAwaitExpression(return)
|
||||
looksLikeExpression(await)
|
||||
looksLikeAwaitExpression(return, AwaitOrYieldContext.UnaryExpression)
|
||||
looksLikeExpressionAfterAwaitOrYield(await, AwaitOrYieldContext.UnaryExpression)
|
||||
parsePrimary(return, expression)
|
||||
inPlainSync()
|
||||
parseSendOrFunctionLiteral(return, expression)
|
||||
|
|
|
@ -648,8 +648,8 @@ parseUnit(int)
|
|||
parsePrecedenceExpression(return, 1, true)
|
||||
parseUnaryExpression(return, true)
|
||||
inPlainSync()
|
||||
looksLikeAwaitExpression(return)
|
||||
looksLikeExpression(await)
|
||||
looksLikeAwaitExpression(return, AwaitOrYieldContext.UnaryExpression)
|
||||
looksLikeExpressionAfterAwaitOrYield(await, AwaitOrYieldContext.UnaryExpression)
|
||||
parsePrimary(return, expression)
|
||||
inPlainSync()
|
||||
parseSendOrFunctionLiteral(return, expression)
|
||||
|
|
|
@ -102,8 +102,8 @@ parseUnit(Future)
|
|||
notEofOrValue(}, yield)
|
||||
parseStatement({)
|
||||
parseStatementX({)
|
||||
looksLikeYieldStatement({)
|
||||
looksLikeExpression(yield)
|
||||
looksLikeYieldStatement({, AwaitOrYieldContext.Statement)
|
||||
looksLikeExpressionAfterAwaitOrYield(yield, AwaitOrYieldContext.Statement)
|
||||
parseYieldStatement({)
|
||||
listener: beginYieldStatement(yield)
|
||||
parseExpression(yield)
|
||||
|
|
|
@ -12,6 +12,8 @@ import 'package:_fe_analyzer_shared/src/parser/identifier_context.dart';
|
|||
import 'package:_fe_analyzer_shared/src/parser/listener.dart' show Listener;
|
||||
import 'package:_fe_analyzer_shared/src/parser/member_kind.dart';
|
||||
import 'package:_fe_analyzer_shared/src/parser/parser.dart' show Parser;
|
||||
import 'package:_fe_analyzer_shared/src/parser/parser_impl.dart'
|
||||
show AwaitOrYieldContext;
|
||||
import 'package:_fe_analyzer_shared/src/parser/token_stream_rewriter.dart';
|
||||
import 'package:_fe_analyzer_shared/src/parser/type_info.dart';
|
||||
import 'package:_fe_analyzer_shared/src/scanner/token.dart';
|
||||
|
@ -2090,28 +2092,29 @@ class TestParser extends Parser {
|
|||
}
|
||||
|
||||
@override
|
||||
bool looksLikeExpression(Token token) {
|
||||
doPrint('looksLikeExpression(' '$token)');
|
||||
bool looksLikeExpressionAfterAwaitOrYield(
|
||||
Token token, AwaitOrYieldContext context) {
|
||||
doPrint('looksLikeExpressionAfterAwaitOrYield(' '$token, ' '$context)');
|
||||
indent++;
|
||||
var result = super.looksLikeExpression(token);
|
||||
var result = super.looksLikeExpressionAfterAwaitOrYield(token, context);
|
||||
indent--;
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
bool looksLikeAwaitExpression(Token token) {
|
||||
doPrint('looksLikeAwaitExpression(' '$token)');
|
||||
bool looksLikeAwaitExpression(Token token, AwaitOrYieldContext context) {
|
||||
doPrint('looksLikeAwaitExpression(' '$token, ' '$context)');
|
||||
indent++;
|
||||
var result = super.looksLikeAwaitExpression(token);
|
||||
var result = super.looksLikeAwaitExpression(token, context);
|
||||
indent--;
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
bool looksLikeYieldStatement(Token token) {
|
||||
doPrint('looksLikeYieldStatement(' '$token)');
|
||||
bool looksLikeYieldStatement(Token token, AwaitOrYieldContext context) {
|
||||
doPrint('looksLikeYieldStatement(' '$token, ' '$context)');
|
||||
indent++;
|
||||
var result = super.looksLikeYieldStatement(token);
|
||||
var result = super.looksLikeYieldStatement(token, context);
|
||||
indent--;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ import 'package:_fe_analyzer_shared/src/parser/identifier_context.dart';
|
|||
import 'package:_fe_analyzer_shared/src/parser/listener.dart' show Listener;
|
||||
import 'package:_fe_analyzer_shared/src/parser/member_kind.dart';
|
||||
import 'package:_fe_analyzer_shared/src/parser/parser.dart' show Parser;
|
||||
import 'package:_fe_analyzer_shared/src/parser/parser_impl.dart' show AwaitOrYieldContext;
|
||||
import 'package:_fe_analyzer_shared/src/parser/token_stream_rewriter.dart';
|
||||
import 'package:_fe_analyzer_shared/src/parser/type_info.dart';
|
||||
import 'package:_fe_analyzer_shared/src/scanner/token.dart';
|
||||
|
|
Loading…
Reference in a new issue