| OLD | NEW |
| 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 4125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4136 * @param expression the expression being checked | 4136 * @param expression the expression being checked |
| 4137 */ | 4137 */ |
| 4138 void _ensureAssignable(Expression expression) { | 4138 void _ensureAssignable(Expression expression) { |
| 4139 if (expression != null && !expression.isAssignable) { | 4139 if (expression != null && !expression.isAssignable) { |
| 4140 _reportErrorForCurrentToken( | 4140 _reportErrorForCurrentToken( |
| 4141 ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE); | 4141 ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE); |
| 4142 } | 4142 } |
| 4143 } | 4143 } |
| 4144 | 4144 |
| 4145 /** | 4145 /** |
| 4146 * If the current token has the expected type, return it after advancing to th
e next token. | 4146 * If the current token has the expected type, return it after advancing to |
| 4147 * Otherwise report an error and return the current token without advancing. N
ote that the method | 4147 * the next token. Otherwise report an error and return the current token |
| 4148 * [_expectGt] should be used if the argument to this method would be [TokenTy
pe.GT]. | 4148 * without advancing. |
| 4149 * | 4149 * |
| 4150 * @param type the type of token that is expected | 4150 * Note that the method [_expectGt] should be used if the argument to this |
| 4151 * @return the token that matched the given type | 4151 * method would be [TokenType.GT]. |
| 4152 * |
| 4153 * The [type] is the type of token that is expected. |
| 4152 */ | 4154 */ |
| 4153 Token _expect(TokenType type) { | 4155 Token _expect(TokenType type) { |
| 4154 if (_matches(type)) { | 4156 if (_matches(type)) { |
| 4155 return andAdvance; | 4157 return andAdvance; |
| 4156 } | 4158 } |
| 4157 // Remove uses of this method in favor of matches? | 4159 // Remove uses of this method in favor of matches? |
| 4158 // Pass in the error code to use to report the error? | 4160 // Pass in the error code to use to report the error? |
| 4159 if (type == TokenType.SEMICOLON) { | 4161 if (type == TokenType.SEMICOLON) { |
| 4162 if (_tokenMatches(_currentToken.next, TokenType.SEMICOLON)) { |
| 4163 _reportErrorForCurrentToken( |
| 4164 ParserErrorCode.UNEXPECTED_TOKEN, |
| 4165 [_currentToken.lexeme]); |
| 4166 _advance(); |
| 4167 return andAdvance; |
| 4168 } |
| 4160 _reportErrorForToken( | 4169 _reportErrorForToken( |
| 4161 ParserErrorCode.EXPECTED_TOKEN, | 4170 ParserErrorCode.EXPECTED_TOKEN, |
| 4162 _currentToken.previous, | 4171 _currentToken.previous, |
| 4163 [type.lexeme]); | 4172 [type.lexeme]); |
| 4164 } else { | 4173 } else { |
| 4165 _reportErrorForCurrentToken( | 4174 _reportErrorForCurrentToken( |
| 4166 ParserErrorCode.EXPECTED_TOKEN, | 4175 ParserErrorCode.EXPECTED_TOKEN, |
| 4167 [type.lexeme]); | 4176 [type.lexeme]); |
| 4168 } | 4177 } |
| 4169 return _currentToken; | 4178 return _currentToken; |
| (...skipping 3120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7290 * @param returnType the return type of the method | 7299 * @param returnType the return type of the method |
| 7291 * @return the method declaration that was parsed | 7300 * @return the method declaration that was parsed |
| 7292 */ | 7301 */ |
| 7293 MethodDeclaration | 7302 MethodDeclaration |
| 7294 _parseMethodDeclarationAfterReturnType(CommentAndMetadata commentAndMetada
ta, | 7303 _parseMethodDeclarationAfterReturnType(CommentAndMetadata commentAndMetada
ta, |
| 7295 Token externalKeyword, Token staticKeyword, TypeName returnType) { | 7304 Token externalKeyword, Token staticKeyword, TypeName returnType) { |
| 7296 SimpleIdentifier methodName = parseSimpleIdentifier(); | 7305 SimpleIdentifier methodName = parseSimpleIdentifier(); |
| 7297 FormalParameterList parameters; | 7306 FormalParameterList parameters; |
| 7298 if (!_matches(TokenType.OPEN_PAREN) && | 7307 if (!_matches(TokenType.OPEN_PAREN) && |
| 7299 (_matches(TokenType.OPEN_CURLY_BRACKET) || _matches(TokenType.FUNCTION))
) { | 7308 (_matches(TokenType.OPEN_CURLY_BRACKET) || _matches(TokenType.FUNCTION))
) { |
| 7300 _reportErrorForToken(ParserErrorCode.MISSING_METHOD_PARAMETERS, _currentTo
ken.previous); | 7309 _reportErrorForToken( |
| 7310 ParserErrorCode.MISSING_METHOD_PARAMETERS, |
| 7311 _currentToken.previous); |
| 7301 parameters = new FormalParameterList( | 7312 parameters = new FormalParameterList( |
| 7302 _createSyntheticToken(TokenType.OPEN_PAREN), | 7313 _createSyntheticToken(TokenType.OPEN_PAREN), |
| 7303 null, | 7314 null, |
| 7304 null, | 7315 null, |
| 7305 null, | 7316 null, |
| 7306 _createSyntheticToken(TokenType.CLOSE_PAREN)); | 7317 _createSyntheticToken(TokenType.CLOSE_PAREN)); |
| 7307 } else { | 7318 } else { |
| 7308 parameters = parseFormalParameterList(); | 7319 parameters = parseFormalParameterList(); |
| 7309 } | 7320 } |
| 7310 _validateFormalParameterList(parameters); | 7321 _validateFormalParameterList(parameters); |
| 7311 return _parseMethodDeclarationAfterParameters( | 7322 return _parseMethodDeclarationAfterParameters( |
| 7312 commentAndMetadata, | 7323 commentAndMetadata, |
| 7313 externalKeyword, | 7324 externalKeyword, |
| 7314 staticKeyword, | 7325 staticKeyword, |
| 7315 returnType, | 7326 returnType, |
| 7316 methodName, | 7327 methodName, |
| (...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10407 | 10418 |
| 10408 static const ParserErrorCode MISSING_FUNCTION_BODY = const ParserErrorCode( | 10419 static const ParserErrorCode MISSING_FUNCTION_BODY = const ParserErrorCode( |
| 10409 'MISSING_FUNCTION_BODY', | 10420 'MISSING_FUNCTION_BODY', |
| 10410 "A function body must be provided"); | 10421 "A function body must be provided"); |
| 10411 | 10422 |
| 10412 static const ParserErrorCode MISSING_FUNCTION_PARAMETERS = | 10423 static const ParserErrorCode MISSING_FUNCTION_PARAMETERS = |
| 10413 const ParserErrorCode( | 10424 const ParserErrorCode( |
| 10414 'MISSING_FUNCTION_PARAMETERS', | 10425 'MISSING_FUNCTION_PARAMETERS', |
| 10415 "Functions must have an explicit list of parameters"); | 10426 "Functions must have an explicit list of parameters"); |
| 10416 | 10427 |
| 10417 static const ParserErrorCode MISSING_METHOD_PARAMETERS = const ParserErrorCode
( | 10428 static const ParserErrorCode MISSING_METHOD_PARAMETERS = |
| 10418 'MISSING_METHOD_PARAMETERS', | 10429 const ParserErrorCode( |
| 10419 "Methods must have an explicit list of parameters"); | 10430 'MISSING_METHOD_PARAMETERS', |
| 10431 "Methods must have an explicit list of parameters"); |
| 10420 | 10432 |
| 10421 static const ParserErrorCode MISSING_GET = const ParserErrorCode( | 10433 static const ParserErrorCode MISSING_GET = const ParserErrorCode( |
| 10422 'MISSING_GET', | 10434 'MISSING_GET', |
| 10423 "Getters must have the keyword 'get' before the getter name"); | 10435 "Getters must have the keyword 'get' before the getter name"); |
| 10424 | 10436 |
| 10425 static const ParserErrorCode MISSING_IDENTIFIER = | 10437 static const ParserErrorCode MISSING_IDENTIFIER = |
| 10426 const ParserErrorCode('MISSING_IDENTIFIER', "Expected an identifier"); | 10438 const ParserErrorCode('MISSING_IDENTIFIER', "Expected an identifier"); |
| 10427 | 10439 |
| 10428 static const ParserErrorCode MISSING_INITIALIZER = | 10440 static const ParserErrorCode MISSING_INITIALIZER = |
| 10429 const ParserErrorCode('MISSING_INITIALIZER', "Expected an initializer"); | 10441 const ParserErrorCode('MISSING_INITIALIZER', "Expected an initializer"); |
| (...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12110 * Copy resolution data from one node to another. | 12122 * Copy resolution data from one node to another. |
| 12111 * | 12123 * |
| 12112 * @param fromNode the node from which resolution information will be copied | 12124 * @param fromNode the node from which resolution information will be copied |
| 12113 * @param toNode the node to which resolution information will be copied | 12125 * @param toNode the node to which resolution information will be copied |
| 12114 */ | 12126 */ |
| 12115 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 12127 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
| 12116 ResolutionCopier copier = new ResolutionCopier(); | 12128 ResolutionCopier copier = new ResolutionCopier(); |
| 12117 copier._isEqualNodes(fromNode, toNode); | 12129 copier._isEqualNodes(fromNode, toNode); |
| 12118 } | 12130 } |
| 12119 } | 12131 } |
| OLD | NEW |