-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes StructLayout being mishandled (#205)
- Loading branch information
Showing
4 changed files
with
90 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Microsoft.CodeAnalysis; | ||
|
||
namespace Cecilifier.Core.AST; | ||
|
||
// Helper types / members useful only to SyntaxWalkerBase. | ||
// Some of these may be refactored and made public/internal if needed in the future. | ||
internal partial class SyntaxWalkerBase | ||
{ | ||
internal enum AttributeKind | ||
{ | ||
DllImport, | ||
StructLayout, | ||
Ordinary | ||
} | ||
} | ||
|
||
public static class PrivateExtensions | ||
{ | ||
internal static SyntaxWalkerBase.AttributeKind AttributeKind(this ITypeSymbol self) => (self.ContainingNamespace.ToString(), self.Name) switch | ||
{ | ||
("System.Runtime.InteropServices", "DllImportAttribute") => SyntaxWalkerBase.AttributeKind.DllImport, | ||
("System.Runtime.InteropServices", "StructLayoutAttribute") => SyntaxWalkerBase.AttributeKind.StructLayout, | ||
_ => SyntaxWalkerBase.AttributeKind.Ordinary, | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters