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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 60293003: Version 0.8.10.5 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: 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: dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
===================================================================
--- dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (revision 29908)
+++ dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (working copy)
@@ -35,6 +35,17 @@
}
}
+class MalformedCheckedModeHelper extends CheckedModeHelper {
+ const MalformedCheckedModeHelper(String name) : super(name);
+
+ void generateAdditionalArguments(SsaCodeGenerator codegen,
+ HTypeConversion node,
+ List<jsAst.Expression> arguments) {
+ ErroneousElement element = node.typeExpression.element;
+ arguments.add(js.string(element.message));
+ }
+}
+
class PropertyCheckedModeHelper extends CheckedModeHelper {
const PropertyCheckedModeHelper(String name) : super(name);
@@ -338,6 +349,7 @@
/// All the checked mode helpers.
static const checkedModeHelpers = const [
+ const MalformedCheckedModeHelper('checkMalformedType'),
const CheckedModeHelper('voidTypeCheck'),
const CheckedModeHelper('stringTypeCast'),
const CheckedModeHelper('stringTypeCheck'),
@@ -988,6 +1000,9 @@
}
}
bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE;
+ if (type.kind == TypeKind.MALFORMED_TYPE) {
+ enqueueInResolution(getThrowTypeError(), elements);
+ }
if (!type.treatAsRaw || type.containsTypeVariables) {
enqueueInResolution(getSetRuntimeTypeInfo(), elements);
enqueueInResolution(getGetRuntimeTypeInfo(), elements);
@@ -1323,6 +1338,11 @@
{bool typeCast,
bool nativeCheckOnly}) {
assert(type.kind != TypeKind.TYPEDEF);
+ if (type.kind == TypeKind.MALFORMED_TYPE) {
+ // The same error is thrown for type test and type cast of a malformed
+ // type so we only need one check method.
+ return 'checkMalformedType';
+ }
Element element = type.element;
bool nativeCheck = nativeCheckOnly ||
emitter.nativeEmitter.requiresNativeIsCheck(element);

Powered by Google App Engine
This is Rietveld 408576698