diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-07-08 18:05:02 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-07-08 18:22:26 -0700 |
| commit | 5c864cbd58ea7cca6bec7b1f023422e27f0bcb1f (patch) | |
| tree | d29828a1aeb043c567a076d7a00108d4fa237e3b /source/slang/type-layout.cpp | |
| parent | 780a0bcd3724cad77cb65f931f111273776c9ca4 (diff) | |
Move renaming logic to lowering pass.
Code in Slang that is cross-compiled *might* introduce declarations that collide with language keywords that are reserved in the target.
This was previously being dealth with during final code emission, but the challenge there is that we want to allow user code that is being "rewritten" to use whatever identifiers it wants (they know better than us what is an error), and only apply renaming to our own code.
The approach here is to apply renaming during lowering - we validate each declaration to make sure its name is valid. Any expressions/types that refer to those declarations will automatically get emitted with the new name (while unchecked expressions will continue to be emitted with their existing name).
This isn't quite perfect, since we could in theory still rename a declaration in user code.
A more robust version down the line would try to determine if a declaration was nested inside code for the "rewriter."
Also note that this does *not* deal with any issues of name conflicts that might arise between modules. That would require a more complete and robust renaming pass, which seems tricky for me to pull off.
Diffstat (limited to 'source/slang/type-layout.cpp')
0 files changed, 0 insertions, 0 deletions
