| Index: pkg/front_end/lib/src/fasta/parser/parser.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
|
| index ce6741a54c27894336570acc8b8999bfa5f3b6d1..5b3c27de3bd4ac410a8c63304c375c11a027fa1c 100644
|
| --- a/pkg/front_end/lib/src/fasta/parser/parser.dart
|
| +++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
|
| @@ -401,7 +401,7 @@ class Parser {
|
| token = expect('=', token);
|
| token = parseType(token);
|
| } else {
|
| - token = parseReturnTypeOpt(token.next);
|
| + token = parseTypeOpt(token.next);
|
| token = parseIdentifier(token, IdentifierContext.typedefDeclaration);
|
| token = parseTypeVariablesOpt(token);
|
| token = parseFormalParameters(token);
|
| @@ -419,19 +419,6 @@ class Parser {
|
| return token;
|
| }
|
|
|
| - Token parseReturnTypeOpt(Token token) {
|
| - if (identical(token.stringValue, 'void')) {
|
| - if (isGeneralizedFunctionType(token.next)) {
|
| - return parseType(token);
|
| - } else {
|
| - listener.handleVoidKeyword(token);
|
| - return token.next;
|
| - }
|
| - } else {
|
| - return parseTypeOpt(token);
|
| - }
|
| - }
|
| -
|
| Token parseFormalParametersOpt(Token token) {
|
| if (optional('(', token)) {
|
| return parseFormalParameters(token);
|
| @@ -522,7 +509,7 @@ class Parser {
|
| listener.handleNoName(token);
|
| }
|
| } else {
|
| - token = parseReturnTypeOpt(token);
|
| + token = parseTypeOpt(token);
|
| if (optional('this', token)) {
|
| thisKeyword = token;
|
| token = expect('.', token.next);
|
| @@ -937,10 +924,6 @@ class Parser {
|
| // Push the non-existing return type first. The loop below will
|
| // generate the full type.
|
| listener.handleNoType(token);
|
| - } else if (identical(token.stringValue, 'void') &&
|
| - isGeneralizedFunctionType(token.next)) {
|
| - listener.handleVoidKeyword(token);
|
| - token = token.next;
|
| } else {
|
| if (isValidTypeReference(token)) {
|
| token = parseIdentifier(token, IdentifierContext.typeReference);
|
| @@ -1198,13 +1181,6 @@ class Parser {
|
|
|
| if (!hasType) {
|
| listener.handleNoType(name);
|
| - } else if (optional('void', type) &&
|
| - !isGeneralizedFunctionType(type.next)) {
|
| - listener.handleNoType(name);
|
| - // TODO(ahe): This error is reported twice, second time is from
|
| - // [parseVariablesDeclarationMaybeSemicolon] via
|
| - // [PartialFieldListElement.parseNode].
|
| - reportRecoverableError(type, ErrorKind.InvalidVoid);
|
| } else {
|
| parseType(type);
|
| if (isVar) {
|
| @@ -1259,7 +1235,7 @@ class Parser {
|
| if (type == null) {
|
| listener.handleNoType(name);
|
| } else {
|
| - parseReturnTypeOpt(type);
|
| + parseTypeOpt(type);
|
| }
|
| Token token =
|
| parseIdentifier(name, IdentifierContext.topLevelFunctionDeclaration);
|
| @@ -1603,7 +1579,7 @@ class Parser {
|
| * If [token] is not the start of a type, null is returned.
|
| */
|
| Token peekAfterIfType(Token token) {
|
| - if (!optional('void', token) && !token.isIdentifier()) {
|
| + if (!token.isIdentifier()) {
|
| return null;
|
| }
|
| return peekAfterType(token);
|
| @@ -1789,7 +1765,7 @@ class Parser {
|
| if (type == null) {
|
| listener.handleNoType(name);
|
| } else {
|
| - parseReturnTypeOpt(type);
|
| + parseTypeOpt(type);
|
| }
|
| Token token;
|
| if (optional('operator', name)) {
|
| @@ -1885,7 +1861,7 @@ class Parser {
|
| token = parseOperatorName(token);
|
| } else {
|
| // <type>? <get>? <name>
|
| - token = parseReturnTypeOpt(token);
|
| + token = parseTypeOpt(token);
|
| if (identical(getOrSet, token)) {
|
| token = token.next;
|
| }
|
| @@ -1937,7 +1913,7 @@ class Parser {
|
| Token parseFunctionExpression(Token token) {
|
| listener.beginFunction(token);
|
| listener.handleModifiers(0);
|
| - token = parseReturnTypeOpt(token);
|
| + token = parseTypeOpt(token);
|
| listener.beginFunctionName(token);
|
| token = parseIdentifier(token, IdentifierContext.functionExpressionName);
|
| listener.endFunctionName(token);
|
| @@ -2143,8 +2119,6 @@ class Parser {
|
| } else if (identical(value, 'throw') && optional(';', token.next)) {
|
| // TODO(kasperl): Stop dealing with throw here.
|
| return parseRethrowStatement(token);
|
| - } else if (identical(value, 'void')) {
|
| - return parseExpressionStatementOrDeclaration(token);
|
| } else if (identical(value, 'while')) {
|
| return parseWhileStatement(token);
|
| } else if (identical(value, 'do')) {
|
| @@ -2225,7 +2199,7 @@ class Parser {
|
| }
|
|
|
| Token parseExpressionStatementOrDeclaration(Token token) {
|
| - assert(token.isIdentifier() || identical(token.stringValue, 'void'));
|
| + assert(token.isIdentifier());
|
| Token identifier = peekIdentifierAfterType(token);
|
| if (identifier != null) {
|
| assert(identifier.isIdentifier());
|
| @@ -2639,8 +2613,6 @@ class Parser {
|
| return parseNewExpression(token);
|
| } else if (value == 'const') {
|
| return parseConstExpression(token);
|
| - } else if (value == 'void') {
|
| - return parseFunctionExpression(token);
|
| } else if (asyncAwaitKeywordsEnabled &&
|
| (value == 'yield' || value == 'async')) {
|
| return expressionExpected(token);
|
|
|