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

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

Issue 19097003: Support new malformed types semantics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index f87ff361ba1f1bc89e5a85b4a8e2821c0ef0f7b7..5854eb1d178203717155c3da2bd4d0415d581e5a 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -1719,7 +1719,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
int kind) {
if (type == null) return original;
type = type.unalias(compiler);
- if (type.kind == TypeKind.INTERFACE && !type.isMalformed && !type.isRaw) {
+ if (type.kind == TypeKind.INTERFACE && !type.isRaw) {
HType subtype = new HType.subtype(type, compiler);
HInstruction representations = buildTypeArgumentRepresentations(type);
add(representations);
@@ -2725,12 +2725,12 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
bool isNot = node.isIsNotCheck;
DartType type = elements.getType(node.typeAnnotationFromIsCheckOrCast);
type = type.unalias(compiler);
- if (type.isMalformed) {
- String reasons = Types.fetchReasonsFromMalformedType(type);
+ if (type.containsAmbiguousTypes) {
+ String reasons = Types.fetchReasonsFromAmbiguousType(type);
if (compiler.enableTypeAssertions) {
generateMalformedSubtypeError(node, expression, type, reasons);
} else {
- generateRuntimeError(node, '$type is malformed: $reasons');
+ generateRuntimeError(node, '$type is ambiguous: $reasons');
}
} else {
HInstruction instruction = buildIsNode(node, type, expression);
@@ -3339,10 +3339,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
* Invariant: [argument] must not be malformed in checked mode.
*/
HInstruction analyzeTypeArgument(DartType argument, Node currentNode) {
- assert(invariant(currentNode,
- !compiler.enableTypeAssertions || !argument.isMalformed,
- message: '$argument is malformed in checked mode'));
- if (argument == compiler.types.dynamicType || argument.isMalformed) {
+ if (argument.treatAsDynamic) {
// Represent [dynamic] as [null].
return graph.addConstantNull(compiler);
}
@@ -3398,9 +3395,6 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
*/
handleNewSend(NewExpression node, InterfaceType type) {
Send send = node.send;
- assert(invariant(send,
- !compiler.enableTypeAssertions || !type.isMalformed,
- message: '$type is malformed in checked mode'));
bool isListConstructor = false;
computeType(element) {
Element originalElement = elements[send];
@@ -3719,8 +3713,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
}
} else {
DartType type = elements.getType(node);
- if (compiler.enableTypeAssertions && type.isMalformed) {
- String reasons = Types.fetchReasonsFromMalformedType(type);
+ if (compiler.enableTypeAssertions && type.containsAmbiguousTypes) {
+ String reasons = Types.fetchReasonsFromAmbiguousType(type);
// TODO(johnniwinther): Change to resemble type errors from bounds check
// on type arguments.
generateRuntimeError(node, '$type is malformed: $reasons');
@@ -4853,18 +4847,11 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
if (type == null) {
compiler.internalError('On with no type', node: catchBlock.type);
}
- if (type.isMalformed) {
- // TODO(johnniwinther): Handle malformed types in [HIs] instead.
- HInstruction condition =
- graph.addConstantBool(true, compiler);
- stack.add(condition);
- } else {
- // TODO(karlkose): support type arguments here.
- HInstruction condition = new HIs(type,
- <HInstruction>[unwrappedException],
- HIs.RAW_CHECK);
- push(condition);
- }
+ // TODO(karlkose): support type arguments here.
+ HInstruction condition = new HIs(type,
+ <HInstruction>[unwrappedException],
+ HIs.RAW_CHECK);
+ push(condition);
} else {
VariableDefinitions declaration = catchBlock.formals.nodes.head;
HInstruction condition = null;
@@ -4897,8 +4884,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
// malformed.
if (catchBlock.onKeyword != null) {
DartType type = elements.getType(catchBlock.type);
- if (type != null && type.isMalformed) {
- String reasons = Types.fetchReasonsFromMalformedType(type);
+ if (type != null && type.containsAmbiguousTypes) {
+ String reasons = Types.fetchReasonsFromAmbiguousType(type);
generateMalformedSubtypeError(node,
unwrappedException, type, reasons);
pop();

Powered by Google App Engine
This is Rietveld 408576698