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

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

Issue 21065002: Treat ambiguous types as malformed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Status updated. Created 7 years, 5 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
Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index 99b1dae4bf595b127dcfa7fc5e77273911429b5b..b266dfd435c498cb87a1d2facebf377369b6ffe5 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -105,23 +105,6 @@ class FunctionTypeCheckedModeHelper extends CheckedModeHelper {
}
}
-class AmbiguousTypeCheckedModeHelper extends CheckedModeHelper {
- const AmbiguousTypeCheckedModeHelper(SourceString name) : super(name);
-
- void generateAdditionalArguments(SsaCodeGenerator codegen,
- HTypeConversion node,
- List<jsAst.Expression> arguments) {
- DartType type = node.typeExpression;
- assert(type.containsAmbiguousTypes);
- String reasons = Types.fetchReasonsFromAmbiguousType(type);
-
- arguments.add(js.string(quote('$type')));
- arguments.add(js.string(quote(reasons)));
- }
-
- String quote(String string) => string.replaceAll('"', r'\"');
-}
-
/*
* Invariants:
* canInline(function) implies canInline(function, insideLoop:true)
@@ -853,13 +836,6 @@ class JavaScriptBackend extends Backend {
// We also need the native variant of the check (for DOM types).
helper = getNativeCheckedModeHelper(type, typeCast: false);
if (helper != null) world.addToWorkList(helper.getElement(compiler));
- if (type.containsAmbiguousTypes) {
- enqueueInResolution(getThrowMalformedSubtypeError(), elements);
- return;
- }
- } else if (type.containsAmbiguousTypes) {
- registerThrowRuntimeError(elements);
- return;
}
bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE;
if (!type.isRaw || type.containsTypeVariables) {
@@ -1120,16 +1096,7 @@ class JavaScriptBackend extends Backend {
Element element = type.element;
bool nativeCheck = nativeCheckOnly ||
emitter.nativeEmitter.requiresNativeIsCheck(element);
- if (type.containsAmbiguousTypes) {
- // Check for malformed types first, because the type may be a list type
- // with a malformed argument type.
- if (nativeCheckOnly) return null;
- return typeCast
- ? const AmbiguousTypeCheckedModeHelper(
- const SourceString('malformedTypeCast'))
- : const AmbiguousTypeCheckedModeHelper(
- const SourceString('malformedTypeCheck'));
- } else if (type == compiler.types.voidType) {
+ if (type == compiler.types.voidType) {
assert(!typeCast); // Cannot cast to void.
if (nativeCheckOnly) return null;
return const CheckedModeHelper(const SourceString('voidTypeCheck'));
@@ -1255,11 +1222,6 @@ class JavaScriptBackend extends Backend {
return compiler.findHelper(const SourceString('throwRuntimeError'));
}
- Element getThrowMalformedSubtypeError() {
- return compiler.findHelper(
- const SourceString('throwMalformedSubtypeError'));
- }
-
Element getThrowAbstractClassInstantiationError() {
return compiler.findHelper(
const SourceString('throwAbstractClassInstantiationError'));

Powered by Google App Engine
This is Rietveld 408576698