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 5108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5119 return _parseFunctionDeclaration( | 5119 return _parseFunctionDeclaration( |
5120 commentAndMetadata, modifiers.externalKeyword, returnType); | 5120 commentAndMetadata, modifiers.externalKeyword, returnType); |
5121 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { | 5121 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { |
5122 _reportErrorForToken(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken); | 5122 _reportErrorForToken(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken); |
5123 return _convertToFunctionDeclaration(_parseOperator( | 5123 return _convertToFunctionDeclaration(_parseOperator( |
5124 commentAndMetadata, modifiers.externalKeyword, returnType)); | 5124 commentAndMetadata, modifiers.externalKeyword, returnType)); |
5125 } else if (_matchesIdentifier() && | 5125 } else if (_matchesIdentifier() && |
5126 _peek().matchesAny([ | 5126 _peek().matchesAny([ |
5127 TokenType.OPEN_PAREN, | 5127 TokenType.OPEN_PAREN, |
5128 TokenType.OPEN_CURLY_BRACKET, | 5128 TokenType.OPEN_CURLY_BRACKET, |
5129 TokenType.FUNCTION | 5129 TokenType.FUNCTION, |
| 5130 TokenType.LT |
5130 ])) { | 5131 ])) { |
5131 _validateModifiersForTopLevelFunction(modifiers); | 5132 _validateModifiersForTopLevelFunction(modifiers); |
5132 return _parseFunctionDeclaration( | 5133 return _parseFunctionDeclaration( |
5133 commentAndMetadata, modifiers.externalKeyword, returnType); | 5134 commentAndMetadata, modifiers.externalKeyword, returnType); |
5134 } else { | 5135 } else { |
5135 // | 5136 // |
5136 // We have found an error of some kind. Try to recover. | 5137 // We have found an error of some kind. Try to recover. |
5137 // | 5138 // |
5138 if (_matchesIdentifier()) { | 5139 if (_matchesIdentifier()) { |
5139 if (_peek().matchesAny( | 5140 if (_peek().matchesAny( |
(...skipping 6034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11174 } | 11175 } |
11175 | 11176 |
11176 /** | 11177 /** |
11177 * Copy resolution data from the [fromNode] to the [toNode]. | 11178 * Copy resolution data from the [fromNode] to the [toNode]. |
11178 */ | 11179 */ |
11179 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 11180 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
11180 ResolutionCopier copier = new ResolutionCopier(); | 11181 ResolutionCopier copier = new ResolutionCopier(); |
11181 copier._isEqualNodes(fromNode, toNode); | 11182 copier._isEqualNodes(fromNode, toNode); |
11182 } | 11183 } |
11183 } | 11184 } |
OLD | NEW |