code: private Node transformNode(
        Node templateNode,
        Map<String, Node> templateNodeToMatchMap,
        Map<String, String> shortNames) {
      Node clone = templateNode.cloneNode();
      if (templateNode.isName()) {
        String name = templateNode.getString();
        if (templateNodeToMatchMap.containsKey(name)) {
          Node templateMatch = templateNodeToMatchMap.get(name);
          Preconditions.checkNotNull(templateMatch, "Match for %s is null", name);
          if (templateNode.getParent().isVar()) {
            // Var declarations should only copy the variable name from the saved match, but the rest
            // of the subtree should come from the template node.
            clone.setString(templateMatch.getString());
          } else {
            return templateMatch.cloneTree();
          }
        }
      } else if (templateNode.isCall()
          && templateNode.getBooleanProp(Node.FREE_CALL)
          && templateNode.getFirstChild().isName()) {
        String name = templateNode.getFirstChild().getString();
        if (templateNodeToMatchMap.containsKey(name)) {
          // If this function call matches a template parameter, don't treat it as a free call.
          // This mirrors the behavior in the TemplateAstMatcher as well as ensures the code
          // generator doesn't generate code like "(0,fn)()".
          clone.putBooleanProp(Node.FREE_CALL, false);
        }
      }
      if (templateNode.isQualifiedName()) {
        String name = templateNode.getQualifiedName();
        if (shortNames.containsKey(name)) {
          String shortName = shortNames.get(name);
          if (!shortName.equals(name)) {
            return IR.name(shortNames.get(name));
          }
        }
      }
      for (Node child : templateNode.children()) {
        clone.addChildToBack(transformNode(child, templateNodeToMatchMap, shortNames));
      }
      return clone;
    }
docs: Transforms the template node to a replacement node by mapping the template names to the ones
  that were matched against in the JsSourceMatcher.