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 analyzer.src.generated.parser; | 5 library analyzer.src.generated.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 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 TokenType.EQ, | 2087 TokenType.EQ, |
2088 TokenType.COMMA, | 2088 TokenType.COMMA, |
2089 TokenType.SEMICOLON | 2089 TokenType.SEMICOLON |
2090 ])) { | 2090 ])) { |
2091 if (returnType is! GenericFunctionType) { | 2091 if (returnType is! GenericFunctionType) { |
2092 _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType); | 2092 _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType); |
2093 } | 2093 } |
2094 return astFactory.topLevelVariableDeclaration( | 2094 return astFactory.topLevelVariableDeclaration( |
2095 commentAndMetadata.comment, | 2095 commentAndMetadata.comment, |
2096 commentAndMetadata.metadata, | 2096 commentAndMetadata.metadata, |
2097 parseVariableDeclarationListAfterType( | 2097 parseVariableDeclarationListAfterType(null, |
2098 null, _validateModifiersForTopLevelVariable(modifiers), null), | 2098 _validateModifiersForTopLevelVariable(modifiers), returnType), |
2099 _expect(TokenType.SEMICOLON)); | 2099 _expect(TokenType.SEMICOLON)); |
2100 } else { | 2100 } else { |
2101 // | 2101 // |
2102 // We have found an error of some kind. Try to recover. | 2102 // We have found an error of some kind. Try to recover. |
2103 // | 2103 // |
2104 _reportErrorForToken( | 2104 _reportErrorForToken( |
2105 ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); | 2105 ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); |
2106 return null; | 2106 return null; |
2107 } | 2107 } |
2108 } else if ((keyword == Keyword.GET || keyword == Keyword.SET) && | 2108 } else if ((keyword == Keyword.GET || keyword == Keyword.SET) && |
(...skipping 6449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8558 } | 8558 } |
8559 if (modifiers.finalKeyword != null) { | 8559 if (modifiers.finalKeyword != null) { |
8560 _reportErrorForToken( | 8560 _reportErrorForToken( |
8561 ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword); | 8561 ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword); |
8562 } | 8562 } |
8563 if (modifiers.varKeyword != null) { | 8563 if (modifiers.varKeyword != null) { |
8564 _reportErrorForToken(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword); | 8564 _reportErrorForToken(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword); |
8565 } | 8565 } |
8566 } | 8566 } |
8567 } | 8567 } |
OLD | NEW |