aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Laurent Le Brun <laurentlb@google.com>2015-05-12 15:25:25 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-05-15 09:35:24 +0000
commit0cf1ac83811c0912a0fa51171100b748586d05de (patch)
tree3233a19f1248b87165b26bf803acfad78e9b0b68
parent2945e0641e16fa422116a6469113f9aea15b63d7 (diff)
Remove dead code in SkylarkType
-- MOS_MIGRATED_REVID=93415666
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/SkylarkType.java71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkType.java b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkType.java
index b6c3767e42..cdbfebdd4b 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkType.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkType.java
@@ -50,7 +50,6 @@ import javax.annotation.Nullable;
* and an argument type (that itself need not be Simple).
* <li>a Union of a finite set of types
* <li>a FunctionType associated with a name and a returnType
- * _that changes during validation_
* </ul>
*
* <p>In a style reminiscent of Java's null, Skylark's None is in all the types
@@ -110,13 +109,6 @@ public abstract class SkylarkType {
return SkylarkType.of(type).includes(this);
}
- /** @return true if some non-null objects of that Java class can be cast to this SkylarkType
- * Note that this is much weaker than an .includes() predicate.
- */
- public boolean canBeCastFrom(Class<?> type) {
- return this.getType().isAssignableFrom(type);
- }
-
/** @return the smallest java Class known to contain all elements of this type */
// Note: most user-code should be using a variant that throws an Exception
// if the result is Object.class but the type isn't TOP.
@@ -153,14 +145,6 @@ public abstract class SkylarkType {
/** A singleton for the TOP type, that at analysis time means that any type is possible. */
public static final Simple TOP = new Top();
- /** UNKNOWN, an alias for the TOP type, for backward compatibility */
- public static final Simple UNKNOWN = TOP;
-
- /** A singleton for the ANY type, that at run time means that any object is possible. */
- // NB: right now, it has the same representation as TOP or UNKNOWN,
- // but means something subtly different.
- public static final Simple ANY = TOP;
-
/** A singleton for the BOTTOM type, that contains no element */
public static final Simple BOTTOM = new Bottom();
@@ -557,10 +541,6 @@ public abstract class SkylarkType {
this.name = name;
this.returnType = returnType;
}
-
- public SkylarkType getReturnType() {
- return returnType;
- }
}
@@ -577,24 +557,6 @@ public abstract class SkylarkType {
return type == NONE ? TOP : type;
}
- /**
- * Returns the stronger type of this and o if they are compatible. Stronger means that
- * the more information is available, e.g. STRING is stronger than UNKNOWN and
- * LIST&lt;STRING> is stronger than LIST&lt;UNKNOWN>.
- *
- * <p>If they are not compatible an EvalException is thrown.
- */
- SkylarkType infer(SkylarkType other, String name, Location thisLoc, Location originalLoc)
- throws EvalException {
- SkylarkType both = intersection(typeForInference(this), typeForInference(other));
- if (both == BOTTOM) {
- throw new EvalException(thisLoc, String.format("bad %s: %s is incompatible with %s at %s",
- name, other, this, originalLoc));
- } else {
- return both;
- }
- }
-
public static SkylarkType typeOf(Object value) {
if (value == null) {
return BOTTOM;
@@ -639,10 +601,6 @@ public abstract class SkylarkType {
return SkylarkNestedSet.class.isAssignableFrom(getType());
}
- boolean isSimple() {
- return !isStruct() && !isDict() && !isList() && !isNset() && !isSet();
- }
-
private static boolean isTypeAllowedInSkylark(Object object) {
if (object instanceof NestedSet<?>) {
return false;
@@ -663,24 +621,6 @@ public abstract class SkylarkType {
}
}
-
- /**
- * General purpose type-casting facility.
- *
- * @param value - the actual value of the parameter
- * @param type - the expected Class for the value
- * @param loc - the location info used in the EvalException
- * @param format - a format String
- * @param args - arguments to format, in case there's an exception
- */
- public static <T> T castOrNull(Object value, Class<T> type,
- Location loc, String format, Object... args) throws EvalException {
- if (value == Environment.NONE) {
- return null;
- }
- return SkylarkType.<T>cast(value, type, loc, format, args);
- }
-
/**
* General purpose type-casting facility.
*
@@ -834,15 +774,4 @@ public abstract class SkylarkType {
}
return value;
}
-
- /**
- * Creates a SkylarkType from the SkylarkSignature annotation.
- */
- public static SkylarkType getReturnType(SkylarkSignature annotation) {
- if (BaseFunction.class.isAssignableFrom(annotation.returnType())) {
- return SkylarkFunctionType.of(annotation.name());
- } else {
- return Simple.of(annotation.returnType());
- }
- }
}