File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+
4+ namespace Silk . NET . Core ;
5+
6+ public interface IHandle
7+ {
8+ public bool IsNull { get ; }
9+ }
Original file line number Diff line number Diff line change @@ -125,6 +125,8 @@ Silk.NET.Core.IGLContext.VSync.get -> bool
125125Silk.NET.Core.IGLContext.VSync.set -> void
126126Silk.NET.Core.IGLContextSource
127127Silk.NET.Core.IGLContextSource.GLContext.get -> Silk.NET.Core.IGLContext?
128+ Silk.NET.Core.IHandle
129+ Silk.NET.Core.IHandle.IsNull.get -> bool
128130Silk.NET.Core.INativeWindow
129131Silk.NET.Core.INativeWindow.TryGetPlatformInfo<TPlatformInfo>(out TPlatformInfo? info) -> bool
130132Silk.NET.Core.Loader.DefaultNativeContext
Original file line number Diff line number Diff line change @@ -513,6 +513,11 @@ public override SyntaxNode VisitStructDeclaration(StructDeclarationSyntax node)
513513 Token ( SyntaxKind . UnsafeKeyword ) ,
514514 Token ( SyntaxKind . PartialKeyword )
515515 )
516+ )
517+ . WithBaseList (
518+ BaseList (
519+ [ SimpleBaseType ( ParseTypeName ( "IHandle" ) ) ]
520+ )
516521 ) ;
517522 }
518523
@@ -700,6 +705,23 @@ private static IEnumerable<MemberDeclarationSyntax> GetDefaultHandleMembers(stri
700705 )
701706 )
702707 . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ;
708+
709+ // IHandle.IsNull
710+ yield return PropertyDeclaration (
711+ PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) ,
712+ Identifier ( "IsNull" )
713+ )
714+ . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) ) )
715+ . WithExpressionBody (
716+ ArrowExpressionClause (
717+ BinaryExpression (
718+ SyntaxKind . EqualsExpression ,
719+ CastExpression ( IdentifierName ( "IntPtr" ) , IdentifierName ( "Handle" ) ) ,
720+ LiteralExpression ( SyntaxKind . NumericLiteralExpression , Literal ( 0 ) )
721+ )
722+ )
723+ )
724+ . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ;
703725 }
704726
705727 private static IEnumerable < MemberDeclarationSyntax > GetDSLHandleMembers ( string structName )
You can’t perform that action at this time.
0 commit comments