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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1156373008: cps_ir: Handle malformed type arguments and type checks. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Actual change plus status updates. Created 5 years, 7 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 | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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).
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698