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

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

Issue 2895743002: Fix parser bug found while trying to reproduce a different bug (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;
6
7 import 'dart:collection'; 5 import 'dart:collection';
8 import "dart:math" as math; 6 import "dart:math" as math;
9 7
10 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
11 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
12 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
13 import 'package:analyzer/error/error.dart'; 11 import 'package:analyzer/error/error.dart';
14 import 'package:analyzer/error/listener.dart'; 12 import 'package:analyzer/error/listener.dart';
15 import 'package:analyzer/src/dart/ast/ast.dart'; 13 import 'package:analyzer/src/dart/ast/ast.dart';
16 import 'package:analyzer/src/dart/ast/token.dart'; 14 import 'package:analyzer/src/dart/ast/token.dart';
(...skipping 5493 matching lines...) Expand 10 before | Expand all | Expand 10 after
5510 * actually creating a formal parameter list or changing the current token. 5508 * actually creating a formal parameter list or changing the current token.
5511 * Return the token following the parameter list that was parsed, or `null` 5509 * Return the token following the parameter list that was parsed, or `null`
5512 * if the given token is not the first token in a valid parameter list. 5510 * if the given token is not the first token in a valid parameter list.
5513 * 5511 *
5514 * This method must be kept in sync with [parseFormalParameterList]. 5512 * This method must be kept in sync with [parseFormalParameterList].
5515 */ 5513 */
5516 Token skipFormalParameterList(Token startToken) { 5514 Token skipFormalParameterList(Token startToken) {
5517 if (!_tokenMatches(startToken, TokenType.OPEN_PAREN)) { 5515 if (!_tokenMatches(startToken, TokenType.OPEN_PAREN)) {
5518 return null; 5516 return null;
5519 } 5517 }
5520 return (startToken as BeginToken).endToken.next; 5518 return (startToken as BeginToken).endToken?.next;
5521 } 5519 }
5522 5520
5523 /** 5521 /**
5524 * Parse the portion of a generic function type after the return type, 5522 * Parse the portion of a generic function type after the return type,
5525 * starting at the [startToken], without actually creating a generic function 5523 * starting at the [startToken], without actually creating a generic function
5526 * type or changing the current token. Return the token following the generic 5524 * type or changing the current token. Return the token following the generic
5527 * function type that was parsed, or `null` if the given token is not the 5525 * function type that was parsed, or `null` if the given token is not the
5528 * first token in a valid generic function type. 5526 * first token in a valid generic function type.
5529 * 5527 *
5530 * This method must be kept in sync with 5528 * This method must be kept in sync with
(...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after
8601 } 8599 }
8602 } 8600 }
8603 } 8601 }
8604 8602
8605 /** 8603 /**
8606 * Instances of this class are thrown when the parser detects that AST has 8604 * Instances of this class are thrown when the parser detects that AST has
8607 * too many nested expressions to be parsed safely and avoid possibility of 8605 * too many nested expressions to be parsed safely and avoid possibility of
8608 * [StackOverflowError] in the parser or during later analysis. 8606 * [StackOverflowError] in the parser or during later analysis.
8609 */ 8607 */
8610 class _TooDeepTreeError {} 8608 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