-
-
Notifications
You must be signed in to change notification settings - Fork 439
3.0 - Simple IHandle interface for XYZHandle structs #2504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop/3.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Silk.NET.Core; | ||
|
|
||
| public interface IHandle | ||
|
Check failure on line 6 in sources/Core/Core/Abstractions/IHandle.cs
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm on second thought, maybe we could do |
||
| { | ||
| public bool IsNull { get; } | ||
|
Check failure on line 8 in sources/Core/Core/Abstractions/IHandle.cs
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -513,6 +513,11 @@ public override SyntaxNode VisitStructDeclaration(StructDeclarationSyntax node) | |
| Token(SyntaxKind.UnsafeKeyword), | ||
| Token(SyntaxKind.PartialKeyword) | ||
| ) | ||
| ) | ||
| .WithBaseList( | ||
| BaseList( | ||
| [SimpleBaseType(ParseTypeName("IHandle"))] | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -700,6 +705,23 @@ private static IEnumerable<MemberDeclarationSyntax> GetDefaultHandleMembers(stri | |
| ) | ||
| ) | ||
| .WithSemicolonToken(Token(SyntaxKind.SemicolonToken)); | ||
|
|
||
| // IHandle.IsNull | ||
| yield return PropertyDeclaration( | ||
| PredefinedType(Token(SyntaxKind.BoolKeyword)), | ||
| Identifier("IsNull") | ||
| ) | ||
| .WithModifiers(TokenList(Token(SyntaxKind.PublicKeyword))) | ||
| .WithExpressionBody( | ||
| ArrowExpressionClause( | ||
| BinaryExpression( | ||
| SyntaxKind.EqualsExpression, | ||
| CastExpression(IdentifierName("IntPtr"), IdentifierName("Handle")), | ||
| LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)) | ||
|
Comment on lines
+719
to
+720
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we do |
||
| ) | ||
| ) | ||
| ) | ||
| .WithSemicolonToken(Token(SyntaxKind.SemicolonToken)); | ||
| } | ||
|
|
||
| private static IEnumerable<MemberDeclarationSyntax> GetDSLHandleMembers(string structName) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing docs comments are resulting in compilation failure.