Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
index 954bbb322b098ba6952a00c43ccdf123fbcf4c38..4a438c781e8eb2ed9d74ef2672d0f94d40a61d92 100644 |
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
@@ -2619,11 +2619,11 @@ class JsIrBuilder extends IrBuilder { |
arguments.add(value); |
}); |
return addPrimitive(new ir.TypeExpression(type, arguments)); |
- } else if (type is DynamicType) { |
+ } else if (type.treatAsDynamic) { |
return buildNullConstant(); |
} else { |
// TypedefType can reach here, and possibly other things. |
- throw 'unimplemented translation of type expression $type'; |
+ throw 'unimplemented translation of type expression $type (${type.kind})'; |
} |
} |
@@ -2670,6 +2670,17 @@ class JsIrBuilder extends IrBuilder { |
{bool isTypeTest}) { |
assert(isOpen); |
assert(isTypeTest != null); |
+ |
+ if (type.isMalformed) { |
+ FunctionElement helper = program.throwTypeErrorHelper; |
+ ErroneousElement element = type.element; |
+ ir.Primitive message = buildStringConstant(element.message); |
+ return buildStaticFunctionInvocation( |
+ helper, |
+ CallStructure.ONE_ARG, |
+ <ir.Primitive>[message]); |
+ } |
+ |
if (isTypeTest) { |
// For type tests, we must treat specially the rare cases where `null` |
// satisfies the test (which otherwise never satisfies a type test). |