Skip to content

Commit b1e1836

Browse files
Copilotdex3r
andcommitted
Implement WithCompileTimeConstants for all Stage4 builders and add Stage5 builders
- Add WithCompileTimeConstants methods to DataMethodBodyBuilderStage4, DataMethodBodyBuilderStage4NoArg, DataMethodBodyBuilderStage4ReturnVoid, and DataMethodBodyBuilderStage4ReturnVoidNoArg - Add Stage5 builder records: DataMethodBodyBuilderStage5WithConstants, DataMethodBodyBuilderStage5NoArgWithConstants, DataMethodBodyBuilderStage5ReturnVoidWithConstants, and DataMethodBodyBuilderStage5ReturnVoidNoArgWithConstants - Update BodyGenerationDataExtractor to pass CompileTimeConstants when invoking ReturnConstantValueFactory and RuntimeDelegateBody delegates - Add unit tests for all Stage5 builders and WithCompileTimeConstants flow - Add unit tests for BodyGenerationDataExtractor with constants Co-authored-by: dex3r <[email protected]> Agent-Logs-Url: https://github.com/dex3r/EasySourceGenerators/sessions/c5e01801-855b-4054-bfa6-7860c743dca7
1 parent 96c0fbe commit b1e1836

4 files changed

Lines changed: 406 additions & 8 deletions

File tree

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
using EasySourceGenerators.Generators.DataBuilding;
2+
using EasySourceGenerators.Generators.IncrementalGenerators;
3+
4+
namespace EasySourceGenerators.GeneratorTests;
5+
6+
[TestFixture]
7+
public class BodyGenerationDataExtractorTests
8+
{
9+
[Test]
10+
public void Extract_WithCompileTimeConstants_BodyReturningConstant_InvokesWithConstants()
11+
{
12+
DataMethodBodyGenerator generator = new DataMethodBodyGenerator(
13+
new BodyGenerationData(
14+
ReturnType: typeof(string),
15+
ParametersTypes: [],
16+
CompileTimeConstants: 42,
17+
ReturnConstantValueFactory: (Func<int, string>)(constants => $"value_{constants}")));
18+
19+
FluentBodyResult result = BodyGenerationDataExtractor.Extract(generator, false);
20+
21+
Assert.That(result.ReturnValue, Is.EqualTo("value_42"));
22+
Assert.That(result.IsVoid, Is.False);
23+
}
24+
25+
[Test]
26+
public void Extract_WithCompileTimeConstants_RuntimeBodyNoArgs_InvokesWithConstants()
27+
{
28+
DataMethodBodyGenerator generator = new DataMethodBodyGenerator(
29+
new BodyGenerationData(
30+
ReturnType: typeof(string),
31+
ParametersTypes: [],
32+
CompileTimeConstants: 10,
33+
RuntimeDelegateBody: (Func<int, string>)(constants => $"body_{constants}")));
34+
35+
FluentBodyResult result = BodyGenerationDataExtractor.Extract(generator, false);
36+
37+
Assert.That(result.ReturnValue, Is.EqualTo("body_10"));
38+
Assert.That(result.IsVoid, Is.False);
39+
}
40+
41+
[Test]
42+
public void Extract_WithCompileTimeConstants_RuntimeBodyWithAdditionalParams_ReturnsNullValue()
43+
{
44+
DataMethodBodyGenerator generator = new DataMethodBodyGenerator(
45+
new BodyGenerationData(
46+
ReturnType: typeof(string),
47+
ParametersTypes: [typeof(int)],
48+
CompileTimeConstants: 10,
49+
RuntimeDelegateBody: (Func<int, int, string>)((constants, param) => $"{constants}_{param}")));
50+
51+
FluentBodyResult result = BodyGenerationDataExtractor.Extract(generator, false);
52+
53+
Assert.That(result.ReturnValue, Is.Null);
54+
Assert.That(result.IsVoid, Is.False);
55+
}
56+
57+
[Test]
58+
public void Extract_WithoutConstants_BodyReturningConstant_InvokesWithoutArgs()
59+
{
60+
DataMethodBodyGenerator generator = new DataMethodBodyGenerator(
61+
new BodyGenerationData(
62+
ReturnType: typeof(int),
63+
ParametersTypes: [],
64+
ReturnConstantValueFactory: (Func<int>)(() => 99)));
65+
66+
FluentBodyResult result = BodyGenerationDataExtractor.Extract(generator, false);
67+
68+
Assert.That(result.ReturnValue, Is.EqualTo("99"));
69+
}
70+
71+
[Test]
72+
public void Extract_WithoutConstants_RuntimeBodyNoParams_InvokesDirectly()
73+
{
74+
DataMethodBodyGenerator generator = new DataMethodBodyGenerator(
75+
new BodyGenerationData(
76+
ReturnType: typeof(string),
77+
ParametersTypes: [],
78+
RuntimeDelegateBody: (Func<string>)(() => "hello")));
79+
80+
FluentBodyResult result = BodyGenerationDataExtractor.Extract(generator, false);
81+
82+
Assert.That(result.ReturnValue, Is.EqualTo("hello"));
83+
}
84+
85+
[Test]
86+
public void Extract_VoidReturnType_WithConstants_RuntimeBody_InvokesWithConstants()
87+
{
88+
string captured = "";
89+
DataMethodBodyGenerator generator = new DataMethodBodyGenerator(
90+
new BodyGenerationData(
91+
ReturnType: typeof(void),
92+
ParametersTypes: [],
93+
CompileTimeConstants: "test",
94+
RuntimeDelegateBody: (Action<string>)(constants => { captured = constants; })));
95+
96+
FluentBodyResult result = BodyGenerationDataExtractor.Extract(generator, true);
97+
98+
Assert.That(result.IsVoid, Is.True);
99+
Assert.That(captured, Is.EqualTo("test"));
100+
}
101+
102+
[Test]
103+
public void Extract_NullBodyGenerationData_ReturnsNullReturnValue()
104+
{
105+
DataMethodBodyGenerator generator = new DataMethodBodyGenerator(
106+
new BodyGenerationData(ReturnType: typeof(string)));
107+
108+
FluentBodyResult result = BodyGenerationDataExtractor.Extract(generator, false);
109+
110+
Assert.That(result.ReturnValue, Is.Null);
111+
}
112+
113+
[Test]
114+
public void Extract_WithCompileTimeConstants_ConstantFactoryTakesPriority()
115+
{
116+
DataMethodBodyGenerator generator = new DataMethodBodyGenerator(
117+
new BodyGenerationData(
118+
ReturnType: typeof(string),
119+
ParametersTypes: [],
120+
CompileTimeConstants: 5,
121+
ReturnConstantValueFactory: (Func<int, string>)(constants => $"factory_{constants}"),
122+
RuntimeDelegateBody: (Func<int, string>)(constants => $"body_{constants}")));
123+
124+
FluentBodyResult result = BodyGenerationDataExtractor.Extract(generator, false);
125+
126+
Assert.That(result.ReturnValue, Is.EqualTo("factory_5"));
127+
}
128+
}

