Пример #1
0
  @Override
  public void unResolve() {
    if (resolved) {
      resolved = false;

      for (TCDefinition d : classdef.getDefinitions()) {
        d.getType().unResolve();
      }
    }
  }
Пример #2
0
  @Override
  public TCType typeResolve(Environment env, TCTypeDefinition root) {
    if (resolved) return this;
    else resolved = true;

    try {
      // We have to add a private class environment here because the
      // one passed in may be from a class that contains a reference
      // to this class. We need the private environment to see all
      // the definitions that are available to us while resolving...

      Environment self = new PrivateClassEnvironment(classdef, env);

      for (TCDefinition d : classdef.getDefinitions()) {
        // There is a problem resolving ParameterTypes via a TCFunctionType
        // when this is not being done via POExplicitFunctionDefinition
        // which extends the environment with the type names that
        // are in scope. So we skip these here.

        if (d instanceof TCExplicitFunctionDefinition) {
          TCExplicitFunctionDefinition fd = (TCExplicitFunctionDefinition) d;

          if (fd.typeParams != null) {
            continue; // Skip polymorphic functions
          }
        }

        d.getType().typeResolve(self, root);
      }

      return this;
    } catch (TypeCheckException e) {
      unResolve();
      throw e;
    }
  }