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

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: Bug fixes 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 b704a11fe016a38760a79c27d65f6cd8142db80f..e7f59647dba823a0b07c9e5c7b03b935379b5d8a 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);
@@ -2274,6 +2274,8 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
void checkType(HInstruction input, DartType type, {bool negative: false}) {
+ assert(invariant(input, !type.isMalformed,
+ message: 'Attempt to check malformed type $type'));
world.registerIsCheck(type);
Element element = type.element;
use(input);
@@ -2458,7 +2460,9 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
"callTypeCheck":
const SourceString("callTypeCast"),
"propertyTypeCheck":
- const SourceString("propertyTypeCast")
+ const SourceString("propertyTypeCast"),
+ "malformedTypeCheck":
+ const SourceString("malformedTypeCheck")
ahe 2012/11/30 15:44:07 How about adding malformedTypeCast which gives a s
Johnni Winther 2012/12/04 10:07:17 Added a TODO.
};
if (node.isChecked) {
@@ -2499,9 +2503,19 @@ 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) {
ahe 2012/11/30 15:44:07 Could you document what is going on here?
Johnni Winther 2012/12/04 10:07:17 Done.
+ assert(!type.isMalformed);
String additionalArgument = backend.namer.operatorIs(element);
arguments.add(new js.LiteralString("'$additionalArgument'"));
+ } else if (parameterCount == 3) {
+ assert(type.isMalformed);
+ String reasons = fetchReasonsFromMalformedType(type);
+ arguments.add(new js.LiteralString("'$type'"));
+ arguments.add(new js.LiteralString("'$reasons)}'"));
ahe 2012/11/30 15:44:07 How about using writeJsonEscapedCharsOn from util.
Johnni Winther 2012/12/04 10:07:17 Added a TODO.
+ } 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