This commit is contained in:
Christian Köllner 2019-10-22 19:50:46 +02:00
parent 9a12124574
commit 7d7a2eda74
9 changed files with 181 additions and 141 deletions

View File

@ -11684,21 +11684,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_getCap_OutBox_Cap = new MemberAccessPath(1U, 0U);
public static Capnproto_test.Capnp.Test.ITestInterface OutBox_Cap(this Task<(string, Capnproto_test.Capnp.Test.TestPipeline.Box)> task)
{
return (Capnproto_test.Capnp.Test.ITestInterface)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestInterface>(Impatient.GetAnswer(task).Access(Path_getCap_OutBox_Cap));
}
static readonly MemberAccessPath Path_getAnyCap_OutBox_Cap = new MemberAccessPath(1U, 0U);
public static BareProxy OutBox_Cap(this Task<(string, Capnproto_test.Capnp.Test.TestPipeline.AnyBox)> task)
{
return (BareProxy)CapabilityReflection.CreateProxy<BareProxy>(Impatient.GetAnswer(task).Access(Path_getAnyCap_OutBox_Cap));
}
}
public static class TestPipeline public static class TestPipeline
{ {
[TypeId(0xb0b29e51db0e26b1UL)] [TypeId(0xb0b29e51db0e26b1UL)]
@ -12469,15 +12454,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_foo_C = new MemberAccessPath(1U);
public static Capnproto_test.Capnp.Test.ITestCallOrder C(this Task<Capnproto_test.Capnp.Test.TestTailCallee.TailResult> task)
{
return (Capnproto_test.Capnp.Test.ITestCallOrder)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestCallOrder>(Impatient.GetAnswer(task).Access(Path_foo_C));
}
}
public static class TestTailCallee public static class TestTailCallee
{ {
[TypeId(0xa9ed2e5a9fd53d19UL)] [TypeId(0xa9ed2e5a9fd53d19UL)]
@ -12692,10 +12668,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
}
public static class TestTailCaller public static class TestTailCaller
{ {
[TypeId(0xb07a279515dc8ac5UL)] [TypeId(0xb07a279515dc8ac5UL)]
@ -13156,33 +13128,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_neverReturn_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestInterface Eager(this Task<Capnproto_test.Capnp.Test.ITestInterface> task)
{
return (Capnproto_test.Capnp.Test.ITestInterface)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestInterface>(Impatient.GetAnswer(task).Access(Path_neverReturn_Eager));
}
static readonly MemberAccessPath Path_echo_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestCallOrder Eager(this Task<Capnproto_test.Capnp.Test.ITestCallOrder> task)
{
return (Capnproto_test.Capnp.Test.ITestCallOrder)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestCallOrder>(Impatient.GetAnswer(task).Access(Path_echo_Eager));
}
static readonly MemberAccessPath Path_getHandle_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestHandle Eager(this Task<Capnproto_test.Capnp.Test.ITestHandle> task)
{
return (Capnproto_test.Capnp.Test.ITestHandle)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestHandle>(Impatient.GetAnswer(task).Access(Path_getHandle_Eager));
}
static readonly MemberAccessPath Path_getNull_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestMoreStuff Eager(this Task<Capnproto_test.Capnp.Test.ITestMoreStuff> task)
{
return (Capnproto_test.Capnp.Test.ITestMoreStuff)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestMoreStuff>(Impatient.GetAnswer(task).Access(Path_getNull_Eager));
}
}
public static class TestMoreStuff public static class TestMoreStuff
{ {
[TypeId(0x931ba418da60f6e4UL)] [TypeId(0x931ba418da60f6e4UL)]
@ -14834,15 +14779,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_makeThing_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.TestMembrane.IThing Eager(this Task<Capnproto_test.Capnp.Test.TestMembrane.IThing> task)
{
return (Capnproto_test.Capnp.Test.TestMembrane.IThing)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.TestMembrane.IThing>(Impatient.GetAnswer(task).Access(Path_makeThing_Eager));
}
}
public static class TestMembrane public static class TestMembrane
{ {
[TypeId(0x9352e4e41f173917UL), Proxy(typeof(ThingProxy)), Skeleton(typeof(ThingSkeleton))] [TypeId(0x9352e4e41f173917UL), Proxy(typeof(ThingProxy)), Skeleton(typeof(ThingSkeleton))]
@ -17313,4 +17249,55 @@ namespace Capnproto_test.Capnp.Test
} }
} }
} }
}
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_getCap_OutBox_Cap = new MemberAccessPath(1U, 0U);
public static Capnproto_test.Capnp.Test.ITestInterface OutBox_Cap(this Task<(string, Capnproto_test.Capnp.Test.TestPipeline.Box)> task)
{
return (Capnproto_test.Capnp.Test.ITestInterface)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestInterface>(Impatient.GetAnswer(task).Access(Path_getCap_OutBox_Cap));
}
static readonly MemberAccessPath Path_getAnyCap_OutBox_Cap = new MemberAccessPath(1U, 0U);
public static BareProxy OutBox_Cap(this Task<(string, Capnproto_test.Capnp.Test.TestPipeline.AnyBox)> task)
{
return (BareProxy)CapabilityReflection.CreateProxy<BareProxy>(Impatient.GetAnswer(task).Access(Path_getAnyCap_OutBox_Cap));
}
static readonly MemberAccessPath Path_foo_C = new MemberAccessPath(1U);
public static Capnproto_test.Capnp.Test.ITestCallOrder C(this Task<Capnproto_test.Capnp.Test.TestTailCallee.TailResult> task)
{
return (Capnproto_test.Capnp.Test.ITestCallOrder)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestCallOrder>(Impatient.GetAnswer(task).Access(Path_foo_C));
}
static readonly MemberAccessPath Path_neverReturn_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestInterface Eager(this Task<Capnproto_test.Capnp.Test.ITestInterface> task)
{
return (Capnproto_test.Capnp.Test.ITestInterface)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestInterface>(Impatient.GetAnswer(task).Access(Path_neverReturn_Eager));
}
static readonly MemberAccessPath Path_echo_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestCallOrder Eager(this Task<Capnproto_test.Capnp.Test.ITestCallOrder> task)
{
return (Capnproto_test.Capnp.Test.ITestCallOrder)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestCallOrder>(Impatient.GetAnswer(task).Access(Path_echo_Eager));
}
static readonly MemberAccessPath Path_getHandle_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestHandle Eager(this Task<Capnproto_test.Capnp.Test.ITestHandle> task)
{
return (Capnproto_test.Capnp.Test.ITestHandle)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestHandle>(Impatient.GetAnswer(task).Access(Path_getHandle_Eager));
}
static readonly MemberAccessPath Path_getNull_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestMoreStuff Eager(this Task<Capnproto_test.Capnp.Test.ITestMoreStuff> task)
{
return (Capnproto_test.Capnp.Test.ITestMoreStuff)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestMoreStuff>(Impatient.GetAnswer(task).Access(Path_getNull_Eager));
}
static readonly MemberAccessPath Path_makeThing_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.TestMembrane.IThing Eager(this Task<Capnproto_test.Capnp.Test.TestMembrane.IThing> task)
{
return (Capnproto_test.Capnp.Test.TestMembrane.IThing)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.TestMembrane.IThing>(Impatient.GetAnswer(task).Access(Path_makeThing_Eager));
}
}
}

