public Type resolve(Environment env) {
   if (env.lookupType(typeName) == null) {
     if (env.lookup(this.typeName) != null) {
       // Perhaps its first class?
       NameBinding n = env.lookup(this.typeName);
       Type t = n.getType();
       return t;
     }
     throw new RuntimeException("Cannot find " + typeName + " in environment " + env);
   }
   TypeBinding typeBinding = env.lookupType(typeName);
   if (typeBinding.getMetadata().isPresent() && typeBinding.getMetadata().get().get() != null)
     return typeBinding.getUse().cloneWithBinding(typeBinding);
   else return typeBinding.getUse();
 }
Exemple #2
0
 public TypeBinding lookupType(String name) {
   if (this.name == null) return null;
   if (this.name.equals(name) && this.binding instanceof TypeBinding) return (TypeBinding) binding;
   return parentEnvironment.lookupType(name);
 }