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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1092023002: CPS implementation of throw and rethrow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 accumulator.add( 518 accumulator.add(
519 buildWhile(new js.LiteralBool(true), node.body, node.label, node)); 519 buildWhile(new js.LiteralBool(true), node.body, node.label, node));
520 } 520 }
521 521
522 @override 522 @override
523 void visitReturn(tree_ir.Return node) { 523 void visitReturn(tree_ir.Return node) {
524 accumulator.add(new js.Return(visitExpression(node.value))); 524 accumulator.add(new js.Return(visitExpression(node.value)));
525 } 525 }
526 526
527 @override 527 @override
528 void visitThrow(tree_ir.Throw node) {
529 accumulator.add(new js.Throw(visitExpression(node.value)));
530 }
531
532 @override
533 void visitRethrow(tree_ir.Rethrow node) {
534 glue.reportInternalError('rethrow seen in JavaScript output');
535 }
536
537 @override
528 void visitTry(tree_ir.Try node) { 538 void visitTry(tree_ir.Try node) {
529 js.Block tryBlock = buildBodyBlock(node.tryBody); 539 js.Block tryBlock = buildBodyBlock(node.tryBody);
530 tree_ir.Variable exceptionVariable = node.catchParameters.first; 540 tree_ir.Variable exceptionVariable = node.catchParameters.first;
531 js.VariableDeclaration exceptionParameter = 541 js.VariableDeclaration exceptionParameter =
532 new js.VariableDeclaration(getVariableName(exceptionVariable)); 542 new js.VariableDeclaration(getVariableName(exceptionVariable));
533 js.Block catchBlock = buildBodyBlock(node.catchBody); 543 js.Block catchBlock = buildBodyBlock(node.catchBody);
534 js.Catch catchPart = new js.Catch(exceptionParameter, catchBlock); 544 js.Catch catchPart = new js.Catch(exceptionParameter, catchBlock);
535 accumulator.add(new js.Try(tryBlock, catchPart, null)); 545 accumulator.add(new js.Try(tryBlock, catchPart, null));
536 } 546 }
537 547
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 650
641 @override 651 @override
642 visitVariableDeclaration(tree_ir.VariableDeclaration node) { 652 visitVariableDeclaration(tree_ir.VariableDeclaration node) {
643 return errorUnsupportedNode(node); 653 return errorUnsupportedNode(node);
644 } 654 }
645 655
646 errorUnsupportedNode(tree_ir.DartSpecificNode node) { 656 errorUnsupportedNode(tree_ir.DartSpecificNode node) {
647 throw "Unsupported node in JS backend: $node"; 657 throw "Unsupported node in JS backend: $node";
648 } 658 }
649 } 659 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698