third_party/closure-compiler/src/src/com/google/javascript/rhino/jstype/NamedType.java
/**
   * Resolves a named type by checking for the longest prefix that matches some Closure namespace,
   * if any, then attempting to resolve via properties based on the type of the `exports` object in
   * that namespace.
   */
Resolves a named type by checking for the longest prefix that matches some Closure namespace,
if any, then attempting to resolve via properties based on the type of the `exports` object in
that namespace.
Resolves a named type by checking for the longest prefix that matches some Closure namespace if any then attempting to resolve via properties based on the type of the ` exports ` object in that namespace .
private boolean resolveViaClosureNamespace(ErrorReporter reporter) {
    List<String> componentNames = Splitter.on('.').splitToList(reference);
    if (componentNames.get(0).isEmpty()) {
      return false;
    }
    StaticTypedSlot slot = resolutionScope.getSlot(componentNames.get(0));
    if (slot != null && slot.getScope() != null && slot.getScope().getParentScope() != null) {
      return false;
    }
    String prefix = reference;
    for (int remainingComponentIndex = componentNames.size();
        remainingComponentIndex > 0;
        remainingComponentIndex--) {
      ModuleSlot module = registry.getModuleSlot(prefix);
      if (module == null) {
        int lastDot = prefix.lastIndexOf(".");
        if (lastDot >= 0) {
          prefix = prefix.substring(0, lastDot);
        }
        continue;
      }
      if (module.isLegacyModule()) {
        return false;
      } else {
        resolveViaPropertyGivenSlot(
            module.type(),
            module.definitionNode(),
            componentNames,
            reporter,
            remainingComponentIndex);
        return true;
      }
    }
    return false; 
  }
private boolean resolveViaClosureNamespace ( ErrorReporter reporter ) { List < String > componentNames = Splitter . on ( '.' ) . splitToList ( reference ) ; if ( componentNames . get ( 0 ) . isEmpty ( ) ) { return false ; } StaticTypedSlot slot = resolutionScope . getSlot ( componentNames . get ( 0 ) ) ; if ( slot != null && slot . getScope ( ) != null && slot . getScope ( ) . getParentScope ( ) != null ) { return false ; } String prefix = reference ; for ( int remainingComponentIndex = componentNames . size ( ) ; remainingComponentIndex > 0 ; remainingComponentIndex -- ) { ModuleSlot module = registry . getModuleSlot ( prefix ) ; if ( module == null ) { int lastDot = prefix . lastIndexOf ( "." ) ; if ( lastDot >= 0 ) { prefix = prefix . substring ( 0 , lastDot ) ; } continue ; } if ( module . isLegacyModule ( ) ) { return false ; } else { resolveViaPropertyGivenSlot ( module . type ( ) , module . definitionNode ( ) , componentNames , reporter , remainingComponentIndex ) ; return true ; } } return false ; }
Resolves a named type by checking for the longest prefix that matches some Closure namespace,
 if any, then attempting to resolve via properties based on the type of the `exports` object in
 that namespace.
Resolves a named type by checking for the longest prefix that matches some Closure namespace if any then attempting to resolve via properties based on the type of the ` exports ` object in that namespace .
// Skip types whose root component is defined in a local scope (not a global scope). Those will // follow the normal resolution scheme. (For legacy compatibility reasons we don't check for // global names that are the same as the module root). // Find the `exports` type of the longest prefix match of this namespace, if any. Then resolve // it via property. // Try to resolve this name via registry or properties. // Always stop resolution here whether successful or not, instead of continuing with // resolution via registry or via properties, to match legacy behavior. // Keep trying to resolve this name.