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

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

Issue 689383005: Fix for issue 20796 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed missed case Created 6 years, 1 month 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
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:collection'; 10 import 'dart:collection';
(...skipping 4391 matching lines...) Expand 10 before | Expand all | Expand 10 after
4402 bodyAllowed = false; 4402 bodyAllowed = false;
4403 initializers.add(_parseRedirectingConstructorInvocation()); 4403 initializers.add(_parseRedirectingConstructorInvocation());
4404 } else if (_tokenMatches(_peek(), TokenType.PERIOD) && _tokenMatches(_ peekAt(3), TokenType.OPEN_PAREN)) { 4404 } else if (_tokenMatches(_peek(), TokenType.PERIOD) && _tokenMatches(_ peekAt(3), TokenType.OPEN_PAREN)) {
4405 bodyAllowed = false; 4405 bodyAllowed = false;
4406 initializers.add(_parseRedirectingConstructorInvocation()); 4406 initializers.add(_parseRedirectingConstructorInvocation());
4407 } else { 4407 } else {
4408 initializers.add(_parseConstructorFieldInitializer()); 4408 initializers.add(_parseConstructorFieldInitializer());
4409 } 4409 }
4410 } else if (_matchesKeyword(Keyword.SUPER)) { 4410 } else if (_matchesKeyword(Keyword.SUPER)) {
4411 initializers.add(_parseSuperConstructorInvocation()); 4411 initializers.add(_parseSuperConstructorInvocation());
4412 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)
4413 || _matches(TokenType.FUNCTION)) {
4414 _reportErrorForCurrentToken(ParserErrorCode.MISSING_INITIALIZER, []);
4412 } else { 4415 } else {
4413 initializers.add(_parseConstructorFieldInitializer()); 4416 initializers.add(_parseConstructorFieldInitializer());
4414 } 4417 }
4415 } while (_optional(TokenType.COMMA)); 4418 } while (_optional(TokenType.COMMA));
4416 if (factoryKeyword != null) { 4419 if (factoryKeyword != null) {
4417 _reportErrorForToken(ParserErrorCode.FACTORY_WITH_INITIALIZERS, factoryK eyword, []); 4420 _reportErrorForToken(ParserErrorCode.FACTORY_WITH_INITIALIZERS, factoryK eyword, []);
4418 } 4421 }
4419 } 4422 }
4420 ConstructorName redirectedConstructor = null; 4423 ConstructorName redirectedConstructor = null;
4421 FunctionBody body; 4424 FunctionBody body;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4456 * @return the field initializer that was parsed 4459 * @return the field initializer that was parsed
4457 */ 4460 */
4458 ConstructorFieldInitializer _parseConstructorFieldInitializer() { 4461 ConstructorFieldInitializer _parseConstructorFieldInitializer() {
4459 Token keyword = null; 4462 Token keyword = null;
4460 Token period = null; 4463 Token period = null;
4461 if (_matchesKeyword(Keyword.THIS)) { 4464 if (_matchesKeyword(Keyword.THIS)) {
4462 keyword = andAdvance; 4465 keyword = andAdvance;
4463 period = _expect(TokenType.PERIOD); 4466 period = _expect(TokenType.PERIOD);
4464 } 4467 }
4465 SimpleIdentifier fieldName = parseSimpleIdentifier(); 4468 SimpleIdentifier fieldName = parseSimpleIdentifier();
4469 if (!_matches(TokenType.EQ)) {
4470 _reportErrorForCurrentToken(ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALI ZER, []);
4471 return new ConstructorFieldInitializer(
4472 keyword,
4473 period,
4474 fieldName,
4475 _createSyntheticToken(TokenType.EQ),
4476 _createSyntheticIdentifier());
4477 }
4466 Token equals = _expect(TokenType.EQ); 4478 Token equals = _expect(TokenType.EQ);
4467 bool wasInInitializer = _inInitializer; 4479 bool wasInInitializer = _inInitializer;
4468 _inInitializer = true; 4480 _inInitializer = true;
4469 try { 4481 try {
4470 Expression expression = parseConditionalExpression(); 4482 Expression expression = parseConditionalExpression();
4471 TokenType tokenType = _currentToken.type; 4483 TokenType tokenType = _currentToken.type;
4472 if (tokenType == TokenType.PERIOD_PERIOD) { 4484 if (tokenType == TokenType.PERIOD_PERIOD) {
4473 List<Expression> cascadeSections = new List<Expression>(); 4485 List<Expression> cascadeSections = new List<Expression>();
4474 while (tokenType == TokenType.PERIOD_PERIOD) { 4486 while (tokenType == TokenType.PERIOD_PERIOD) {
4475 Expression section = _parseCascadeSection(); 4487 Expression section = _parseCascadeSection();
(...skipping 3527 matching lines...) Expand 10 before | Expand all | Expand 10 after
8003 static const ParserErrorCode INVALID_SYNC = const ParserErrorCode('INVALID_SYN C', "The modifier 'sync' is not allowed for an exrpression function body", "Conv ert the body to a block."); 8015 static const ParserErrorCode INVALID_SYNC = const ParserErrorCode('INVALID_SYN C', "The modifier 'sync' is not allowed for an exrpression function body", "Conv ert the body to a block.");
8004 8016
8005 static const ParserErrorCode INVALID_UNICODE_ESCAPE = const ParserErrorCode('I NVALID_UNICODE_ESCAPE', "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'"); 8017 static const ParserErrorCode INVALID_UNICODE_ESCAPE = const ParserErrorCode('I NVALID_UNICODE_ESCAPE', "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
8006 8018
8007 static const ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = const ParserErrorCo de('LIBRARY_DIRECTIVE_NOT_FIRST', "The library directive must appear before all other directives"); 8019 static const ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = const ParserErrorCo de('LIBRARY_DIRECTIVE_NOT_FIRST', "The library directive must appear before all other directives");
8008 8020
8009 static const ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = const Parse rErrorCode('LOCAL_FUNCTION_DECLARATION_MODIFIER', "Local function declarations c annot specify any modifier"); 8021 static const ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = const Parse rErrorCode('LOCAL_FUNCTION_DECLARATION_MODIFIER', "Local function declarations c annot specify any modifier");
8010 8022
8011 static const ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = const ParserErrorCo de('MISSING_ASSIGNABLE_SELECTOR', "Missing selector such as \".<identifier>\" or \"[0]\""); 8023 static const ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = const ParserErrorCo de('MISSING_ASSIGNABLE_SELECTOR', "Missing selector such as \".<identifier>\" or \"[0]\"");
8012 8024
8025 static const ParserErrorCode MISSING_ASSIGNMENT_IN_INITIALIZER
8026 = const ParserErrorCode(
8027 'MISSING_ASSIGNMENT_IN_INITIALIZER',
8028 "Expected an assignment after the field name");
8029
8013 static const ParserErrorCode MISSING_CATCH_OR_FINALLY = const ParserErrorCode( 'MISSING_CATCH_OR_FINALLY', "A try statement must have either a catch or finally clause"); 8030 static const ParserErrorCode MISSING_CATCH_OR_FINALLY = const ParserErrorCode( 'MISSING_CATCH_OR_FINALLY', "A try statement must have either a catch or finally clause");
8014 8031
8015 static const ParserErrorCode MISSING_CLASS_BODY = const ParserErrorCode('MISSI NG_CLASS_BODY', "A class definition must have a body, even if it is empty"); 8032 static const ParserErrorCode MISSING_CLASS_BODY = const ParserErrorCode('MISSI NG_CLASS_BODY', "A class definition must have a body, even if it is empty");
8016 8033
8017 static const ParserErrorCode MISSING_CLOSING_PARENTHESIS = const ParserErrorCo de('MISSING_CLOSING_PARENTHESIS', "The closing parenthesis is missing"); 8034 static const ParserErrorCode MISSING_CLOSING_PARENTHESIS = const ParserErrorCo de('MISSING_CLOSING_PARENTHESIS', "The closing parenthesis is missing");
8018 8035
8019 static const ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = const ParserErr orCode('MISSING_CONST_FINAL_VAR_OR_TYPE', "Variables must be declared using the keywords 'const', 'final', 'var' or a type name"); 8036 static const ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = const ParserErr orCode('MISSING_CONST_FINAL_VAR_OR_TYPE', "Variables must be declared using the keywords 'const', 'final', 'var' or a type name");
8020 8037
8021 static const ParserErrorCode MISSING_ENUM_BODY = const ParserErrorCode('MISSIN G_ENUM_BODY', "An enum definition must have a body with at least one constant na me"); 8038 static const ParserErrorCode MISSING_ENUM_BODY = const ParserErrorCode('MISSIN G_ENUM_BODY', "An enum definition must have a body with at least one constant na me");
8022 8039
8040 static const ParserErrorCode MISSING_EXPRESSION_IN_INITIALIZER
8041 = const ParserErrorCode(
8042 'MISSING_EXPRESSION_IN_INITIALIZER',
8043 "Expected an expression after the assignment operator");
8044
8023 static const ParserErrorCode MISSING_EXPRESSION_IN_THROW = const ParserErrorCo de('MISSING_EXPRESSION_IN_THROW', "Throw expressions must compute the object to be thrown"); 8045 static const ParserErrorCode MISSING_EXPRESSION_IN_THROW = const ParserErrorCo de('MISSING_EXPRESSION_IN_THROW', "Throw expressions must compute the object to be thrown");
8024 8046
8025 static const ParserErrorCode MISSING_FUNCTION_BODY = const ParserErrorCode('MI SSING_FUNCTION_BODY', "A function body must be provided"); 8047 static const ParserErrorCode MISSING_FUNCTION_BODY = const ParserErrorCode('MI SSING_FUNCTION_BODY', "A function body must be provided");
8026 8048
8027 static const ParserErrorCode MISSING_FUNCTION_PARAMETERS = const ParserErrorCo de('MISSING_FUNCTION_PARAMETERS', "Functions must have an explicit list of param eters"); 8049 static const ParserErrorCode MISSING_FUNCTION_PARAMETERS = const ParserErrorCo de('MISSING_FUNCTION_PARAMETERS', "Functions must have an explicit list of param eters");
8028 8050
8029 static const ParserErrorCode MISSING_GET = const ParserErrorCode('MISSING_GET' , "Getters must have the keyword 'get' before the getter name"); 8051 static const ParserErrorCode MISSING_GET = const ParserErrorCode('MISSING_GET' , "Getters must have the keyword 'get' before the getter name");
8030 8052
8031 static const ParserErrorCode MISSING_IDENTIFIER = const ParserErrorCode('MISSI NG_IDENTIFIER', "Expected an identifier"); 8053 static const ParserErrorCode MISSING_IDENTIFIER = const ParserErrorCode('MISSI NG_IDENTIFIER', "Expected an identifier");
8032 8054
8055 static const ParserErrorCode MISSING_INITIALIZER
8056 = const ParserErrorCode('MISSING_INITIALIZER', "Expected an initializer");
8057
8033 static const ParserErrorCode MISSING_KEYWORD_OPERATOR = const ParserErrorCode( 'MISSING_KEYWORD_OPERATOR', "Operator declarations must be preceeded by the keyw ord 'operator'"); 8058 static const ParserErrorCode MISSING_KEYWORD_OPERATOR = const ParserErrorCode( 'MISSING_KEYWORD_OPERATOR', "Operator declarations must be preceeded by the keyw ord 'operator'");
8034 8059
8035 static const ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = const ParserE rrorCode('MISSING_NAME_IN_LIBRARY_DIRECTIVE', "Library directives must include a library name"); 8060 static const ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = const ParserE rrorCode('MISSING_NAME_IN_LIBRARY_DIRECTIVE', "Library directives must include a library name");
8036 8061
8037 static const ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = const ParserE rrorCode('MISSING_NAME_IN_PART_OF_DIRECTIVE', "Library directives must include a library name"); 8062 static const ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = const ParserE rrorCode('MISSING_NAME_IN_PART_OF_DIRECTIVE', "Library directives must include a library name");
8038 8063
8039 static const ParserErrorCode MISSING_PREFIX_IN_DEFERRED_IMPORT = const ParserE rrorCode('MISSING_PREFIX_IN_DEFERRED_IMPORT', "Deferred imports must have a pref ix"); 8064 static const ParserErrorCode MISSING_PREFIX_IN_DEFERRED_IMPORT = const ParserE rrorCode('MISSING_PREFIX_IN_DEFERRED_IMPORT', "Deferred imports must have a pref ix");
8040 8065
8041 static const ParserErrorCode MISSING_STAR_AFTER_SYNC = const ParserErrorCode(' MISSING_STAR_AFTER_SYNC', "The modifier 'sync' must be followed by a star ('*')" , "Remove the modifier or add a star."); 8066 static const ParserErrorCode MISSING_STAR_AFTER_SYNC = const ParserErrorCode(' MISSING_STAR_AFTER_SYNC', "The modifier 'sync' must be followed by a star ('*')" , "Remove the modifier or add a star.");
8042 8067
(...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after
9782 return trampoline(target, arguments[0], arguments[1]); 9807 return trampoline(target, arguments[0], arguments[1]);
9783 case 3: 9808 case 3:
9784 return trampoline(target, arguments[0], arguments[1], arguments[2]); 9809 return trampoline(target, arguments[0], arguments[1], arguments[2]);
9785 case 4: 9810 case 4:
9786 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]); 9811 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]);
9787 default: 9812 default:
9788 throw new IllegalArgumentException("Not implemented for > 4 arguments"); 9813 throw new IllegalArgumentException("Not implemented for > 4 arguments");
9789 } 9814 }
9790 } 9815 }
9791 } 9816 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/java_core.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698