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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 731503002: cps-ir: Split up main codegen and add a bailout exception to print out (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Refactor. Created 6 years, 1 month 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: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index e26fcb5a1248ac854c8e2303f37219c963a28868..967080ab36f49e0f2ca12392319abab4df14d3e9 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -9,9 +9,16 @@ import '../../js/js.dart' as js;
import '../../elements/elements.dart';
import '../../util/maplet.dart';
-class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
- static const String UNIMPLEMENTED = "Javascript generation aborted";
+class CodegenBailout {
+ final tree_ir.Node node;
+ final String reason;
+ CodegenBailout(this.node, this.reason);
+ String get message {
+ return 'bailout${node != null ? " on $node" : ""}: $reason';
+ }
+}
+class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
/// Variables to be hoisted at the top of the current function.
List<js.VariableDeclaration> variables = <js.VariableDeclaration>[];
@@ -47,8 +54,9 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
return arguments.map(visitExpression).toList();
}
- giveup(tree_ir.Node node) {
- throw UNIMPLEMENTED;
+ giveup(tree_ir.Node node,
+ [String reason = 'unimplemented in CodeGenerator']) {
+ throw new CodegenBailout(node, reason);
}
@override
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698