The Linker

The Linker recursively traverses the ASG using the Visitor pattern, and replaces any duplicate types with their originals, and removes duplicate declarations. References to the removed declarations are replaced with a reference to the original.

There are many additional transformations that may be applied during linking, such as the extraction of documentation strings from comments, the filtering and renaming of symbols, regrouping of declarations based on special annotations, etc., etc..