Add support for implicit and explicit operators (#51)

* .

* xxxxxxxx

* rev

* ....

* .

* ok

* 2

* .

* ,
This commit is contained in:
Stef Heyenrath
2023-01-09 21:06:30 +01:00
committed by GitHub
parent da40aae293
commit 106385a466
21 changed files with 288 additions and 2 deletions
@@ -132,6 +132,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.AkkaActor
public LocalActorRefProviderProxy(Akka.Actor.LocalActorRefProvider instance)
{
_Instance = instance;
@@ -48,6 +48,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
public ClientContextProxy(Microsoft.SharePoint.Client.ClientContext instance) : base(instance)
{
_Instance = instance;
@@ -85,6 +85,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
public ClientObjectProxy(Microsoft.SharePoint.Client.ClientObject instance)
{
_Instance = instance;
@@ -143,6 +143,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
public ClientRuntimeContextProxy(Microsoft.SharePoint.Client.ClientRuntimeContext instance)
{
_Instance = instance;
@@ -46,6 +46,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
public SecurableObjectProxy(Microsoft.SharePoint.Client.SecurableObject instance) : base(instance)
{
_Instance = instance;
@@ -1131,6 +1131,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
public WebProxy(Microsoft.SharePoint.Client.Web instance) : base(instance)
{
_Instance = instance;
@@ -24,6 +24,8 @@ using System;
public NoNamespaceProxy(ProxyInterfaceSourceGeneratorTests.Source.NoNamespace instance)
{
_Instance = instance;
@@ -30,6 +30,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
public GenericProxy(ProxyInterfaceSourceGeneratorTests.Source.Generic<T> instance)
{
_Instance = instance;
@@ -27,6 +27,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
public HumanProxy(ProxyInterfaceSourceGeneratorTests.Source.Human instance)
{
_Instance = instance;
@@ -0,0 +1,30 @@
//----------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by https://github.com/StefH/ProxyInterfaceSourceGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//----------------------------------------------------------------------------------------
#nullable enable
using System;
namespace ProxyInterfaceSourceGeneratorTests.Source
{
public partial interface IOperatorTest
{
ProxyInterfaceSourceGeneratorTests.Source.OperatorTest _Instance { get; }
string Name { get; set; }
int? Id { get; set; }
}
}
#nullable disable
@@ -25,6 +25,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
public MixedVisibilityProxy(ProxyInterfaceSourceGeneratorTests.Source.MixedVisibility instance)
{
_Instance = instance;
@@ -0,0 +1,61 @@
//----------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by https://github.com/StefH/ProxyInterfaceSourceGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//----------------------------------------------------------------------------------------
#nullable enable
using System;
namespace ProxyInterfaceSourceGeneratorTests.Source
{
public partial class OperatorTestProxy : IOperatorTest
{
public ProxyInterfaceSourceGeneratorTests.Source.OperatorTest _Instance { get; }
public string Name { get => _Instance.Name; set => _Instance.Name = value; }
public int? Id { get => _Instance.Id; set => _Instance.Id = value; }
public static implicit operator OperatorTestProxy(string name)
{
return new OperatorTestProxy((OperatorTest) name);
}
public static implicit operator OperatorTestProxy(int? id)
{
return new OperatorTestProxy((OperatorTest) id);
}
public static explicit operator string(OperatorTestProxy test)
{
return (string) test._Instance;
}
public static explicit operator int?(OperatorTestProxy test)
{
return (int?) test._Instance;
}
public OperatorTestProxy(ProxyInterfaceSourceGeneratorTests.Source.OperatorTest instance)
{
_Instance = instance;
}
}
}
#nullable disable
@@ -114,6 +114,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
public PersonExtendsProxy(ProxyInterfaceSourceGeneratorTests.Source.PersonExtends instance)
{
_Instance = instance;
@@ -168,6 +168,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
public PersonProxy(ProxyInterfaceSourceGeneratorTests.Source.Person instance) : base(instance)
{
_Instance = instance;