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

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

Issue 11412245: MalformedType used for all invalid type annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index 202fb6e34606cd6c61706cfa16c3393d45d6146f..c494178f8f8d814007144579013c2cde27533736 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -2080,7 +2080,7 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
});
Element element = node.element;
world.registerStaticUse(element);
- ClassElement cls = element.getEnclosingClass();
+ ClassElement cls = element.getEnclosingClass();
if (element.isGenerativeConstructor()
|| (element.isFactoryConstructor() && cls == compiler.listClass)) {
world.registerInstantiatedClass(cls);
@@ -2458,7 +2458,9 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
"callTypeCheck":
const SourceString("callTypeCast"),
"propertyTypeCheck":
- const SourceString("propertyTypeCast")
+ const SourceString("propertyTypeCast"),
+ "malformedTypeCheck":
+ const SourceString("malformedTypeCheck")
};
if (node.isChecked) {
@@ -2499,9 +2501,25 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
List<js.Expression> arguments = <js.Expression>[];
use(node.checkedInput);
arguments.add(pop());
- if (helperElement.computeSignature(compiler).parameterCount != 1) {
+ int parameterCount =
+ helperElement.computeSignature(compiler).parameterCount;
+ if (parameterCount == 2) {
+ assert(!type.isMalformed);
String additionalArgument = backend.namer.operatorIs(element);
arguments.add(new js.LiteralString("'$additionalArgument'"));
+ } else if (parameterCount == 3) {
+ assert(type.isMalformed);
+ var reasons = new List<String>();
+ type.forEachMalformedType((MalformedType malformedType) {
+ ErroneousElement error = malformedType.element;
+ Message message = error.messageKind.message(error.messageArguments);
+ reasons.add(message.toString());
+ return true;
+ });
+ arguments.add(new js.LiteralString("'$type'"));
+ arguments.add(new js.LiteralString("'${Strings.join(reasons, ', ')}'"));
+ } else {
+ assert(!type.isMalformed);
}
String helperName = backend.namer.isolateAccess(helperElement);
push(new js.Call(new js.VariableUse(helperName), arguments));

Powered by Google App Engine
This is Rietveld 408576698