| 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.
|
| 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";
|
| + }
|
| }
|
|
|