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
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Copyright (c) 2019 The nanoFramework project contributors
// See LICENSE file in the project root for full license information.
//

using Mono.Cecil;

namespace nanoFramework.Tools.MetadataProcessor.Core.Extensions
{
internal static class TypeReferenceExtensions
{
public static bool IsToInclude(this TypeReference value)
{
return !nanoTablesContext.IgnoringAttributes.Contains(value.FullName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<Compile Include="DumpGenerator\DumpTemplates.cs" />
<Compile Include="Endianness\nanoBinaryWriter.cs" />
<Compile Include="Extensions\ByteArrayExtensions.cs" />
<Compile Include="Extensions\TypeReferenceExtensions.cs" />
<Compile Include="Extensions\TypeDefinitionExtensions.cs" />
<Compile Include="InanoTable.cs" />
<Compile Include="Mono.Cecil\CodeWriter.cs" />
Expand Down
21 changes: 12 additions & 9 deletions source/MetadataProcessor.Core/Tables/nanoTablesContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace nanoFramework.Tools.MetadataProcessor
{
public sealed class nanoTablesContext
{
private readonly HashSet<string> _ignoringAttributes =
new HashSet<string>(StringComparer.Ordinal)
internal static HashSet<string> IgnoringAttributes { get; } = new HashSet<string>(StringComparer.Ordinal)
{
// Assembly-level attributes
"System.Reflection.AssemblyFileVersionAttribute",
"System.Runtime.InteropServices.ComVisibleAttribute",
"System.Runtime.InteropServices.GuidAttribute",

Expand Down Expand Up @@ -53,6 +53,9 @@ public sealed class nanoTablesContext
// Intellisense filtering attributes
"System.ComponentModel.EditorBrowsableAttribute",

//Not supported
"System.Reflection.DefaultMemberAttribute",

// Not supported attributes
"System.MTAThreadAttribute",
"System.STAThreadAttribute",
Expand All @@ -77,19 +80,19 @@ public nanoTablesContext(
// add it to ignore list, if it's not already there
if ((ClassNamesToExclude.Contains(item.AttributeType.FullName) ||
ClassNamesToExclude.Contains(item.AttributeType.DeclaringType?.FullName)) &&
!(_ignoringAttributes.Contains(item.AttributeType.FullName) ||
_ignoringAttributes.Contains(item.AttributeType.DeclaringType?.FullName)))
!(IgnoringAttributes.Contains(item.AttributeType.FullName) ||
IgnoringAttributes.Contains(item.AttributeType.DeclaringType?.FullName)))
{
_ignoringAttributes.Add(item.AttributeType.FullName);
IgnoringAttributes.Add(item.AttributeType.FullName);
}
}

// check ignoring attributes against ClassNamesToExclude
foreach(var className in ClassNamesToExclude)
{
if(!_ignoringAttributes.Contains(className))
if(!IgnoringAttributes.Contains(className))
{
_ignoringAttributes.Add(className);
IgnoringAttributes.Add(className);
}
}

Expand Down Expand Up @@ -266,8 +269,8 @@ private bool IsAttribute(
MemberReference typeReference)
{
return
(_ignoringAttributes.Contains(typeReference.FullName) ||
_ignoringAttributes.Contains(typeReference.DeclaringType?.FullName));
(IgnoringAttributes.Contains(typeReference.FullName) ||
IgnoringAttributes.Contains(typeReference.DeclaringType?.FullName));
}

private static List<TypeDefinition> GetOrderedTypes(
Expand Down
Loading