Repository navigation
Make NameMangler not depend on Compilation - #1524
Conversation
`NameMangler`'s job is to provide stable names for types and their members. It doesn't have a connection with the compilation process and therefore shouldn't depend on `Compilation`. This makes it reusable and unit testable. I'm also taking `CompilationUnitPrefix` away from it. It doesn't have a logical connection (except that it's related to naming and it was convenient to put it there). I'm putting it on NodeFactory temporarily, but there is a strong correlation between a dependency node using `CompiationUnitPrefix` in it's name and reporting `ShouldShareNodeAcrossModules` as false. Maybe we should use that in `ObjectWriter` to prepend it automatically instead of hoping the node won't mess it up and jumping through hoops (a static variable) to get to it.
|
LGTM |
|
Cc @nattress |
|
LGTM - Re moving CompilationUnitPrefix into ObjectWriter - with ProjectX, UTC will ask us for symbol names for nodes as it compiles, so we should retain some way of computing these things statelessly. I have been moving to having node types statically able to provide a mangled symbol name for themselves given the type / method they base their name on. I'd like to keep that to make interacting with UTC easier. |
|
@nattress We should probably move the name computations to a centralized location. We already have to keep things in sync between how we compute the name for a EEType node (or code node), vs. how we compute the name for the ExternEEType/ExternMethod node. Maybe the nodes shouldn't decide their names, maybe another class should. |
NameMangler's job is to provide stable names for types and theirmembers. It doesn't have a connection with the compilation process and
therefore shouldn't depend on
Compilation. This makes it reusable andunit testable.
I'm also taking
CompilationUnitPrefixaway from it. It doesn't have alogical connection (except that it's related to naming and it was
convenient to put it there). I'm putting it on NodeFactory temporarily,
but there is a strong correlation between a dependency node using
CompiationUnitPrefixin it's name and reportingShouldShareNodeAcrossModulesas false. Maybe we should use that inObjectWriterto prepend it automatically instead of hoping the nodewon't mess it up and jumping through hoops (a static variable) to get to
it.