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

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

Issue 2837033003: Fix exception when parsing broken code (issue 29447) (Closed)
Patch Set: Created 3 years, 7 months 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/parser_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 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 5517 matching lines...) Expand 10 before | Expand all | Expand 10 after
5528 * function type that was parsed, or `null` if the given token is not the 5528 * function type that was parsed, or `null` if the given token is not the
5529 * first token in a valid generic function type. 5529 * first token in a valid generic function type.
5530 * 5530 *
5531 * This method must be kept in sync with 5531 * This method must be kept in sync with
5532 * [parseGenericFunctionTypeAfterReturnType]. 5532 * [parseGenericFunctionTypeAfterReturnType].
5533 */ 5533 */
5534 Token skipGenericFunctionTypeAfterReturnType(Token startToken) { 5534 Token skipGenericFunctionTypeAfterReturnType(Token startToken) {
5535 Token next = startToken.next; // Skip 'Function' 5535 Token next = startToken.next; // Skip 'Function'
5536 if (_tokenMatches(next, TokenType.LT)) { 5536 if (_tokenMatches(next, TokenType.LT)) {
5537 next = skipTypeParameterList(next); 5537 next = skipTypeParameterList(next);
5538 if (next == null) {
5539 return null;
5540 }
5538 } 5541 }
5539 return skipFormalParameterList(next); 5542 return skipFormalParameterList(next);
5540 } 5543 }
5541 5544
5542 /** 5545 /**
5543 * Parse a prefixed identifier, starting at the [startToken], without actually 5546 * Parse a prefixed identifier, starting at the [startToken], without actually
5544 * creating a prefixed identifier or changing the current token. Return the 5547 * creating a prefixed identifier or changing the current token. Return the
5545 * token following the prefixed identifier that was parsed, or `null` if the 5548 * token following the prefixed identifier that was parsed, or `null` if the
5546 * given token is not the first token in a valid prefixed identifier. 5549 * given token is not the first token in a valid prefixed identifier.
5547 * 5550 *
(...skipping 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after
8600 } 8603 }
8601 } 8604 }
8602 } 8605 }
8603 8606
8604 /** 8607 /**
8605 * Instances of this class are thrown when the parser detects that AST has 8608 * Instances of this class are thrown when the parser detects that AST has
8606 * too many nested expressions to be parsed safely and avoid possibility of 8609 * too many nested expressions to be parsed safely and avoid possibility of
8607 * [StackOverflowError] in the parser or during later analysis. 8610 * [StackOverflowError] in the parser or during later analysis.
8608 */ 8611 */
8609 class _TooDeepTreeError {} 8612 class _TooDeepTreeError {}
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698