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

Unified Diff: frog/leg/ssa/codegen.dart

Issue 9370020: Fully support try/catch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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: frog/leg/ssa/codegen.dart
===================================================================
--- frog/leg/ssa/codegen.dart (revision 4076)
+++ frog/leg/ssa/codegen.dart (working copy)
@@ -356,23 +356,20 @@
indent++;
List<HBasicBlock> successors = node.block.successors;
visitBasicBlock(successors[0]);
- indent--;
if (node.finallyBlock != successors[1]) {
+ indent--;
floitsch 2012/02/09 15:06:57 add comment that this is the catch part.
floitsch 2012/02/09 15:06:57 I would move the indent-- out of the if.
ngeoffray 2012/02/09 15:13:48 Done.
ngeoffray 2012/02/09 15:13:48 Done.
addIndentation();
- buffer.add('} catch (e) {\n');
+ String name = temporary(node.exception);
+ parameterNames[node.exception.element] = name;
+ buffer.add('} catch ($name) {\n');
indent++;
+ visitBasicBlock(successors[1]);
+ parameterNames.remove(node.exception.element);
}
- for (int i = 1; i < successors.length - 1; i++) {
- // TODO(ngeoffray): add the type check.
- visitBasicBlock(successors[i]);
- }
-
- if (node.finallyBlock == null) {
- // TODO(ngeoffray): add the type check.
- visitBasicBlock(successors[successors.length - 1]);
- } else {
+ if (node.finallyBlock != null) {
+ indent--;
addIndentation();
buffer.add('} finally {\n');
indent++;
@@ -799,11 +796,11 @@
buffer.add('true');
}
} else {
- buffer.add('((');
+ buffer.add('(!!(');
use(node.expression);
buffer.add(').');
buffer.add(compiler.namer.operatorIs(node.typeExpression));
- buffer.add(' === true)');
+ buffer.add(')');
}
}
}

Powered by Google App Engine
This is Rietveld 408576698