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

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

Issue 2752543005: Parse try-catch statements with Fasta. (Closed)
Patch Set: Update the status file. 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') | pkg/front_end/test/fasta/kompile.status » ('j') | 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 6a0f0896e077806775ba56fc15e010d536d322ab..e4e9f48e0cc86b17888070951a485d1e0cceb751 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
@@ -785,34 +785,37 @@ class AstBuilder extends ScopeListener {
void handleCatchBlock(Token onKeyword, Token catchKeyword) {
debugEvent("CatchBlock");
Block body = pop();
- FormalParameterList catchParameters = popIfNotNull(catchKeyword);
- if (catchKeyword != null) {
- exitLocalScope();
- }
+ 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') | pkg/front_end/test/fasta/kompile.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698