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 2519c4fdbabce98ba7fd161277733ff3a47c273c..80486ab67fa0946852226211733a3b68e491bfb5 100644 |
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
@@ -2910,13 +2910,16 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
} else if ("as" == op.source) { |
visit(node.receiver); |
HInstruction expression = pop(); |
- Node argument = node.arguments.head; |
- TypeAnnotation typeAnnotation = argument.asTypeAnnotation(); |
- DartType type = elements.getType(typeAnnotation); |
- HInstruction converted = buildTypeConversion( |
- expression, type, HTypeConversion.CAST_TYPE_CHECK); |
- if (converted != expression) add(converted); |
- stack.add(converted); |
+ DartType type = elements.getType(node.typeAnnotationFromIsCheckOrCast); |
+ if (type.kind == TypeKind.MALFORMED_TYPE) { |
+ ErroneousElement element = type.element; |
+ generateTypeError(node, element.message); |
+ } else { |
+ HInstruction converted = buildTypeConversion( |
+ expression, type, HTypeConversion.CAST_TYPE_CHECK); |
+ if (converted != expression) add(converted); |
+ stack.add(converted); |
+ } |
} else { |
visit(node.receiver); |
visit(node.argumentsNode); |
@@ -3021,6 +3024,11 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
pushInvokeStatic(node, helper, inputs, backend.boolType); |
HInstruction call = pop(); |
return new HIs.compound(type, expression, call, backend.boolType); |
+ } else if (type.kind == TypeKind.MALFORMED_TYPE) { |
+ ErroneousElement element = type.element; |
+ generateTypeError(node, element.message); |
+ HInstruction call = pop(); |
+ return new HIs.compound(type, expression, call, backend.boolType); |
} else { |
if (backend.hasDirectCheckFor(type)) { |
return new HIs.direct(type, expression, backend.boolType); |