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

Unified Diff: pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart

Issue 923013002: dart2dart: Implementation of simple try/catch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart
diff --git a/pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart b/pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart
index 373ccfd41371b09a8ff9ab8362225da3afd68a8f..8398cbbdb8ad0ab63e102454b5940874c06a4ac8 100644
--- a/pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart
@@ -840,10 +840,10 @@ class TreePrinter {
} else if (stmt is Try) {
return new tree.TryStatement(
makeBlock(stmt.tryBlock),
- braceList('', stmt.catchBlocks.map(makeCatchBlock)),
+ makeList(null, stmt.catchBlocks.map(makeCatchBlock)),
stmt.finallyBlock == null ? null : makeBlock(stmt.finallyBlock),
tryToken,
- finallyToken);
+ stmt.finallyBlock == null ? null : finallyToken);
} else if (stmt is VariableDeclarations) {
return makeVariableDeclarations(stmt, useVar: true, endToken: semicolon);
} else if (stmt is While) {
@@ -890,16 +890,20 @@ class TreePrinter {
tree.CatchBlock makeCatchBlock(CatchBlock block) {
List<tree.VariableDefinitions> formals = [];
if (block.exceptionVar != null) {
+ tree.Node exceptionName = makeIdentifier(block.exceptionVar.name);
+ setElement(exceptionName, block.exceptionVar.element, block.exceptionVar);
formals.add(new tree.VariableDefinitions(
null,
makeEmptyModifiers(),
- singleton(makeIdentifier(block.exceptionVar))));
+ singleton(exceptionName)));
}
if (block.stackVar != null) {
+ tree.Node stackTraceName = makeIdentifier(block.stackVar.name);
+ setElement(stackTraceName, block.stackVar.element, block.stackVar);
formals.add(new tree.VariableDefinitions(
null,
makeEmptyModifiers(),
- singleton(makeIdentifier(block.stackVar))));
+ singleton(stackTraceName)));
}
return new tree.CatchBlock(
block.onType == null ? null : makeType(block.onType),

Powered by Google App Engine
This is Rietveld 408576698