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

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

Issue 19097003: Support new malformed types semantics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix unittests. 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 3a6df623eca49e02b254f4b9ddf45ecbe45cac04..99b1dae4bf595b127dcfa7fc5e77273911429b5b 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -33,7 +33,6 @@ class CheckedModeHelper {
void generateAdditionalArguments(SsaCodeGenerator codegen,
HTypeConversion node,
List<jsAst.Expression> arguments) {
- assert(!node.typeExpression.isMalformed);
// No additional arguments needed.
}
}
@@ -45,7 +44,6 @@ class PropertyCheckedModeHelper extends CheckedModeHelper {
HTypeConversion node,
List<jsAst.Expression> arguments) {
DartType type = node.typeExpression;
- assert(!type.isMalformed);
String additionalArgument = codegen.backend.namer.operatorIsType(type);
arguments.add(js.string(additionalArgument));
}
@@ -107,15 +105,15 @@ class FunctionTypeCheckedModeHelper extends CheckedModeHelper {
}
}
-class MalformedCheckedModeHelper extends CheckedModeHelper {
- const MalformedCheckedModeHelper(SourceString name) : super(name);
+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.isMalformed);
- String reasons = Types.fetchReasonsFromMalformedType(type);
+ assert(type.containsAmbiguousTypes);
+ String reasons = Types.fetchReasonsFromAmbiguousType(type);
arguments.add(js.string(quote('$type')));
arguments.add(js.string(quote(reasons)));
@@ -855,11 +853,11 @@ 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.isMalformed) {
+ if (type.containsAmbiguousTypes) {
enqueueInResolution(getThrowMalformedSubtypeError(), elements);
return;
}
- } else if (type.isMalformed) {
+ } else if (type.containsAmbiguousTypes) {
registerThrowRuntimeError(elements);
return;
}
@@ -1122,14 +1120,14 @@ class JavaScriptBackend extends Backend {
Element element = type.element;
bool nativeCheck = nativeCheckOnly ||
emitter.nativeEmitter.requiresNativeIsCheck(element);
- if (type.isMalformed) {
+ 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 MalformedCheckedModeHelper(
+ ? const AmbiguousTypeCheckedModeHelper(
const SourceString('malformedTypeCast'))
- : const MalformedCheckedModeHelper(
+ : const AmbiguousTypeCheckedModeHelper(
const SourceString('malformedTypeCheck'));
} else if (type == compiler.types.voidType) {
assert(!typeCast); // Cannot cast to void.

Powered by Google App Engine
This is Rietveld 408576698