| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 accumulator.add( | 468 accumulator.add( |
| 469 buildWhile(new js.LiteralBool(true), node.body, node.label, node)); | 469 buildWhile(new js.LiteralBool(true), node.body, node.label, node)); |
| 470 } | 470 } |
| 471 | 471 |
| 472 @override | 472 @override |
| 473 void visitReturn(tree_ir.Return node) { | 473 void visitReturn(tree_ir.Return node) { |
| 474 accumulator.add(new js.Return(visitExpression(node.value))); | 474 accumulator.add(new js.Return(visitExpression(node.value))); |
| 475 } | 475 } |
| 476 | 476 |
| 477 @override | 477 @override |
| 478 void visitTry(tree_ir.Try node) { |
| 479 // TODO(kmillikin): implement TryStatement. |
| 480 return giveup(node); |
| 481 } |
| 482 |
| 483 @override |
| 478 js.Expression visitCreateBox(tree_ir.CreateBox node) { | 484 js.Expression visitCreateBox(tree_ir.CreateBox node) { |
| 479 return new js.ObjectInitializer([]); | 485 return new js.ObjectInitializer([]); |
| 480 } | 486 } |
| 481 | 487 |
| 482 @override | 488 @override |
| 483 js.Expression visitCreateInstance(tree_ir.CreateInstance node) { | 489 js.Expression visitCreateInstance(tree_ir.CreateInstance node) { |
| 484 registry.registerInstantiatedClass(node.classElement); | 490 registry.registerInstantiatedClass(node.classElement); |
| 485 return new js.New(glue.constructorAccess(node.classElement), | 491 return new js.New(glue.constructorAccess(node.classElement), |
| 486 node.arguments.map(visitExpression).toList()); | 492 node.arguments.map(visitExpression).toList()); |
| 487 } | 493 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 | 529 |
| 524 @override | 530 @override |
| 525 visitSuperInitializer(tree_ir.SuperInitializer node) { | 531 visitSuperInitializer(tree_ir.SuperInitializer node) { |
| 526 return errorUnsupportedNode(node); | 532 return errorUnsupportedNode(node); |
| 527 } | 533 } |
| 528 | 534 |
| 529 dynamic errorUnsupportedNode(tree_ir.DartSpecificNode node) { | 535 dynamic errorUnsupportedNode(tree_ir.DartSpecificNode node) { |
| 530 throw "Unsupported node in JS backend: $node"; | 536 throw "Unsupported node in JS backend: $node"; |
| 531 } | 537 } |
| 532 } | 538 } |
| OLD | NEW |