View File

@ -28,6 +28,7 @@
<None Remove="Embedded Resources\Empty1.capnp" /> <None Remove="Embedded Resources\Empty1.capnp" />
<None Remove="Embedded Resources\invalid.capnp" /> <None Remove="Embedded Resources\invalid.capnp" />
<None Remove="Embedded Resources\Issue19.capnp.bin" /> <None Remove="Embedded Resources\Issue19.capnp.bin" />
<None Remove="Embedded Resources\Issue21.capnp.bin" />
<None Remove="Embedded Resources\null.bin" /> <None Remove="Embedded Resources\null.bin" />
<None Remove="Embedded Resources\test.capnp" /> <None Remove="Embedded Resources\test.capnp" />
<None Remove="Embedded Resources\test.capnp.bin" /> <None Remove="Embedded Resources\test.capnp.bin" />
@ -45,6 +46,7 @@
<EmbeddedResource Include="Embedded Resources\Empty.capnp" /> <EmbeddedResource Include="Embedded Resources\Empty.capnp" />
<EmbeddedResource Include="Embedded Resources\Empty1.capnp" /> <EmbeddedResource Include="Embedded Resources\Empty1.capnp" />
<EmbeddedResource Include="Embedded Resources\invalid.capnp" /> <EmbeddedResource Include="Embedded Resources\invalid.capnp" />
<EmbeddedResource Include="Embedded Resources\Issue21.capnp.bin" />
<EmbeddedResource Include="Embedded Resources\null.bin" /> <EmbeddedResource Include="Embedded Resources\null.bin" />
<EmbeddedResource Include="Embedded Resources\test.capnp.bin" /> <EmbeddedResource Include="Embedded Resources\test.capnp.bin" />
<EmbeddedResource Include="Embedded Resources\test.cs" /> <EmbeddedResource Include="Embedded Resources\test.cs" />

