Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| index f7221d0fbf250d5e7037acb57bcb6e359d2505ce..7c6c57fafff4f6b796d670a9b3f4d96c82e7c99c 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| @@ -4474,12 +4474,18 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| if (catchBlock.onKeyword != null) { |
| DartType type = elements.getType(catchBlock.type); |
| if (type == null) { |
| - compiler.cancel('On with unresolved type', |
| - node: catchBlock.type); |
| + compiler.cancel('On with no type', node: catchBlock.type); |
|
ngeoffray
2013/02/18 15:48:35
cancel -> internalError ?
Johnni Winther
2013/02/19 07:08:54
Done.
|
| + } |
| + if (type.isMalformed) { |
| + // TODO(johnniwinther): Handle malformed types in [HIs] instead. |
| + HInstruction condition = |
| + graph.addConstantBool(true, constantSystem); |
| + stack.add(condition); |
| + } else { |
| + HInstruction condition = |
| + new HIs(type, <HInstruction>[unwrappedException]); |
| + push(condition); |
| } |
| - HInstruction condition = |
| - new HIs(type, <HInstruction>[unwrappedException]); |
| - push(condition); |
| } |
| else { |
|
ngeoffray
2013/02/18 15:48:35
Move else one line above.
Johnni Winther
2013/02/19 07:08:54
Done.
|
| VariableDefinitions declaration = catchBlock.formals.nodes.head; |
| @@ -4506,6 +4512,21 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| void visitThen() { |
| CatchBlock catchBlock = link.head; |
| link = link.tail; |
| + |
| + if (compiler.enableTypeAssertions) { |
| + // In checked mode: Throw a type error if the on-catch type is |
|
ngeoffray
2013/02/18 15:48:35
Throw -> throw
Johnni Winther
2013/02/19 07:08:54
Done.
|
| + // malformed. |
| + if (catchBlock.onKeyword != null) { |
| + DartType type = elements.getType(catchBlock.type); |
| + if (type != null && type.isMalformed) { |
| + String reasons = Types.fetchReasonsFromMalformedType(type); |
| + generateMalformedSubtypeError(node, |
| + unwrappedException, type, reasons); |
| + pop(); |
| + return; |
| + } |
| + } |
| + } |
| if (catchBlock.exception != null) { |
| localsHandler.updateLocal(elements[catchBlock.exception], |
| unwrappedException); |