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

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

Issue 54983007: Make test of malformed types a dynamic type error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 1 month 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: 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);

Powered by Google App Engine
This is Rietveld 408576698