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

Side by Side Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 890253003: Report a compile-time error if async/sync/yield used as an identifier. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.parser; 8 library engine.parser;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3667 * 3667 *
3668 * <pre> 3668 * <pre>
3669 * identifier ::= 3669 * identifier ::=
3670 * IDENTIFIER 3670 * IDENTIFIER
3671 * </pre> 3671 * </pre>
3672 * 3672 *
3673 * @return the simple identifier that was parsed 3673 * @return the simple identifier that was parsed
3674 */ 3674 */
3675 SimpleIdentifier parseSimpleIdentifier() { 3675 SimpleIdentifier parseSimpleIdentifier() {
3676 if (_matchesIdentifier()) { 3676 if (_matchesIdentifier()) {
3677 String lexeme = _currentToken.lexeme;
3678 if ((_inAsync || _inGenerator) &&
3679 (lexeme == 'async' || lexeme == 'await' || lexeme == 'yield')) {
3680 _reportErrorForCurrentToken(
3681 ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER);
3682 }
3677 return new SimpleIdentifier(getAndAdvance()); 3683 return new SimpleIdentifier(getAndAdvance());
3678 } 3684 }
3679 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER); 3685 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
3680 return _createSyntheticIdentifier(); 3686 return _createSyntheticIdentifier();
3681 } 3687 }
3682 3688
3683 /** 3689 /**
3684 * Parse a statement, starting with the given token. 3690 * Parse a statement, starting with the given token.
3685 * 3691 *
3686 * @param token the first token of the statement 3692 * @param token the first token of the statement
(...skipping 6335 matching lines...) Expand 10 before | Expand all | Expand 10 after
10022 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_THROW = 10028 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_THROW =
10023 const ParserErrorCode( 10029 const ParserErrorCode(
10024 'ASSERT_DOES_NOT_TAKE_THROW', 10030 'ASSERT_DOES_NOT_TAKE_THROW',
10025 "Assert cannot be called on throws"); 10031 "Assert cannot be called on throws");
10026 10032
10027 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_RETHROW = 10033 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_RETHROW =
10028 const ParserErrorCode( 10034 const ParserErrorCode(
10029 'ASSERT_DOES_NOT_TAKE_RETHROW', 10035 'ASSERT_DOES_NOT_TAKE_RETHROW',
10030 "Assert cannot be called on rethrows"); 10036 "Assert cannot be called on rethrows");
10031 10037
10038 /**
10039 * 16.32 Identifier Reference: It is a compile-time error if any of the
10040 * identifiers async, await, or yield is used as an identifier in a function
10041 * body marked with either async, async*, or sync*.
10042 */
10043 static const ParserErrorCode ASYNC_KEYWORD_USED_AS_IDENTIFIER =
10044 const ParserErrorCode(
10045 'ASYNC_KEYWORD_USED_AS_IDENTIFIER',
10046 "The keywords 'async', 'await', and 'yield' may not be used as identif iers in an asynchronous or generator function.");
10047
10032 static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = const ParserErrorCode( 10048 static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = const ParserErrorCode(
10033 'BREAK_OUTSIDE_OF_LOOP', 10049 'BREAK_OUTSIDE_OF_LOOP',
10034 "A break statement cannot be used outside of a loop or switch statement"); 10050 "A break statement cannot be used outside of a loop or switch statement");
10035 10051
10036 static const ParserErrorCode CLASS_IN_CLASS = const ParserErrorCode( 10052 static const ParserErrorCode CLASS_IN_CLASS = const ParserErrorCode(
10037 'CLASS_IN_CLASS', 10053 'CLASS_IN_CLASS',
10038 "Classes cannot be declared inside other classes"); 10054 "Classes cannot be declared inside other classes");
10039 10055
10040 static const ParserErrorCode COLON_IN_PLACE_OF_IN = const ParserErrorCode( 10056 static const ParserErrorCode COLON_IN_PLACE_OF_IN = const ParserErrorCode(
10041 'COLON_IN_PLACE_OF_IN', 10057 'COLON_IN_PLACE_OF_IN',
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
12103 * Copy resolution data from one node to another. 12119 * Copy resolution data from one node to another.
12104 * 12120 *
12105 * @param fromNode the node from which resolution information will be copied 12121 * @param fromNode the node from which resolution information will be copied
12106 * @param toNode the node to which resolution information will be copied 12122 * @param toNode the node to which resolution information will be copied
12107 */ 12123 */
12108 static void copyResolutionData(AstNode fromNode, AstNode toNode) { 12124 static void copyResolutionData(AstNode fromNode, AstNode toNode) {
12109 ResolutionCopier copier = new ResolutionCopier(); 12125 ResolutionCopier copier = new ResolutionCopier();
12110 copier._isEqualNodes(fromNode, toNode); 12126 copier._isEqualNodes(fromNode, toNode);
12111 } 12127 }
12112 } 12128 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698