Browse Source

Use existing TypeParameterReference instances instead of creating new ones.

pull/1198/head
Daniel Grunwald 7 years ago
parent
commit
ea211ddbd4
  1. 2
      ICSharpCode.Decompiler/Metadata/Dom.cs
  2. 2
      ICSharpCode.Decompiler/TypeSystem/DecompilerTypeSystem.cs
  3. 4
      ICSharpCode.Decompiler/TypeSystem/Implementation/TypeSpecification.cs

2
ICSharpCode.Decompiler/Metadata/Dom.cs

@ -882,7 +882,7 @@ namespace ICSharpCode.Decompiler.Metadata
public FullTypeName GetPrimitiveType(PrimitiveTypeCode typeCode) public FullTypeName GetPrimitiveType(PrimitiveTypeCode typeCode)
{ {
return new FullTypeName($"System.{typeCode}"); return new TopLevelTypeName("System", typeCode.ToString());
} }
public FullTypeName GetSZArrayType(FullTypeName elementType) public FullTypeName GetSZArrayType(FullTypeName elementType)

2
ICSharpCode.Decompiler/TypeSystem/DecompilerTypeSystem.cs

@ -506,7 +506,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
return this; return this;
} else { } else {
return new SpecializingDecompilerTypeSystem(this, substitution); return new SpecializingDecompilerTypeSystem(this, substitution);
} }
} }
} }
} }

4
ICSharpCode.Decompiler/TypeSystem/Implementation/TypeSpecification.cs

@ -237,12 +237,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
public ITypeReference GetGenericMethodParameter(Unit genericContext, int index) public ITypeReference GetGenericMethodParameter(Unit genericContext, int index)
{ {
return new TypeParameterReference(SymbolKind.Method, index); return TypeParameterReference.Create(SymbolKind.Method, index);
} }
public ITypeReference GetGenericTypeParameter(Unit genericContext, int index) public ITypeReference GetGenericTypeParameter(Unit genericContext, int index)
{ {
return new TypeParameterReference(SymbolKind.TypeDefinition, index); return TypeParameterReference.Create(SymbolKind.TypeDefinition, index);
} }
public ITypeReference GetModifiedType(ITypeReference modifier, ITypeReference unmodifiedType, bool isRequired) public ITypeReference GetModifiedType(ITypeReference modifier, ITypeReference unmodifiedType, bool isRequired)

Loading…
Cancel
Save