View File

@ -55,3 +55,4 @@ Scenario Outline: Valid generator output
Examples: Examples:
| bin | | bin |
| Issue19.capnp.bin | | Issue19.capnp.bin |
| Issue21.capnp.bin |

View File

@ -267,6 +267,18 @@ this.ScenarioInitialize(scenarioInfo);
{ {
#line 50 #line 50
this.ValidGeneratorOutput("Issue19.capnp.bin", ((string[])(null))); this.ValidGeneratorOutput("Issue19.capnp.bin", ((string[])(null)));
#line hidden
}
[Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
[Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Valid generator output: Issue21.capnp.bin")]
[Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "CodeGenerator")]
[Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("VariantName", "Issue21.capnp.bin")]
[Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("Parameter:bin", "Issue21.capnp.bin")]
public virtual void ValidGeneratorOutput_Issue21_Capnp_Bin()
{
#line 50
this.ValidGeneratorOutput("Issue21.capnp.bin", ((string[])(null)));
#line hidden #line hidden
} }
} }

View File

@ -10900,21 +10900,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_getCap_OutBox_Cap = new MemberAccessPath(1U, 0U);
public static Capnproto_test.Capnp.Test.ITestInterface OutBox_Cap(this Task<(string, Capnproto_test.Capnp.Test.TestPipeline.Box)> task)
{
return (Capnproto_test.Capnp.Test.ITestInterface)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestInterface>(Impatient.GetAnswer(task).Access(Path_getCap_OutBox_Cap));
}
static readonly MemberAccessPath Path_getAnyCap_OutBox_Cap = new MemberAccessPath(1U, 0U);
public static BareProxy OutBox_Cap(this Task<(string, Capnproto_test.Capnp.Test.TestPipeline.AnyBox)> task)
{
return (BareProxy)CapabilityReflection.CreateProxy<BareProxy>(Impatient.GetAnswer(task).Access(Path_getAnyCap_OutBox_Cap));
}
}
public static class TestPipeline public static class TestPipeline
{ {
[TypeId(0xb0b29e51db0e26b1UL)] [TypeId(0xb0b29e51db0e26b1UL)]
@ -11685,15 +11670,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_foo_C = new MemberAccessPath(1U);
public static Capnproto_test.Capnp.Test.ITestCallOrder C(this Task<Capnproto_test.Capnp.Test.TestTailCallee.TailResult> task)
{
return (Capnproto_test.Capnp.Test.ITestCallOrder)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestCallOrder>(Impatient.GetAnswer(task).Access(Path_foo_C));
}
}
public static class TestTailCallee public static class TestTailCallee
{ {
[TypeId(0xa9ed2e5a9fd53d19UL)] [TypeId(0xa9ed2e5a9fd53d19UL)]
@ -11908,10 +11884,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
}
public static class TestTailCaller public static class TestTailCaller
{ {
[TypeId(0xb07a279515dc8ac5UL)] [TypeId(0xb07a279515dc8ac5UL)]
@ -12372,33 +12344,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_neverReturn_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestInterface Eager(this Task<Capnproto_test.Capnp.Test.ITestInterface> task)
{
return (Capnproto_test.Capnp.Test.ITestInterface)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestInterface>(Impatient.GetAnswer(task).Access(Path_neverReturn_Eager));
}
static readonly MemberAccessPath Path_echo_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestCallOrder Eager(this Task<Capnproto_test.Capnp.Test.ITestCallOrder> task)
{
return (Capnproto_test.Capnp.Test.ITestCallOrder)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestCallOrder>(Impatient.GetAnswer(task).Access(Path_echo_Eager));
}
static readonly MemberAccessPath Path_getHandle_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestHandle Eager(this Task<Capnproto_test.Capnp.Test.ITestHandle> task)
{
return (Capnproto_test.Capnp.Test.ITestHandle)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestHandle>(Impatient.GetAnswer(task).Access(Path_getHandle_Eager));
}
static readonly MemberAccessPath Path_getNull_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestMoreStuff Eager(this Task<Capnproto_test.Capnp.Test.ITestMoreStuff> task)
{
return (Capnproto_test.Capnp.Test.ITestMoreStuff)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestMoreStuff>(Impatient.GetAnswer(task).Access(Path_getNull_Eager));
}
}
public static class TestMoreStuff public static class TestMoreStuff
{ {
[TypeId(0x931ba418da60f6e4UL)] [TypeId(0x931ba418da60f6e4UL)]
@ -14050,15 +13995,6 @@ namespace Capnproto_test.Capnp.Test
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_makeThing_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.TestMembrane.IThing Eager(this Task<Capnproto_test.Capnp.Test.TestMembrane.IThing> task)
{
return (Capnproto_test.Capnp.Test.TestMembrane.IThing)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.TestMembrane.IThing>(Impatient.GetAnswer(task).Access(Path_makeThing_Eager));
}
}
public static class TestMembrane public static class TestMembrane
{ {
[TypeId(0x9352e4e41f173917UL), Proxy(typeof(ThingProxy)), Skeleton(typeof(ThingSkeleton))] [TypeId(0x9352e4e41f173917UL), Proxy(typeof(ThingProxy)), Skeleton(typeof(ThingSkeleton))]
@ -16529,4 +16465,55 @@ namespace Capnproto_test.Capnp.Test
} }
} }
} }
public static partial class PipeliningSupportExtensions
{
static readonly MemberAccessPath Path_getCap_OutBox_Cap = new MemberAccessPath(1U, 0U);
public static Capnproto_test.Capnp.Test.ITestInterface OutBox_Cap(this Task<(string, Capnproto_test.Capnp.Test.TestPipeline.Box)> task)
{
return (Capnproto_test.Capnp.Test.ITestInterface)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestInterface>(Impatient.GetAnswer(task).Access(Path_getCap_OutBox_Cap));
}
static readonly MemberAccessPath Path_getAnyCap_OutBox_Cap = new MemberAccessPath(1U, 0U);
public static BareProxy OutBox_Cap(this Task<(string, Capnproto_test.Capnp.Test.TestPipeline.AnyBox)> task)
{
return (BareProxy)CapabilityReflection.CreateProxy<BareProxy>(Impatient.GetAnswer(task).Access(Path_getAnyCap_OutBox_Cap));
}
static readonly MemberAccessPath Path_foo_C = new MemberAccessPath(1U);
public static Capnproto_test.Capnp.Test.ITestCallOrder C(this Task<Capnproto_test.Capnp.Test.TestTailCallee.TailResult> task)
{
return (Capnproto_test.Capnp.Test.ITestCallOrder)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestCallOrder>(Impatient.GetAnswer(task).Access(Path_foo_C));
}
static readonly MemberAccessPath Path_neverReturn_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestInterface Eager(this Task<Capnproto_test.Capnp.Test.ITestInterface> task)
{
return (Capnproto_test.Capnp.Test.ITestInterface)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestInterface>(Impatient.GetAnswer(task).Access(Path_neverReturn_Eager));
}
static readonly MemberAccessPath Path_echo_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestCallOrder Eager(this Task<Capnproto_test.Capnp.Test.ITestCallOrder> task)
{
return (Capnproto_test.Capnp.Test.ITestCallOrder)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestCallOrder>(Impatient.GetAnswer(task).Access(Path_echo_Eager));
}
static readonly MemberAccessPath Path_getHandle_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestHandle Eager(this Task<Capnproto_test.Capnp.Test.ITestHandle> task)
{
return (Capnproto_test.Capnp.Test.ITestHandle)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestHandle>(Impatient.GetAnswer(task).Access(Path_getHandle_Eager));
}
static readonly MemberAccessPath Path_getNull_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.ITestMoreStuff Eager(this Task<Capnproto_test.Capnp.Test.ITestMoreStuff> task)
{
return (Capnproto_test.Capnp.Test.ITestMoreStuff)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.ITestMoreStuff>(Impatient.GetAnswer(task).Access(Path_getNull_Eager));
}
static readonly MemberAccessPath Path_makeThing_Eager = new MemberAccessPath(0U);
public static Capnproto_test.Capnp.Test.TestMembrane.IThing Eager(this Task<Capnproto_test.Capnp.Test.TestMembrane.IThing> task)
{
return (Capnproto_test.Capnp.Test.TestMembrane.IThing)CapabilityReflection.CreateProxy<Capnproto_test.Capnp.Test.TestMembrane.IThing>(Impatient.GetAnswer(task).Access(Path_makeThing_Eager));
}
}
} }

