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

Unified Diff: compiler/java/com/google/dart/compiler/type/InterfaceTypeUnionImplementation.java

Issue 11366062: Use union type parts when check if type is subtype. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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: compiler/java/com/google/dart/compiler/type/InterfaceTypeUnionImplementation.java
diff --git a/compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.java b/compiler/java/com/google/dart/compiler/type/InterfaceTypeUnionImplementation.java
similarity index 80%
copy from compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.java
copy to compiler/java/com/google/dart/compiler/type/InterfaceTypeUnionImplementation.java
index c3eca3b606ca9b66909949ff3670f4ad4321ae7a..b17a4d3a5173614f652cace73df87b04e27e7a53 100644
--- a/compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.java
+++ b/compiler/java/com/google/dart/compiler/type/InterfaceTypeUnionImplementation.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -11,22 +11,22 @@ import com.google.dart.compiler.resolver.ClassElementUnion;
import java.util.List;
/**
- * Artificial {@link InterfaceType} which is union of several {@link InterfaceType}s.
+ * Implementation of {@link InterfaceTypeUnion}.
*/
-class InterfaceTypeUnion implements InterfaceType {
-
+class InterfaceTypeUnionImplementation implements InterfaceTypeUnion {
+
private final List<InterfaceType> types;
private final ClassElement element;
- public InterfaceTypeUnion(List<InterfaceType> types) {
+ public InterfaceTypeUnionImplementation(List<InterfaceType> types) {
this.types = types;
this.element = new ClassElementUnion(this, types);
}
-
+
@Override
public boolean equals(Object obj) {
- if (obj instanceof InterfaceTypeUnion) {
- InterfaceTypeUnion other = (InterfaceTypeUnion) obj;
+ if (obj instanceof InterfaceTypeUnionImplementation) {
+ InterfaceTypeUnionImplementation other = (InterfaceTypeUnionImplementation) obj;
return getElement().equals(other.getElement());
}
return false;
@@ -44,7 +44,7 @@ class InterfaceTypeUnion implements InterfaceType {
public String toString() {
return types.toString();
}
-
+
@Override
public TypeKind getKind() {
return TypeKind.INTERFACE;
@@ -95,17 +95,21 @@ class InterfaceTypeUnion implements InterfaceType {
}
return null;
}
-
+
@Override
public void registerSubClass(ClassElement subClass) {
}
-
+
@Override
public void unregisterSubClass(ClassElement subClass) {
}
-
+
@Override
public Member lookupSubTypeMember(String name) {
return null;
}
+
+ public List<InterfaceType> getTypes() {
+ return types;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698