Exemple #1
0
 public SyntaxNode GetSyntaxNode()
 {
     return(SyntaxFactory.Block(
                ExpressionsByPair.Select(e =>
                                         SyntaxFactory.ExpressionStatement(
                                             SyntaxFactory.AssignmentExpression(SyntaxKind.SimpleAssignmentExpression,
                                                                                SyntaxFactory.IdentifierName(e.Key.ToString()).WithTriviaFrom(e.Value.Trivia),
                                                                                e.Value.Expression)
                                             ))
                ));
 }
Exemple #2
0
 public override void VisitAssignmentExpression(AssignmentExpressionSyntax node)
 {
     if (node.Kind() == SyntaxKind.SimpleAssignmentExpression &&
         node.Left is IdentifierNameSyntax id &&
         node.Right is ExpressionSyntax expression)
     {
         if (CurrencyPair.TryParse(id.Identifier.ValueText, out var currencyPair))
         {
             expression = expression.WithTriviaFrom(expression);
             ExpressionsByPair.TryAdd(currencyPair, (expression, id));
         }
     }
     base.VisitAssignmentExpression(node);
 }