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

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

Issue 1465153005: fix return type comment parsing for top-level generic function (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698