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

Unified Diff: dart/lib/compiler/implementation/ssa/builder.dart

Issue 10857013: Support for new catch syntax in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 4 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: dart/lib/compiler/implementation/ssa/builder.dart
diff --git a/dart/lib/compiler/implementation/ssa/builder.dart b/dart/lib/compiler/implementation/ssa/builder.dart
index 01149a64e0d5b9d5001d68794c98d6cc4d49d3dd..3eb295d1827b7ce550294162b1f1e21646ef6ae2 100644
--- a/dart/lib/compiler/implementation/ssa/builder.dart
+++ b/dart/lib/compiler/implementation/ssa/builder.dart
@@ -3206,19 +3206,34 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
Link<Node> link = node.catchBlocks.nodes;
void pushCondition(CatchBlock catchBlock) {
- VariableDefinitions declaration = catchBlock.formals.nodes.head;
- HInstruction condition = null;
- if (declaration.type == null) {
- condition = graph.addConstantBool(true);
- stack.add(condition);
- } else {
- Type type = elements.getType(declaration.type);
+ if (catchBlock.onKeyword != null) {
+ Type type = elements.getType(catchBlock.type);
if (type == null) {
- compiler.cancel('Catch with unresolved type', node: catchBlock);
+ compiler.cancel('On with unresolved type',
+ node: catchBlock.type);
}
- condition = new HIs(type, unwrappedException, nullOk: true);
+ HInstruction condition = new HIs(type, unwrappedException);
push(condition);
}
+ else {
+ VariableDefinitions declaration = catchBlock.formals.nodes.head;
+ HInstruction condition = null;
+ if (declaration.type == null) {
+ condition = graph.addConstantBool(true);
+ stack.add(condition);
+ } else {
+ // TODO(aprelev@gmail.com): Once old catch syntax is removed
+ // "if" condition above and this "else" branch should be deleted as
+ // type of declared variable won't matter for the catch
+ // condition
+ Type type = elements.getType(declaration.type);
+ if (type == null) {
+ compiler.cancel('Catch with unresolved type', node: catchBlock);
+ }
+ condition = new HIs(type, unwrappedException, nullOk: true);
+ push(condition);
+ }
+ }
}
void visitThen() {
« no previous file with comments | « dart/lib/compiler/implementation/scanner/parser.dart ('k') | dart/lib/compiler/implementation/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698