src/com/google/javascript/rhino/jstype/NamedType.java
/**
   * Resolve the referenced type within the enclosing scope.
   */
Resolve the referenced type within the enclosing scope.
Resolve the referenced type within the enclosing scope .
@Override
  JSType resolveInternal(ErrorReporter reporter) {
    if (!getReferencedType().isUnknownType()) {
      return super.resolveInternal(reporter);
    }
    boolean resolved = resolveViaRegistry(reporter);
    if (!resolved) {
      resolveViaProperties(reporter);
    }
    if (detectInheritanceCycle()) {
      handleTypeCycle(reporter);
    }
    super.resolveInternal(reporter);
    finishPropertyContinuations();
    JSType result = getReferencedType();
    if (isSuccessfullyResolved()) {
      int numKeys = result.getTemplateTypeMap().numUnfilledTemplateKeys();
      if (result.isObjectType()
          && (templateTypes != null && !templateTypes.isEmpty())
          && numKeys > 0) {
        ImmutableList<JSType> typeArgs = this.templateTypes;
        if (numKeys < this.templateTypes.size()) {
          typeArgs = typeArgs.subList(0, numKeys);
        }
        result = registry.createTemplatizedType(result.toMaybeObjectType(), typeArgs);
        setReferencedType(result);
      }
      resolutionScope = null;
    }
    return result;
  }
@ Override JSType resolveInternal ( ErrorReporter reporter ) { if ( ! getReferencedType ( ) . isUnknownType ( ) ) { return super . resolveInternal ( reporter ) ; } boolean resolved = resolveViaRegistry ( reporter ) ; if ( ! resolved ) { resolveViaProperties ( reporter ) ; } if ( detectInheritanceCycle ( ) ) { handleTypeCycle ( reporter ) ; } super . resolveInternal ( reporter ) ; finishPropertyContinuations ( ) ; JSType result = getReferencedType ( ) ; if ( isSuccessfullyResolved ( ) ) { int numKeys = result . getTemplateTypeMap ( ) . numUnfilledTemplateKeys ( ) ; if ( result . isObjectType ( ) && ( templateTypes != null && ! templateTypes . isEmpty ( ) ) && numKeys > 0 ) { ImmutableList < JSType > typeArgs = this . templateTypes ; if ( numKeys < this . templateTypes . size ( ) ) { typeArgs = typeArgs . subList ( 0 , numKeys ) ; } result = registry . createTemplatizedType ( result . toMaybeObjectType ( ) , typeArgs ) ; setReferencedType ( result ) ; } resolutionScope = null ; } return result ; }
Resolve the referenced type within the enclosing scope.
Resolve the referenced type within the enclosing scope .
// In some cases (e.g. typeof(ns) when the actual type is just a literal object), a NamedType // is created solely for the purpose of naming an already-known type. When that happens, // there's nothing to look up, so just resolve the referenced type. // TODO(user): Investigate whether it is really necessary to keep two // different mechanisms for resolving named types, and if so, which order // makes more sense. Now, resolution via registry is first in order to // avoid triggering the warnings built into the resolution via properties. // Ignore any extraneous type args // TODO(johnlenz): report an error