EasySourceGenerators.GeneratorTests/MethodBodyBuilderTests.cs

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,198 @@ public void FullFluentChain_UseProvidedBody_ProducesCorrectData()
189189
object? bodyValue = generator.Data.RuntimeDelegateBody!.DynamicInvoke();
190190
Assert.That(bodyValue, Is.EqualTo(42));
191191
}
192+
193+
[Test]
194+
public void WithCompileTimeConstants_WithParam_ReturnsStage5WithConstants()
195+
{
196+
DataMethodBodyBuilderStage4<int, string> stage4 = new DataMethodBodyBuilderStage4<int, string>(
197+
new BodyGenerationData(ReturnType: typeof(string), ParametersTypes: [typeof(int)]));
198+
199+
IMethodBodyBuilderStage5WithConstants<int, string, int> result = stage4.WithCompileTimeConstants(() => 42);
200+
201+
Assert.That(result, Is.TypeOf<DataMethodBodyBuilderStage5WithConstants<int, string, int>>());
202+
DataMethodBodyBuilderStage5WithConstants<int, string, int> stage5 = (DataMethodBodyBuilderStage5WithConstants<int, string, int>)result;
203+
Assert.That(stage5.Data.CompileTimeConstants, Is.EqualTo(42));
204+
}
205+
206+
[Test]
207+
public void WithCompileTimeConstants_NoArg_ReturnsStage5NoArgWithConstants()
208+
{
209+
DataMethodBodyBuilderStage4NoArg<string> stage4 = new DataMethodBodyBuilderStage4NoArg<string>(
210+
new BodyGenerationData(ReturnType: typeof(string), ParametersTypes: []));
211+
212+
IMethodBodyBuilderStage5NoArgWithConstants<string, int> result = stage4.WithCompileTimeConstants(() => 99);
213+
214+
Assert.That(result, Is.TypeOf<DataMethodBodyBuilderStage5NoArgWithConstants<string, int>>());
215+
DataMethodBodyBuilderStage5NoArgWithConstants<string, int> stage5 = (DataMethodBodyBuilderStage5NoArgWithConstants<string, int>)result;
216+
Assert.That(stage5.Data.CompileTimeConstants, Is.EqualTo(99));
217+
}
218+
219+
[Test]
220+
public void WithCompileTimeConstants_ReturnVoid_ReturnsStage5ReturnVoidWithConstants()
221+
{
222+
DataMethodBodyBuilderStage4ReturnVoid<int> stage4 = new DataMethodBodyBuilderStage4ReturnVoid<int>(
223+
new BodyGenerationData(ReturnType: typeof(void), ParametersTypes: [typeof(int)]));
224+
225+
IMethodBodyBuilderStage5ReturnVoidWithConstants<int, string> result = stage4.WithCompileTimeConstants(() => "test");
226+
227+
Assert.That(result, Is.TypeOf<DataMethodBodyBuilderStage5ReturnVoidWithConstants<int, string>>());
228+
DataMethodBodyBuilderStage5ReturnVoidWithConstants<int, string> stage5 = (DataMethodBodyBuilderStage5ReturnVoidWithConstants<int, string>)result;
229+
Assert.That(stage5.Data.CompileTimeConstants, Is.EqualTo("test"));
230+
}
231+
232+
[Test]
233+
public void WithCompileTimeConstants_ReturnVoidNoArg_ReturnsStage5ReturnVoidNoArgWithConstants()
234+
{
235+
DataMethodBodyBuilderStage4ReturnVoidNoArg stage4 = new DataMethodBodyBuilderStage4ReturnVoidNoArg(
236+
new BodyGenerationData(ReturnType: typeof(void), ParametersTypes: []));
237+
238+
IMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<int> result = stage4.WithCompileTimeConstants(() => 7);
239+
240+
Assert.That(result, Is.TypeOf<DataMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<int>>());
241+
DataMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<int> stage5 = (DataMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<int>)result;
242+
Assert.That(stage5.Data.CompileTimeConstants, Is.EqualTo(7));
243+
}
244+
245+
[Test]
246+
public void Stage5WithConstants_UseProvidedBody_SetsRuntimeDelegateBody()
247+
{
248+
DataMethodBodyBuilderStage5WithConstants<int, string, int> stage5 = new DataMethodBodyBuilderStage5WithConstants<int, string, int>(
249+
new BodyGenerationData(ReturnType: typeof(string), ParametersTypes: [typeof(int)], CompileTimeConstants: 42));
250+
251+
IMethodBodyGenerator result = stage5.UseProvidedBody((constants, param) => $"{constants}_{param}");
252+
253+
Assert.That(result, Is.TypeOf<DataMethodBodyGenerator>());
254+
DataMethodBodyGenerator generator = (DataMethodBodyGenerator)result;
255+
Assert.That(generator.Data.RuntimeDelegateBody, Is.Not.Null);
256+
Assert.That(generator.Data.CompileTimeConstants, Is.EqualTo(42));
257+
}
258+
259+
[Test]
260+
public void Stage5WithConstants_BodyReturningConstant_SetsReturnConstantValueFactory()
261+
{
262+
DataMethodBodyBuilderStage5WithConstants<int, string, int> stage5 = new DataMethodBodyBuilderStage5WithConstants<int, string, int>(
263+
new BodyGenerationData(ReturnType: typeof(string), ParametersTypes: [typeof(int)], CompileTimeConstants: 42));
264+
265+
IMethodBodyGenerator result = stage5.BodyReturningConstant(constants => $"value_{constants}");
266+
267+
Assert.That(result, Is.TypeOf<DataMethodBodyGenerator>());
268+
DataMethodBodyGenerator generator = (DataMethodBodyGenerator)result;
269+
Assert.That(generator.Data.ReturnConstantValueFactory, Is.Not.Null);
270+
Assert.That(generator.Data.CompileTimeConstants, Is.EqualTo(42));
271+
}
272+
273+
[Test]
274+
public void Stage5NoArgWithConstants_UseProvidedBody_SetsRuntimeDelegateBody()
275+
{
276+
DataMethodBodyBuilderStage5NoArgWithConstants<string, int> stage5 = new DataMethodBodyBuilderStage5NoArgWithConstants<string, int>(
277+
new BodyGenerationData(ReturnType: typeof(string), ParametersTypes: [], CompileTimeConstants: 10));
278+
279+
IMethodBodyGenerator result = stage5.UseProvidedBody(constants => $"value_{constants}");
280+
281+
Assert.That(result, Is.TypeOf<DataMethodBodyGenerator>());
282+
DataMethodBodyGenerator generator = (DataMethodBodyGenerator)result;
283+
Assert.That(generator.Data.RuntimeDelegateBody, Is.Not.Null);
284+
Assert.That(generator.Data.CompileTimeConstants, Is.EqualTo(10));
285+
}
286+
287+
[Test]
288+
public void Stage5NoArgWithConstants_BodyReturningConstant_SetsReturnConstantValueFactory()
289+
{
290+
DataMethodBodyBuilderStage5NoArgWithConstants<string, int> stage5 = new DataMethodBodyBuilderStage5NoArgWithConstants<string, int>(
291+
new BodyGenerationData(ReturnType: typeof(string), ParametersTypes: [], CompileTimeConstants: 10));
292+
293+
IMethodBodyGenerator result = stage5.BodyReturningConstant(constants => $"const_{constants}");
294+
295+
Assert.That(result, Is.TypeOf<DataMethodBodyGenerator>());
296+
DataMethodBodyGenerator generator = (DataMethodBodyGenerator)result;
297+
Assert.That(generator.Data.ReturnConstantValueFactory, Is.Not.Null);
298+
Assert.That(generator.Data.CompileTimeConstants, Is.EqualTo(10));
299+
}
300+
301+
[Test]
302+
public void Stage5ReturnVoidWithConstants_UseProvidedBody_SetsRuntimeDelegateBody()
303+
{
304+
DataMethodBodyBuilderStage5ReturnVoidWithConstants<int, string> stage5 = new DataMethodBodyBuilderStage5ReturnVoidWithConstants<int, string>(
305+
new BodyGenerationData(ReturnType: typeof(void), ParametersTypes: [typeof(int)], CompileTimeConstants: "ctx"));
306+
307+
IMethodBodyGenerator result = stage5.UseProvidedBody((constants, param) => { });
308+
309+
Assert.That(result, Is.TypeOf<DataMethodBodyGenerator>());
310+
DataMethodBodyGenerator generator = (DataMethodBodyGenerator)result;
311+
Assert.That(generator.Data.RuntimeDelegateBody, Is.Not.Null);
312+
Assert.That(generator.Data.CompileTimeConstants, Is.EqualTo("ctx"));
313+
}
314+
315+
[Test]
316+
public void Stage5ReturnVoidNoArgWithConstants_UseProvidedBody_SetsRuntimeDelegateBody()
317+
{
318+
DataMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<string> stage5 = new DataMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<string>(
319+
new BodyGenerationData(ReturnType: typeof(void), ParametersTypes: [], CompileTimeConstants: "ctx"));
320+
321+
IMethodBodyGenerator result = stage5.UseProvidedBody(constants => { });
322+
323+
Assert.That(result, Is.TypeOf<DataMethodBodyGenerator>());
324+
DataMethodBodyGenerator generator = (DataMethodBodyGenerator)result;
325+
Assert.That(generator.Data.RuntimeDelegateBody, Is.Not.Null);
326+
Assert.That(generator.Data.CompileTimeConstants, Is.EqualTo("ctx"));
327+
}
328+
329+
[Test]
330+
public void FullFluentChain_WithConstants_NoArg_BodyReturningConstant_ProducesCorrectData()
331+
{
332+
DataGeneratorsFactory factory = new DataGeneratorsFactory();
333+
334+
IMethodBodyGenerator result = factory.StartFluentApiBuilderForBody()
335+
.ForMethod()
336+
.WithReturnType<string>()
337+
.WithNoParameters()
338+
.WithCompileTimeConstants(() => 42)
339+
.BodyReturningConstant(constants => $"value_{constants}");
340+
341+
Assert.That(result, Is.TypeOf<DataMethodBodyGenerator>());
342+
DataMethodBodyGenerator generator = (DataMethodBodyGenerator)result;
343+
Assert.That(generator.Data.ReturnType, Is.EqualTo(typeof(string)));
344+
Assert.That(generator.Data.ParametersTypes, Is.Empty);
345+
Assert.That(generator.Data.CompileTimeConstants, Is.EqualTo(42));
346+
Assert.That(generator.Data.ReturnConstantValueFactory, Is.Not.Null);
347+
object? constantValue = generator.Data.ReturnConstantValueFactory!.DynamicInvoke(42);
348+
Assert.That(constantValue, Is.EqualTo("value_42"));
349+
}
350+
351+
[Test]
352+
public void FullFluentChain_WithConstants_WithParam_UseProvidedBody_ProducesCorrectData()
353+
{
354+
DataGeneratorsFactory factory = new DataGeneratorsFactory();
355+
356+
IMethodBodyGenerator result = factory.StartFluentApiBuilderForBody()
357+
.ForMethod()
358+
.WithReturnType<int>()
359+
.WithParameter<int>()
360+
.WithCompileTimeConstants(() => new { Offset = 100 })
361+
.UseProvidedBody((constants, param) => constants.Offset + param);
362+
363+
Assert.That(result, Is.TypeOf<DataMethodBodyGenerator>());
364+
DataMethodBodyGenerator generator = (DataMethodBodyGenerator)result;
365+
Assert.That(generator.Data.ReturnType, Is.EqualTo(typeof(int)));
366+
Assert.That(generator.Data.ParametersTypes, Is.EqualTo(new[] { typeof(int) }));
367+
Assert.That(generator.Data.CompileTimeConstants, Is.Not.Null);
368+
Assert.That(generator.Data.RuntimeDelegateBody, Is.Not.Null);
369+
}
370+
371+
[Test]
372+
public void WithCompileTimeConstants_FactoryIsInvokedImmediately()
373+
{
374+
int invocationCount = 0;
375+
DataMethodBodyBuilderStage4NoArg<string> stage4 = new DataMethodBodyBuilderStage4NoArg<string>(
376+
new BodyGenerationData(ReturnType: typeof(string), ParametersTypes: []));
377+
378+
stage4.WithCompileTimeConstants(() =>
379+
{
380+
invocationCount++;
381+
return 42;
382+
});
383+
384+
Assert.That(invocationCount, Is.EqualTo(1));
385+
}
192386
}

