| 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 library engine.parser; | 5 library engine.parser; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'ast.dart'; | 10 import 'ast.dart'; |
| (...skipping 5171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5182 new VariableDeclaration(_createSyntheticIdentifier(), null, null)); | 5182 new VariableDeclaration(_createSyntheticIdentifier(), null, null)); |
| 5183 return new TopLevelVariableDeclaration( | 5183 return new TopLevelVariableDeclaration( |
| 5184 commentAndMetadata.comment, | 5184 commentAndMetadata.comment, |
| 5185 commentAndMetadata.metadata, | 5185 commentAndMetadata.metadata, |
| 5186 new VariableDeclarationList(null, null, keyword, null, variables), | 5186 new VariableDeclarationList(null, null, keyword, null, variables), |
| 5187 _expectSemicolon()); | 5187 _expectSemicolon()); |
| 5188 } | 5188 } |
| 5189 _reportErrorForToken(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); | 5189 _reportErrorForToken(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); |
| 5190 return null; | 5190 return null; |
| 5191 } else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { | 5191 } else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { |
| 5192 TypeName returnType = _parseOptionalTypeNameComment(); |
| 5192 _validateModifiersForTopLevelFunction(modifiers); | 5193 _validateModifiersForTopLevelFunction(modifiers); |
| 5193 return _parseFunctionDeclaration( | 5194 return _parseFunctionDeclaration( |
| 5194 commentAndMetadata, modifiers.externalKeyword, null); | 5195 commentAndMetadata, modifiers.externalKeyword, returnType); |
| 5195 } else if (_peek() | 5196 } else if (_peek() |
| 5196 .matchesAny([TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { | 5197 .matchesAny([TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { |
| 5197 if (modifiers.constKeyword == null && | 5198 if (modifiers.constKeyword == null && |
| 5198 modifiers.finalKeyword == null && | 5199 modifiers.finalKeyword == null && |
| 5199 modifiers.varKeyword == null) { | 5200 modifiers.varKeyword == null) { |
| 5200 _reportErrorForCurrentToken( | 5201 _reportErrorForCurrentToken( |
| 5201 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE); | 5202 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE); |
| 5202 } | 5203 } |
| 5203 return new TopLevelVariableDeclaration( | 5204 return new TopLevelVariableDeclaration( |
| 5204 commentAndMetadata.comment, | 5205 commentAndMetadata.comment, |
| (...skipping 5971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11176 } | 11177 } |
| 11177 | 11178 |
| 11178 /** | 11179 /** |
| 11179 * Copy resolution data from the [fromNode] to the [toNode]. | 11180 * Copy resolution data from the [fromNode] to the [toNode]. |
| 11180 */ | 11181 */ |
| 11181 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 11182 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
| 11182 ResolutionCopier copier = new ResolutionCopier(); | 11183 ResolutionCopier copier = new ResolutionCopier(); |
| 11183 copier._isEqualNodes(fromNode, toNode); | 11184 copier._isEqualNodes(fromNode, toNode); |
| 11184 } | 11185 } |
| 11185 } | 11186 } |
| OLD | NEW |