| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 return js.js('#.#.call(#, #)', | 299 return js.js('#.#.call(#, #)', |
| 300 [glue.prototypeAccess(node.target.enclosingClass), | 300 [glue.prototypeAccess(node.target.enclosingClass), |
| 301 glue.invocationName(node.selector), | 301 glue.invocationName(node.selector), |
| 302 visitExpression(node.receiver), | 302 visitExpression(node.receiver), |
| 303 visitArguments(node.arguments)]); | 303 visitArguments(node.arguments)]); |
| 304 } | 304 } |
| 305 | 305 |
| 306 @override | 306 @override |
| 307 js.Expression visitLiteralList(tree_ir.LiteralList node) { | 307 js.Expression visitLiteralList(tree_ir.LiteralList node) { |
| 308 registry.registerInstantiatedClass(glue.listClass); | 308 registry.registerInstantiatedClass(glue.listClass); |
| 309 int length = node.values.length; | |
| 310 List<js.Expression> entries = node.values.map(visitExpression).toList(); | 309 List<js.Expression> entries = node.values.map(visitExpression).toList(); |
| 311 return new js.ArrayInitializer(entries); | 310 return new js.ArrayInitializer(entries); |
| 312 } | 311 } |
| 313 | 312 |
| 314 @override | 313 @override |
| 315 js.Expression visitLiteralMap(tree_ir.LiteralMap node) { | 314 js.Expression visitLiteralMap(tree_ir.LiteralMap node) { |
| 316 ConstructorElement constructor; | 315 ConstructorElement constructor; |
| 317 if (node.entries.isEmpty) { | 316 if (node.entries.isEmpty) { |
| 318 constructor = glue.mapLiteralConstructorEmpty; | 317 constructor = glue.mapLiteralConstructorEmpty; |
| 319 } else { | 318 } else { |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 | 672 |
| 674 @override | 673 @override |
| 675 visitVariableDeclaration(tree_ir.VariableDeclaration node) { | 674 visitVariableDeclaration(tree_ir.VariableDeclaration node) { |
| 676 return errorUnsupportedNode(node); | 675 return errorUnsupportedNode(node); |
| 677 } | 676 } |
| 678 | 677 |
| 679 errorUnsupportedNode(tree_ir.DartSpecificNode node) { | 678 errorUnsupportedNode(tree_ir.DartSpecificNode node) { |
| 680 throw "Unsupported node in JS backend: $node"; | 679 throw "Unsupported node in JS backend: $node"; |
| 681 } | 680 } |
| 682 } | 681 } |
| OLD | NEW |