EasySourceGenerators.Generators/DataBuilding/DataMethodBodyBuilders.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public IMethodBodyBuilderStage4<TParam1, T> WithParameter<TParam1>() =>
3838

3939
public record DataMethodBodyBuilderStage4<TParam1, TReturnType>(BodyGenerationData Data) : IMethodBodyBuilderStage4<TParam1, TReturnType>
4040
{
41+
public IMethodBodyBuilderStage5WithConstants<TParam1, TReturnType, TConstants> WithCompileTimeConstants<TConstants>(Func<TConstants> compileTimeConstantsFactory) =>
42+
new DataMethodBodyBuilderStage5WithConstants<TParam1, TReturnType, TConstants>(Data with { CompileTimeConstants = compileTimeConstantsFactory() });
43+
4144
public IMethodBodyGenerator UseProvidedBody(Func<TParam1, TReturnType> body) => new DataMethodBodyGenerator(Data with { RuntimeDelegateBody = body });
4245

4346
public IMethodBodyGenerator BodyReturningConstant(Func<TReturnType> constantValueFactory) =>
@@ -46,6 +49,9 @@ public IMethodBodyGenerator BodyReturningConstant(Func<TReturnType> constantValu
4649

4750
public record DataMethodBodyBuilderStage4NoArg<TReturnType>(BodyGenerationData Data) : IMethodBodyBuilderStage4NoArg<TReturnType>
4851
{
52+
public IMethodBodyBuilderStage5NoArgWithConstants<TReturnType, TConstants> WithCompileTimeConstants<TConstants>(Func<TConstants> compileTimeConstantsFactory) =>
53+
new DataMethodBodyBuilderStage5NoArgWithConstants<TReturnType, TConstants>(Data with { CompileTimeConstants = compileTimeConstantsFactory() });
54+
4955
public IMethodBodyGenerator UseProvidedBody(Func<TReturnType> body) => new DataMethodBodyGenerator(Data with { RuntimeDelegateBody = body });
5056

5157
public IMethodBodyGenerator BodyReturningConstant(Func<TReturnType> constantValueFactory) =>
@@ -54,10 +60,42 @@ public IMethodBodyGenerator BodyReturningConstant(Func<TReturnType> constantValu
5460

5561
public record DataMethodBodyBuilderStage4ReturnVoid<TParam1>(BodyGenerationData BodyGenerationData) : IMethodBodyBuilderStage4ReturnVoid<TParam1>
5662
{
63+
public IMethodBodyBuilderStage5ReturnVoidWithConstants<TParam1, TConstants> WithCompileTimeConstants<TConstants>(Func<TConstants> compileTimeConstantsFactory) =>
64+
new DataMethodBodyBuilderStage5ReturnVoidWithConstants<TParam1, TConstants>(BodyGenerationData with { CompileTimeConstants = compileTimeConstantsFactory() });
65+
5766
public IMethodBodyGenerator UseProvidedBody(Action<TParam1> body) => new DataMethodBodyGenerator(BodyGenerationData with { RuntimeDelegateBody = body });
5867
}
5968

6069
public record DataMethodBodyBuilderStage4ReturnVoidNoArg(BodyGenerationData BodyGenerationData) : IMethodBodyBuilderStage4ReturnVoidNoArg
6170
{
71+
public IMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<TConstants> WithCompileTimeConstants<TConstants>(Func<TConstants> compileTimeConstantsFactory) =>
72+
new DataMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<TConstants>(BodyGenerationData with { CompileTimeConstants = compileTimeConstantsFactory() });
73+
6274
public IMethodBodyGenerator UseProvidedBody(Action body) => new DataMethodBodyGenerator(BodyGenerationData with { RuntimeDelegateBody = body });
75+
}
76+
77+
public record DataMethodBodyBuilderStage5WithConstants<TParam1, TReturnType, TConstants>(BodyGenerationData Data) : IMethodBodyBuilderStage5WithConstants<TParam1, TReturnType, TConstants>
78+
{
79+
public IMethodBodyGenerator UseProvidedBody(Func<TConstants, TParam1, TReturnType> body) => new DataMethodBodyGenerator(Data with { RuntimeDelegateBody = body });
80+
81+
public IMethodBodyGenerator BodyReturningConstant(Func<TConstants, TReturnType> constantValueFactory) =>
82+
new DataMethodBodyGenerator(Data with { ReturnConstantValueFactory = constantValueFactory });
83+
}
84+
85+
public record DataMethodBodyBuilderStage5NoArgWithConstants<TReturnType, TConstants>(BodyGenerationData Data) : IMethodBodyBuilderStage5NoArgWithConstants<TReturnType, TConstants>
86+
{
87+
public IMethodBodyGenerator UseProvidedBody(Func<TConstants, TReturnType> body) => new DataMethodBodyGenerator(Data with { RuntimeDelegateBody = body });
88+
89+
public IMethodBodyGenerator BodyReturningConstant(Func<TConstants, TReturnType> constantValueFactory) =>
90+
new DataMethodBodyGenerator(Data with { ReturnConstantValueFactory = constantValueFactory });
91+
}
92+
93+
public record DataMethodBodyBuilderStage5ReturnVoidWithConstants<TParam1, TConstants>(BodyGenerationData Data) : IMethodBodyBuilderStage5ReturnVoidWithConstants<TParam1, TConstants>
94+
{
95+
public IMethodBodyGenerator UseProvidedBody(Action<TConstants, TParam1> body) => new DataMethodBodyGenerator(Data with { RuntimeDelegateBody = body });
96+
}
97+
98+
public record DataMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<TConstants>(BodyGenerationData Data) : IMethodBodyBuilderStage5ReturnVoidNoArgWithConstants<TConstants>
99+
{
100+
public IMethodBodyGenerator UseProvidedBody(Action<TConstants> body) => new DataMethodBodyGenerator(Data with { RuntimeDelegateBody = body });
63101
}

0 commit comments

Comments
 (0)