View File

@ -101,11 +101,6 @@
yield return _interfaceGen.MakeProxy(def); yield return _interfaceGen.MakeProxy(def);
yield return _interfaceGen.MakeSkeleton(def); yield return _interfaceGen.MakeSkeleton(def);
if (_interfaceGen.RequiresPipeliningSupport(def))
{
yield return _interfaceGen.MakePipeliningSupport(def);
}
if (def.NestedTypes.Any()) if (def.NestedTypes.Any())
{ {
var ns = ClassDeclaration( var ns = ClassDeclaration(
@ -147,6 +142,46 @@
} }
} }
ClassDeclarationSyntax TransformPipeliningSupport(IHasNestedDefinitions def)
{
var classDecl = default(ClassDeclarationSyntax);
var q = new Queue<TypeDefinition>();
foreach (var inner in def.NestedDefinitions.OfType<TypeDefinition>())
{
q.Enqueue(inner);
}
while (q.Count > 0)
{
var cur = q.Dequeue();
if (cur.Tag == TypeTag.Interface && _interfaceGen.RequiresPipeliningSupport(cur))
{
var members = _interfaceGen.MakePipeliningSupport(cur).ToArray();
if (members.Length > 0)
{
if (classDecl == null)
{
classDecl = ClassDeclaration(_names.PipeliningExtensionsClassName.Identifier)
.AddModifiers(Public, Static, Partial);
}
classDecl = classDecl.AddMembers(members);
}
}
foreach (var inner in cur.NestedDefinitions.OfType<TypeDefinition>())
{
q.Enqueue(inner);
}
}
return classDecl;
}
internal string Transform(GenFile file) internal string Transform(GenFile file)
{ {
NameSyntax topNamespace = GenNames.NamespaceName(file.Namespace) ?? _names.TopNamespace; NameSyntax topNamespace = GenNames.NamespaceName(file.Namespace) ?? _names.TopNamespace;
@ -158,6 +193,13 @@
ns = ns.AddMembers(Transform(def).ToArray()); ns = ns.AddMembers(Transform(def).ToArray());
} }
var psc = TransformPipeliningSupport(file);
if (psc != null)
{
ns = ns.AddMembers(psc);
}
var cu = CompilationUnit().AddUsings( var cu = CompilationUnit().AddUsings(
UsingDirective(ParseName("Capnp")), UsingDirective(ParseName("Capnp")),
UsingDirective(ParseName("Capnp.Rpc")), UsingDirective(ParseName("Capnp.Rpc")),

View File

@ -760,11 +760,8 @@ namespace CapnpC.CSharp.Generator.CodeGen
readonly HashSet<(string, string)> _existingExtensionMethods = new HashSet<(string, string)>(); readonly HashSet<(string, string)> _existingExtensionMethods = new HashSet<(string, string)>();
public MemberDeclarationSyntax MakePipeliningSupport(TypeDefinition type) public IEnumerable<MemberDeclarationSyntax> MakePipeliningSupport(TypeDefinition type)
{ {
var classDecl = ClassDeclaration(_names.PipeliningExtensionsClassName.Identifier)
.AddModifiers(Public, Static, Partial);
foreach (var method in type.Methods) foreach (var method in type.Methods)
{ {
foreach (var path in ExpandPipeliningPaths(method)) foreach (var path in ExpandPipeliningPaths(method))
@ -836,11 +833,10 @@ namespace CapnpC.CSharp.Generator.CodeGen
Argument( Argument(
accessPath.IdentifierName))))))); accessPath.IdentifierName)))))));
classDecl = classDecl.AddMembers(pathDecl, methodDecl); yield return pathDecl;
yield return methodDecl;
} }
} }
return classDecl;
} }
} }
} }

View File

@ -0,0 +1,13 @@
@0xae5ab8efc527d253;
struct Outer {
interface A {
methodA @0 (param1 :Int64) -> ();
}
interface B {
methodB @0 (param1 :Int64) -> (a :A);
}
}