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

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
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | frog/leg/ssa/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/ssa/codegen.dart
===================================================================
--- frog/leg/ssa/codegen.dart (revision 4083)
+++ frog/leg/ssa/codegen.dart (working copy)
@@ -359,20 +359,18 @@
indent--;
if (node.finallyBlock != successors[1]) {
+ // Printing the catch part.
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);
+ indent--;
}
- 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) {
addIndentation();
buffer.add('} finally {\n');
indent++;
@@ -799,11 +797,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(')');
}
}
}
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | frog/leg/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698