Update source gen
This commit is contained in:
parent
01ad85e243
commit
4bd0b990b9
28
QuestPathGenerator/RoslynElements/PurchaseMenuExtensions.cs
Normal file
28
QuestPathGenerator/RoslynElements/PurchaseMenuExtensions.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.CodeAnalysis.CSharp;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
|
using Questionable.Model.Questing;
|
||||||
|
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||||
|
using static Questionable.QuestPathGenerator.RoslynShortcuts;
|
||||||
|
|
||||||
|
namespace Questionable.QuestPathGenerator.RoslynElements;
|
||||||
|
|
||||||
|
internal static class PurchaseMenuExtensions
|
||||||
|
{
|
||||||
|
public static ExpressionSyntax ToExpressionSyntax(this PurchaseMenu purchaseMenu)
|
||||||
|
{
|
||||||
|
PurchaseMenu emptyMenu = new();
|
||||||
|
return ObjectCreationExpression(
|
||||||
|
IdentifierName(nameof(PurchaseMenu)))
|
||||||
|
.WithInitializer(
|
||||||
|
InitializerExpression(
|
||||||
|
SyntaxKind.ObjectInitializerExpression,
|
||||||
|
SeparatedList<ExpressionSyntax>(
|
||||||
|
SyntaxNodeList(
|
||||||
|
Assignment(nameof(PurchaseMenu.ExcelSheet), purchaseMenu.ExcelSheet,
|
||||||
|
emptyMenu.ExcelSheet)
|
||||||
|
.AsSyntaxNodeOrToken(),
|
||||||
|
Assignment(nameof(PurchaseMenu.Key), purchaseMenu.Key,
|
||||||
|
emptyMenu.Key)
|
||||||
|
.AsSyntaxNodeOrToken()))));
|
||||||
|
}
|
||||||
|
}
|
@ -57,6 +57,7 @@ public static class RoslynShortcuts
|
|||||||
DialogueChoice dialogueChoice => dialogueChoice.ToExpressionSyntax(),
|
DialogueChoice dialogueChoice => dialogueChoice.ToExpressionSyntax(),
|
||||||
JumpDestination jumpDestination => jumpDestination.ToExpressionSyntax(),
|
JumpDestination jumpDestination => jumpDestination.ToExpressionSyntax(),
|
||||||
ExcelRef excelRef => excelRef.ToExpressionSyntax(),
|
ExcelRef excelRef => excelRef.ToExpressionSyntax(),
|
||||||
|
PurchaseMenu purchaseMenu => purchaseMenu.ToExpressionSyntax(),
|
||||||
ComplexCombatData complexCombatData => complexCombatData.ToExpressionSyntax(),
|
ComplexCombatData complexCombatData => complexCombatData.ToExpressionSyntax(),
|
||||||
QuestWorkValue questWorkValue => questWorkValue.ToExpressionSyntax(),
|
QuestWorkValue questWorkValue => questWorkValue.ToExpressionSyntax(),
|
||||||
List<QuestWorkValue> list => list.ToExpressionSyntax(), // TODO fix in AssignmentList
|
List<QuestWorkValue> list => list.ToExpressionSyntax(), // TODO fix in AssignmentList
|
||||||
|
Loading…
Reference in New Issue
Block a user