code: private void addCodeToRequireSoyNamespaces(SoyFileNode soyFile) {
  
      String prevCalleeNamespace = null;
      Set<String> calleeNamespaces = new TreeSet<>();
      for (CallBasicNode node : new FindCalleesNotInFileVisitor().exec(soyFile)) {
        String calleeNotInFile = node.getCalleeName();
        int lastDotIndex = calleeNotInFile.lastIndexOf('.');
        calleeNamespaces.add(calleeNotInFile.substring(0, lastDotIndex));
      }
  
      for (String calleeNamespace : calleeNamespaces) {
        if (calleeNamespace.length() > 0 && !calleeNamespace.equals(prevCalleeNamespace)) {
          jsCodeBuilder.addGoogRequire(GoogRequire.create(calleeNamespace));
          prevCalleeNamespace = calleeNamespace;
        }
      }
    }
docs: Helper for visitSoyFileNode(SoyFileNode) to add code to require Soy namespaces.
  
  @param soyFile The node we're visiting.