OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library code_generator; | 5 library code_generator; |
6 | 6 |
7 import 'glue.dart'; | 7 import 'glue.dart'; |
8 | 8 |
9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; | 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; |
10 import '../../js/js.dart' as js; | 10 import '../../js/js.dart' as js; |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 } | 676 } |
677 } | 677 } |
678 | 678 |
679 @override | 679 @override |
680 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { | 680 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { |
681 List<js.Expression> arguments = | 681 List<js.Expression> arguments = |
682 node.arguments.map(visitExpression).toList(growable: false); | 682 node.arguments.map(visitExpression).toList(growable: false); |
683 return glue.generateTypeRepresentation(node.dartType, arguments); | 683 return glue.generateTypeRepresentation(node.dartType, arguments); |
684 } | 684 } |
685 | 685 |
686 // Dart-specific IR nodes | |
687 | |
688 @override | |
689 visitReifyTypeVar(tree_ir.ReifyTypeVar node) { | |
690 return errorUnsupportedNode(node); | |
691 } | |
692 | |
693 @override | |
694 visitFunctionExpression(tree_ir.FunctionExpression node) { | 686 visitFunctionExpression(tree_ir.FunctionExpression node) { |
695 return errorUnsupportedNode(node); | 687 // FunctionExpressions are currently unused. |
696 } | 688 // We might need them if we want to emit raw JS nested functions. |
697 | 689 throw 'FunctionExpressions should not be used'; |
698 @override | |
699 visitFunctionDeclaration(tree_ir.FunctionDeclaration node) { | |
700 return errorUnsupportedNode(node); | |
701 } | |
702 | |
703 @override | |
704 visitVariableDeclaration(tree_ir.VariableDeclaration node) { | |
705 return errorUnsupportedNode(node); | |
706 } | |
707 | |
708 errorUnsupportedNode(tree_ir.DartSpecificNode node) { | |
709 throw "Unsupported node in JS backend: $node"; | |
710 } | 690 } |
711 } | 691 } |
OLD | NEW |