| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dart2js.parser; | 5 library dart2js.parser; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../tokens/keyword.dart' show Keyword; | 8 import '../tokens/keyword.dart' show Keyword; |
| 9 import '../tokens/precedence.dart' show PrecedenceInfo; | 9 import '../tokens/precedence.dart' show PrecedenceInfo; |
| 10 import '../tokens/precedence_constants.dart' | 10 import '../tokens/precedence_constants.dart' |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 425 |
| 426 Token parseFormalParameter(Token token, FormalParameterType type) { | 426 Token parseFormalParameter(Token token, FormalParameterType type) { |
| 427 token = parseMetadataStar(token, forParameter: true); | 427 token = parseMetadataStar(token, forParameter: true); |
| 428 listener.beginFormalParameter(token); | 428 listener.beginFormalParameter(token); |
| 429 | 429 |
| 430 // Skip over `covariant` token, if the next token is an identifier or | 430 // Skip over `covariant` token, if the next token is an identifier or |
| 431 // modifier. | 431 // modifier. |
| 432 // This enables the case where `covariant` is the name of the parameter: | 432 // This enables the case where `covariant` is the name of the parameter: |
| 433 // void foo(covariant); | 433 // void foo(covariant); |
| 434 if (identical(token.stringValue, 'covariant') && | 434 if (identical(token.stringValue, 'covariant') && |
| 435 token.next.isIdentifier() || isModifier(token.next)) { | 435 (token.next.isIdentifier() || isModifier(token.next))) { |
| 436 token = token.next; | 436 token = token.next; |
| 437 } | 437 } |
| 438 token = parseModifiers(token); | 438 token = parseModifiers(token); |
| 439 // TODO(ahe): Validate that there are formal parameters if void. | 439 // TODO(ahe): Validate that there are formal parameters if void. |
| 440 token = parseReturnTypeOpt(token); | 440 token = parseReturnTypeOpt(token); |
| 441 Token thisKeyword = null; | 441 Token thisKeyword = null; |
| 442 if (optional('this', token)) { | 442 if (optional('this', token)) { |
| 443 thisKeyword = token; | 443 thisKeyword = token; |
| 444 // TODO(ahe): Validate field initializers are only used in | 444 // TODO(ahe): Validate field initializers are only used in |
| 445 // constructors, and not for function-typed arguments. | 445 // constructors, and not for function-typed arguments. |
| (...skipping 2552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2998 } | 2998 } |
| 2999 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2999 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 3000 return expectSemicolon(token); | 3000 return expectSemicolon(token); |
| 3001 } | 3001 } |
| 3002 | 3002 |
| 3003 Token parseEmptyStatement(Token token) { | 3003 Token parseEmptyStatement(Token token) { |
| 3004 listener.handleEmptyStatement(token); | 3004 listener.handleEmptyStatement(token); |
| 3005 return expectSemicolon(token); | 3005 return expectSemicolon(token); |
| 3006 } | 3006 } |
| 3007 } | 3007 } |
| OLD | NEW |