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

Unified Diff: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart

Issue 2752543005: Parse try-catch statements with Fasta. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
index 34c6482dab79c5b3dc756bea50f3d4ebefcd8220..9f8eb5df819b1cd6ffdfc169d6c451af5b80b116 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
@@ -770,34 +770,37 @@ class AstBuilder extends ScopeListener {
void handleCatchBlock(Token onKeyword, Token catchKeyword) {
debugEvent("CatchBlock");
Block body = pop();
- FormalParameterList catchParameters = popIfNotNull(catchKeyword);
- if (catchKeyword != null) {
- exitLocalScope();
Paul Berry 2017/03/14 19:30:06 It's not obvious to me why it's safe to drop the c
scheglov 2017/03/14 19:34:42 No, this is an intentional change. There is no cor
Paul Berry 2017/03/14 19:39:01 Ok, thanks for clarifying.
- }
+ FormalParameterList catchParameterList = popIfNotNull(catchKeyword);
TypeAnnotation type = popIfNotNull(onKeyword);
SimpleIdentifier exception;
SimpleIdentifier stackTrace;
- if (catchParameters != null) {
+ if (catchParameterList != null) {
+ List<FormalParameter> catchParameters = catchParameterList.parameters;
if (catchParameters.length > 0) {
- exception = catchParameters.parameters[0].identifier;
+ exception = catchParameters[0].identifier;
}
if (catchParameters.length > 1) {
- stackTrace = catchParameters.parameters[1].identifier;
+ stackTrace = catchParameters[1].identifier;
}
}
- BeginGroupToken leftParenthesis = catchKeyword.next;
push(ast.catchClause(
toAnalyzerToken(onKeyword),
type,
toAnalyzerToken(catchKeyword),
- toAnalyzerToken(leftParenthesis),
+ catchParameterList?.leftParenthesis,
exception,
null,
stackTrace,
- toAnalyzerToken(leftParenthesis.endGroup),
+ catchParameterList?.rightParenthesis,
body));
}
+ @override
+ void handleFinallyBlock(Token finallyKeyword) {
+ debugEvent("FinallyBlock");
+ // The finally block is popped in "endTryStatement".
+ }
+
void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) {
Block finallyBlock = popIfNotNull(finallyKeyword);
List<CatchClause> catchClauses = popList(catchCount);
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698