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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart

Issue 231863007: Support local variables in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 6 years, 8 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
Index: sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart
index 2ba25bf15c1406242b7fef6edb2147fd1a568f27..1d6bdad4a9b8113762b13e4a377a994560e6763a 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart
@@ -216,9 +216,18 @@ class Builder extends ir.Visitor<Expression> {
Builder(this.compiler);
+ static final String _bailout = 'Bailout Tree Builder';
+
+ bailout() => throw _bailout;
+
FunctionDefinition build(ir.FunctionDefinition node) {
- visit(node);
- return function;
+ try {
+ visit(node);
+ return function;
+ } catch (e) {
+ if (e == _bailout) return null;
+ rethrow;
+ }
}
List<Expression> translateArguments(List<ir.Reference> args) {
@@ -289,7 +298,12 @@ class Builder extends ir.Visitor<Expression> {
// TODO(kmillikin): Support non-return continuations. These could arise
// due to local control flow or due to inlining or other optimization.
assert(node.continuation.definition == returnContinuation);
- return new Return(variables[node.argument.definition]);
+ assert(node.arguments.length == 1);
+ return new Return(variables[node.arguments[0].definition]);
+ }
+
+ Expression visitBranch(ir.Branch node) {
+ return bailout();
}
Expression visitConstant(ir.Constant node) {

Powered by Google App Engine
This is Rietveld 408576698