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

Unified Diff: compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.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
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/type/InterfaceTypeUnionImplementation.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.java
diff --git a/compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.java b/compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.java
index c3eca3b606ca9b66909949ff3670f4ad4321ae7a..87a6c9cf5e2a238722c6c271a9df50050422bb58 100644
--- a/compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.java
+++ b/compiler/java/com/google/dart/compiler/type/InterfaceTypeUnion.java
@@ -1,111 +1,17 @@
-// 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.
package com.google.dart.compiler.type;
-import com.google.common.collect.ImmutableList;
-import com.google.dart.compiler.resolver.ClassElement;
-import com.google.dart.compiler.resolver.ClassElementUnion;
-
import java.util.List;
/**
* Artificial {@link InterfaceType} which is union of several {@link InterfaceType}s.
*/
-class InterfaceTypeUnion implements InterfaceType {
-
- private final List<InterfaceType> types;
- private final ClassElement element;
-
- public InterfaceTypeUnion(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;
- return getElement().equals(other.getElement());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 31;
- hashCode += getElement().hashCode();
- hashCode += 31 * hashCode + getArguments().hashCode();
- return hashCode;
- }
-
- @Override
- public String toString() {
- return types.toString();
- }
-
- @Override
- public TypeKind getKind() {
- return TypeKind.INTERFACE;
- }
-
- @Override
- public TypeQuality getQuality() {
- return TypeQuality.EXACT;
- }
-
- @Override
- public InterfaceType subst(List<Type> arguments, List<Type> parameters) {
- return null;
- }
-
- @Override
- public ClassElement getElement() {
- return element;
- }
-
- @Override
- public List<Type> getArguments() {
- return ImmutableList.of();
- }
-
- @Override
- public boolean isRaw() {
- return true;
- }
-
- @Override
- public boolean hasDynamicTypeArgs() {
- return false;
- }
-
- @Override
- public InterfaceType asRawType() {
- return this;
- }
-
- @Override
- public Member lookupMember(String name) {
- for (InterfaceType type : types) {
- Member member = type.lookupMember(name);
- if (member != null) {
- return member;
- }
- }
- return null;
- }
-
- @Override
- public void registerSubClass(ClassElement subClass) {
- }
-
- @Override
- public void unregisterSubClass(ClassElement subClass) {
- }
-
- @Override
- public Member lookupSubTypeMember(String name) {
- return null;
- }
+public interface InterfaceTypeUnion extends InterfaceType {
+ /**
+ * @return the {@link InterfaceType} making this union.
+ */
+ List<InterfaceType> getTypes();
}
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/type/InterfaceTypeUnionImplementation.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698