[SAOC 2025] Separate Semantic Routines from AST Nodes Weekly Update #7

Mohamed El Shorbagy mohrizq895 at gmail.com
Mon Nov 3 19:49:59 UTC 2025


# Summary of Progress (October 27 - November 03)

This week was a continuation of the work done to break the 
indirect dependency of AST-related files on the semantic phase. 
To make this process easier, I wrote a small Python script that 
constructs the dependency graph of the compiler source files and 
also removes **unused imports**. Here are the PRs that benefited 
from this script:

- (Merged) [Remove unused `ctfeexpr` import from 
`astcodegen`](https://github.com/dlang/dmd/pull/22034)
- (Merged) [Remove unused imports in AST-related 
files](https://github.com/dlang/dmd/pull/22036)
- (Merged) [Remove unused imports in AST-related files Pt. 
2](https://github.com/dlang/dmd/pull/22041)

Additionally, with the help of the generated dependency graph, I 
was able to find non-trivial dependencies of some AST files on 
semantic files through non-semantic files, such as [`expression` 
on `dcast`](https://github.com/dlang/dmd/pull/22045).

`astcodegen` was dependent on `typesem`, importing only one 
function (`typeToExpression`) which in fact does not depend on 
semantic. So, I moved it to `mtype` and the dependency is broken 
(see [Merged PR](https://github.com/dlang/dmd/pull/22035)).

There was also a challenge during the refactoring of `hdrgen` to 
remove the dependency on `typesem`. Luckily, I found a 
straightforward solution for it (see [Merged 
PR](https://github.com/dlang/dmd/pull/22033)).


More information about the Digitalmars-d mailing list