Fix "ref" parameter (#61)
This commit is contained in:
+1
-3
@@ -76,10 +76,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
|
||||
public void In_Out_Ref1(in int a, out int b, ref int c)
|
||||
{
|
||||
int a_ = a;
|
||||
int b_;
|
||||
int c_ = c;
|
||||
_Instance.In_Out_Ref1(in a_, out b_, ref c_);
|
||||
_Instance.In_Out_Ref1(in a, out b_, ref c);
|
||||
b = b_;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -103,10 +103,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
|
||||
public void In_Out_Ref1(in int a, out int b, ref int c)
|
||||
{
|
||||
int a_ = a;
|
||||
int b_;
|
||||
int c_ = c;
|
||||
_Instance.In_Out_Ref1(in a_, out b_, ref c_);
|
||||
_Instance.In_Out_Ref1(in a, out b_, ref c);
|
||||
b = b_;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
HintName: ProxyInterfaceGenerator.ProxyAttribute.g.cs,
|
||||
HintName: ProxyInterfaceGenerator.Extra.g.cs,
|
||||
Source:
|
||||
//----------------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
@@ -16,7 +16,7 @@ using System;
|
||||
namespace ProxyInterfaceGenerator
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Interface)]
|
||||
public class ProxyAttribute : Attribute
|
||||
internal sealed class ProxyAttribute : Attribute
|
||||
{
|
||||
public Type Type { get; }
|
||||
public bool ProxyBaseClasses { get; }
|
||||
|
||||
@@ -273,7 +273,7 @@ public class ProxyInterfaceSourceGeneratorTest
|
||||
public void GenerateFiles_ForSingleClass_Should_GenerateCorrectFiles()
|
||||
{
|
||||
// Arrange
|
||||
var attributeFilename = "ProxyInterfaceGenerator.ProxyAttribute.g.cs";
|
||||
var attributeFilename = "ProxyInterfaceGenerator.Extra.g.cs";
|
||||
var interfaceFilename = "ProxyInterfaceSourceGeneratorTests.Source.IPersonExtends.g.cs";
|
||||
var proxyClassFilename = "ProxyInterfaceSourceGeneratorTests.Source.PersonExtendsProxy.g.cs";
|
||||
|
||||
@@ -364,7 +364,7 @@ public class ProxyInterfaceSourceGeneratorTest
|
||||
public void GenerateFiles_ForTwoClasses_Should_GenerateCorrectFiles()
|
||||
{
|
||||
// Arrange
|
||||
var attributeFilename = "ProxyInterfaceGenerator.ProxyAttribute.g.cs";
|
||||
var attributeFilename = "ProxyInterfaceGenerator.Extra.g.cs";
|
||||
var interfaceHumanFilename = "ProxyInterfaceSourceGeneratorTests.Source.IHuman.g.cs";
|
||||
var proxyClassHumanFilename = "ProxyInterfaceSourceGeneratorTests.Source.HumanProxy.g.cs";
|
||||
var interfacePersonFilename = "ProxyInterfaceSourceGeneratorTests.Source.IPerson.g.cs";
|
||||
@@ -440,5 +440,12 @@ public class ProxyInterfaceSourceGeneratorTest
|
||||
var proxyCode = proxyClassPerson.ToString();
|
||||
if (Write) File.WriteAllText($"../../../Destination/{proxyClassPersonFilename}", proxyCode);
|
||||
proxyCode.Should().NotBeNullOrEmpty().And.Be(File.ReadAllText($"../../../Destination/{proxyClassPersonFilename}"));
|
||||
|
||||
var personProxy = new PersonProxy(new Person());
|
||||
|
||||
int c = 100;
|
||||
personProxy.In_Out_Ref1(1, out var b, ref c);
|
||||
|
||||
c.Should().Be(101);
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
public void In_Out_Ref1(in int a, out int b, ref int c)
|
||||
{
|
||||
b = 1;
|
||||
c++;
|
||||
}
|
||||
|
||||
public double[,] Out_MultiDimensionIssue54(out double[,] x)
|
||||
|
||||
Reference in New Issue
Block a user