/// <inheritdoc /> public TypeMemoryLayout GetTypeMemoryLayout(ITypeDescriptor type) { type = _contextModule.CorLibTypeFactory.FromType(type) ?? type; if (!_memoryLayouts.TryGetValue(type, out var memoryLayout)) { memoryLayout = type switch { ITypeDefOrRef typeDefOrRef => typeDefOrRef.GetImpliedMemoryLayout(Is32Bit), TypeSignature signature => signature.GetImpliedMemoryLayout(Is32Bit), _ => throw new ArgumentOutOfRangeException(nameof(type)) }; _memoryLayouts[type] = memoryLayout; } return(memoryLayout); }