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

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

Issue 920703002: cps2js: Clean up some obsolete TODOs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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_nodes.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b773f951f9a8642e8b5e173e54fc757832eaf8bd..b1f03bfd730a7d0ba27a186869a9f6320274ff53 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -95,9 +95,8 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
/// Generates a name for the given variable. First trying with the name of
/// the [Variable.element] if it is non-null.
String getVariableName(tree_ir.Variable variable) {
- // TODO(sigurdm): Handle case where the variable belongs to an enclosing
- // function.
- if (variable.host != currentFunction) giveup(variable);
+ // Functions are not nested in the JS backend.
+ assert(variable.host == currentFunction);
// Get the name if we already have one.
String name = variableNames[variable];
@@ -176,12 +175,6 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
return buildConstant(node.expression.value);
}
- @override
- js.Expression visitFunctionExpression(tree_ir.FunctionExpression node) {
- return giveup(node);
- // TODO: implement visitFunctionExpression
- }
-
js.Expression compileConstant(ParameterElement parameter) {
return buildConstant(glue.getConstantForVariable(parameter).value);
}
@@ -342,7 +335,6 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
@override
js.Expression visitThis(tree_ir.This node) {
- // TODO(sigurdm): Inside a js closure this will not work.
asgerf 2015/02/12 10:40:20 The CPS builder takes care of this.
return new js.This();
}
@@ -379,12 +371,6 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
}
@override
- void visitFunctionDeclaration(tree_ir.FunctionDeclaration node) {
- giveup(node);
- // TODO: implement visitFunctionDeclaration
- }
-
- @override
void visitIf(tree_ir.If node) {
accumulator.add(new js.If(visitExpression(node.condition),
buildBody(node.thenStatement),
@@ -489,18 +475,6 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
}
@override
- js.Expression visitFieldInitializer(tree_ir.FieldInitializer node) {
- return giveup(node);
- // TODO: implement FieldInitializer
- }
-
- @override
- js.Expression visitSuperInitializer(tree_ir.SuperInitializer node) {
- return giveup(node);
- // TODO: implement SuperInitializer
- }
-
- @override
js.Expression visitCreateBox(tree_ir.CreateBox node) {
return new js.ObjectInitializer([]);
}
@@ -529,4 +503,30 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
accumulator.add(new js.ExpressionStatement(asn));
visitStatement(node.next);
}
+
+ // Dart-specific IR nodes
+
+ @override
+ visitFunctionExpression(tree_ir.FunctionExpression node) {
+ return errorUnsupportedNode(node);
+ }
+
+ @override
+ visitFunctionDeclaration(tree_ir.FunctionDeclaration node) {
+ return errorUnsupportedNode(node);
+ }
+
+ @override
+ visitFieldInitializer(tree_ir.FieldInitializer node) {
+ return errorUnsupportedNode(node);
+ }
+
+ @override
+ visitSuperInitializer(tree_ir.SuperInitializer node) {
+ return errorUnsupportedNode(node);
+ }
+
+ dynamic errorUnsupportedNode(tree_ir.DartSpecificNode node) {
+ throw "Unsupported node in JS backend: $node";
+ }
}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698