Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@
Test="true" Category="clr" Condition="'$(DotNetBuildSourceOnly)' != 'true'"/>
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\ILTrim.Tests\ILTrim.Tests.csproj"
Test="true" Category="clr" Condition="'$(DotNetBuildSourceOnly)' != 'true'"/>
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\dotnet-pgo\tests\dotnet-pgo.Tests.csproj"
Test="true" Category="clr" Condition="'$(DotNetBuildSourceOnly)' != 'true'"/>
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+clr.r2rtests+'))">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ public static TypeDesc GetTypeByCustomAttributeTypeName(this ModuleDesc module,
}.Resolve(parsed);
}

/// <summary>
/// Determines whether <paramref name="name"/> is a valid assembly-qualified type name,
/// including assembly qualification for constructed generic arguments.
/// </summary>
public static bool IsAssemblyQualifiedTypeName(string name)
{
return TypeName.TryParse(name.AsSpan(), out TypeName parsed, s_typeNameParseOptions)
&& IsFullyQualified(parsed);
}

public static TypeDesc GetTypeByCustomAttributeTypeNameForDataFlow(string name, ModuleDesc callingModule,
TypeSystemContext context, List<ModuleDesc> referencedModules, bool needsAssemblyName, bool fallbackToCoreLib, out bool failedBecauseNotFullyQualified)
{
Expand Down Expand Up @@ -65,32 +75,32 @@ public static TypeDesc GetTypeByCustomAttributeTypeNameForDataFlow(string name,
TypeDesc type = resolver.Resolve(parsed);

return type;
}

static bool IsFullyQualified(TypeName typeName)
private static bool IsFullyQualified(TypeName typeName)
{
if (typeName.AssemblyName is null)
{
if (typeName.AssemblyName is null)
{
return false;
}
return false;
}

if (typeName.IsArray || typeName.IsPointer || typeName.IsByRef)
{
return IsFullyQualified(typeName.GetElementType());
}
if (typeName.IsArray || typeName.IsPointer || typeName.IsByRef)
{
return IsFullyQualified(typeName.GetElementType());
}

if (typeName.IsConstructedGenericType)
if (typeName.IsConstructedGenericType)
{
foreach (TypeName typeArgument in typeName.GetGenericArguments())
{
foreach (var typeArgument in typeName.GetGenericArguments())
if (!IsFullyQualified(typeArgument))
{
if (!IsFullyQualified(typeArgument))
{
return false;
}
return false;
}
}

return true;
}

return true;
}

private struct TypeNameResolver
Expand Down
Loading
Loading