Skip to content
Prev Previous commit
Next Next commit
update FullyQualifiedName
  • Loading branch information
live1206 committed Feb 24, 2025
commit 3e5746481208f180778f8b97648c21b813c1e107
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public CSharpType(Type type, IReadOnlyList<CSharpType> arguments, bool isNullabl
Name = type.IsGenericType ? type.Name.Substring(0, type.Name.IndexOf('`')) : type.Name;
IsValueType = type.IsValueType;
Namespace = type.Namespace ?? string.Empty;
FullyQualifiedName = $"{Namespace}.{Name}";
IsPublic = type.IsPublic && arguments.All(t => t.IsPublic);
// open generic parameter such as the `T` in `List<T>` is considered as declared inside the `List<T>` type as well, but we just want this to be the pure nested type, therefore here we exclude the open generic parameter scenario
// for a closed generic parameter such as the `string` in `List<string>`, it is just an ordinary type without a `DeclaringType`.
Expand Down Expand Up @@ -153,7 +152,6 @@ internal CSharpType(
IsValueType = isValueType;
IsNullable = isNullable;
Namespace = ns;
FullyQualifiedName = $"{ns}.{name}";
DeclaringType = declaringType;
IsPublic = isPublic;
IsStruct = isStruct;
Expand All @@ -167,7 +165,7 @@ internal CSharpType(
/// Gets or sets the name of the type.
/// </summary>
public string Name { get; private set; }
internal string FullyQualifiedName { get; private set; }
internal string FullyQualifiedName => $"{Namespace}.{Name}";
public CSharpType? DeclaringType { get; private init; }
public bool IsValueType { get; private init; }
public bool IsEnum => _underlyingType is not null;
Expand Down Expand Up @@ -660,12 +658,10 @@ public void Update(string? name = null, string? @namespace = null)
if (name != null)
{
Name = name;
FullyQualifiedName = $"{Namespace}.{name}";
}
if (@namespace != null)
{
Namespace = @namespace;
FullyQualifiedName = $"{@namespace}.{name}";
}
}
}
Expand Down
Loading