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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1201983002: Implement try/finally by inlining the finally code. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Merge, rebase test expectations. Created 5 years, 6 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/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index b2cd35a6cf324e01f1d8790eed3cef2942c40595..e6f392a78bf7b3e5646a3280a9aab6cd5f32b722 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -429,9 +429,9 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
visitTryStatement(ast.TryStatement node) {
- // Finally blocks are not yet implemented.
- if (node.finallyBlock != null) {
- return giveup(node, 'try/finally');
+ // Try/catch/finally is not yet implemented.
+ if (!node.catchBlocks.isEmpty && node.finallyBlock != null) {
+ return giveup(node, 'try/catch/finally');
}
List<CatchClauseInfo> catchClauseInfos = <CatchClauseInfo>[];
@@ -453,10 +453,13 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
buildCatchBlock: subbuild(catchClause.block)));
}
+ SubbuildFunction buildFinallyBlock =
+ node.finallyBlock == null ? null : subbuild(node.finallyBlock);
irBuilder.buildTry(
tryStatementInfo: tryStatements[node],
buildTryBlock: subbuild(node.tryBlock),
catchClauseInfos: catchClauseInfos,
+ buildFinallyBlock: buildFinallyBlock,
closureClassMap: closureClassMap);
}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698