diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2016-07-21 00:29:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-21 00:29:19 +0300 |
commit | 7548882874fb5797f4660caf983c50aa6f4ec7ab (patch) | |
tree | bee07c5698ba97ed495da9ded33f9a31f82b5767 /src/ILCompiler.MetadataTransform | |
parent | 62e17fbc263269bdbd82d546d1b277e106c08839 (diff) |
Move Name, Namespace and OwningType to DefType (#1553)
The motivation for this change is:
* To make the type name formatter general purpose (it can now handle
`NoMetadata` types)
* To make `NameMangler` able to mangle canon types and runtime
determined types without special casing
For situation where we have a NoMetadataType, the expectation is that
we're asking for the name for diagnostic purposes only (i.e. name
formatter wants it). In that case:
* In checked builds, the name can actually be retrieved from diagnostic
mapping tables, along with the owning type (we have a metadata TypeRef
for this).
* In the absence of diagnostic mapping tables, the name can be faked up
and the type pretended to be non-nested
("System.Runtime.NoMetadataTypes.EEType1234ABCD")
As an additional change, I'm also adding `Name` property on
`GenericParameterDesc`. We can compute a useful fallback value for this
in absence of metadata ("T" + index).
Diffstat (limited to 'src/ILCompiler.MetadataTransform')
-rw-r--r-- | src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Type.cs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Type.cs b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Type.cs index 6869aefa3..60ae0e148 100644 --- a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Type.cs +++ b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Type.cs @@ -166,7 +166,7 @@ namespace ILCompiler.Metadata // references to their definition records (we are avoiding emitting references // to things that have a definition within the same blob to save space). - Cts.MetadataType containingType = entity.ContainingType; + Cts.MetadataType containingType = (Cts.MetadataType)entity.ContainingType; MetadataRecord parentRecord = HandleType(containingType); TypeReference parentReferenceRecord = parentRecord as TypeReference; @@ -218,14 +218,15 @@ namespace ILCompiler.Metadata { Debug.Assert(entity.IsTypeDefinition); - if (entity.ContainingType != null) + Cts.MetadataType containingType = (Cts.MetadataType)entity.ContainingType; + if (containingType != null) { - var enclosingType = (TypeDefinition)HandleType(entity.ContainingType); + var enclosingType = (TypeDefinition)HandleType(containingType); record.EnclosingType = enclosingType; enclosingType.NestedTypes.Add(record); var namespaceDefinition = - HandleNamespaceDefinition(_policy.GetModuleOfType(entity.ContainingType), entity.ContainingType.Namespace); + HandleNamespaceDefinition(_policy.GetModuleOfType(containingType), entity.ContainingType.Namespace); record.NamespaceDefinition = namespaceDefinition; } else |