-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathInvocationExpression.cs
More file actions
26 lines (21 loc) · 757 Bytes
/
InvocationExpression.cs
File metadata and controls
26 lines (21 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System.Collections.Generic;
using System.Linq;
namespace StringMath.Expressions
{
internal class InvocationExpression : IExpression
{
public InvocationExpression(string name, IReadOnlyCollection<IExpression> arguments)
{
Name = name;
Arguments = arguments;
}
public ExpressionType Type => ExpressionType.Invocation;
public string Name { get; }
public IReadOnlyCollection<IExpression> Arguments { get; }
/// <inheritdoc />
public override string ToString()
=> ToString(MathContext.Default);
public string ToString(IMathContext context)
=> $"{Name}({string.Join(", ", Arguments.Select(x => x.ToString()))})";
}
}