Source:
public String produceDts(Depgraph depgraph) { Set<String> provides = new TreeSet<>(); Set<String> transitiveProvides = new TreeSet<>(); out = new StringWriter(); for (CompilerInput compilerInput : compiler.getInputsById().values()) { transitiveProvides.addAll(compilerInput.getProvides()); if (depgraph.getRoots().isEmpty() || depgraph.getRoots().contains(compilerInput.getSourceFile().getOriginalPath())) { provides.addAll(compilerInput.getProvides()); emitComment(String.format("Processing provides %s from input %s", compilerInput.getProvides(), compilerInput.getSourceFile().getOriginalPath())); } } TypedScope topScope = compiler.getTopScope(); for (String provide : provides) { TypedVar symbol = topScope.getOwnSlot(provide); if (symbol == null) { emitNamespaceBegin(provide); emitNamespaceEnd(); declareModule(provide, true); continue; } if (isTypedef(symbol.getType()) && symbol.getName().endsWith(".ArrayLike")) { emitSkipTypeAlias(symbol); emitBreak(); continue; } checkArgument(symbol.getType() != null, "all symbols should have a type: %s", provide); String namespace = provide; boolean isDefault = isDefaultExport(symbol); if (isDefault) { namespace = getNamespace(symbol.getName()); } int valueSymbolsWalked = declareNamespace(namespace, symbol, isDefault, transitiveProvides, false); if (valueSymbolsWalked > 0) { emitGoogRequireSupport(namespace, isDefault ? symbol.getName() : namespace); } declareModule(provide, isDefault); } processExternSymbols(); processUnprovidedTypes(provides, compiler); checkState(indent == 0, "indent must be zero after printing, but is %s", indent); return out.toString(); }

Target:
public String produceDts(Depgraph depgraph) { Set<String> provides = new TreeSet<>(); Set<String> transitiveProvides = new TreeSet<>(); out = new StringWriter(); for (CompilerInput compilerInput : compiler.getInputsById().values()) { transitiveProvides.addAll(compilerInput.getProvides()); if (depgraph.getRoots().isEmpty() || depgraph.getRoots().contains(compilerInput.getSourceFile().getOriginalPath())) { provides.addAll(compilerInput.getProvides()); emitComment(String.format("Processing provides %s from input %s", compilerInput.getProvides(), compilerInput.getSourceFile().getOriginalPath())); } } TypedScope topScope = compiler.getTopScope(); for (String provide : provides) { TypedVar symbol = topScope.getOwnSlot(provide); if (symbol == null) { emitNamespaceBegin(provide); emitNamespaceEnd(); declareModule(provide, true); continue; } if (isTypedef(symbol.getType()) && isArrayLike(symbol)) { emitSkipTypeAlias(symbol); emitBreak(); continue; } checkArgument(symbol.getType() != null, "all symbols should have a type: %s", provide); String namespace = provide; boolean isDefault = isDefaultExport(symbol); if (isDefault) { namespace = getNamespace(symbol.getName()); } int valueSymbolsWalked = declareNamespace(namespace, symbol, isDefault, transitiveProvides, false); if (valueSymbolsWalked > 0) { emitGoogRequireSupport(namespace, isDefault ? symbol.getName() : namespace); } declareModule(provide, isDefault); } processExternSymbols(); processUnprovidedTypes(provides, compiler); checkState(indent == 0, "indent must be zero after printing, but is %s", indent); return out.toString(); }