OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 fasta.parser.parser; | 5 library fasta.parser.parser; |
6 | 6 |
7 import '../scanner.dart' show | 7 import '../scanner.dart' show |
8 ErrorToken; | 8 ErrorToken; |
9 | 9 |
10 import '../scanner/recover.dart' show | 10 import '../scanner/recover.dart' show |
(...skipping 2437 matching lines...) Loading... | |
2448 mayParseFunctionExpressions = true; | 2448 mayParseFunctionExpressions = true; |
2449 token = parseParenthesizedExpression(token); | 2449 token = parseParenthesizedExpression(token); |
2450 mayParseFunctionExpressions = old; | 2450 mayParseFunctionExpressions = old; |
2451 return token; | 2451 return token; |
2452 } | 2452 } |
2453 } | 2453 } |
2454 | 2454 |
2455 Token parseParenthesizedExpression(Token token) { | 2455 Token parseParenthesizedExpression(Token token) { |
2456 // We expect [begin] to be of type [BeginGroupToken], but we don't know for | 2456 // We expect [begin] to be of type [BeginGroupToken], but we don't know for |
2457 // sure until after calling expect. | 2457 // sure until after calling expect. |
2458 var begin = token; | 2458 BeginGroupToken begin = token; |
Siggi Cherem (dart-lang)
2017/02/02 04:26:58
strong mode infers `var` to be the type of the rhs
ahe
2017/02/02 07:28:30
The type should be dynamic. This cast isn't correc
kasperl
2017/02/02 07:51:30
var first = token;
token = expect('(', token);
Beg
Siggi Cherem (dart-lang)
2017/02/06 23:35:50
Sorry - I totally missed the comment. Thanks for c
| |
2459 token = expect('(', token); | 2459 token = expect('(', token); |
2460 // [begin] is now known to have type [BeginGroupToken]. | 2460 // [begin] is now known to have type [BeginGroupToken]. |
2461 token = parseExpression(token); | 2461 token = parseExpression(token); |
2462 if (!identical(begin.endGroup, token)) { | 2462 if (!identical(begin.endGroup, token)) { |
2463 reportUnrecoverableError(token, ErrorKind.UnexpectedToken); | 2463 reportUnrecoverableError(token, ErrorKind.UnexpectedToken); |
2464 token = begin.endGroup; | 2464 token = begin.endGroup; |
2465 } | 2465 } |
2466 listener.handleParenthesizedExpression(begin); | 2466 listener.handleParenthesizedExpression(begin); |
2467 return expect(')', token); | 2467 return expect(')', token); |
2468 } | 2468 } |
(...skipping 847 matching lines...) Loading... | |
3316 break; | 3316 break; |
3317 } | 3317 } |
3318 if (isRecoverable) { | 3318 if (isRecoverable) { |
3319 listener.handleRecoverableError(token, kind, arguments); | 3319 listener.handleRecoverableError(token, kind, arguments); |
3320 return null; | 3320 return null; |
3321 } else { | 3321 } else { |
3322 return listener.handleUnrecoverableError(token, kind, arguments); | 3322 return listener.handleUnrecoverableError(token, kind, arguments); |
3323 } | 3323 } |
3324 } | 3324 } |
3325 } | 3325 } |
OLD | NEW |