Upsilon/Upsilon/Binder/BoundExpressions/BoundFunctionCallExpression.cs

48 lines
1.4 KiB
C#

using System.Collections.Generic;
using System.Collections.Immutable;
using Upsilon.BaseTypes;
using Upsilon.Text;
namespace Upsilon.Binder
{
public class BoundFunctionCallExpression : BoundExpression
{
public BoundExpression Identifier { get; }
public ImmutableArray<BoundExpression> Parameters { get; }
public BoundFunctionCallExpression(BoundExpression identifier, ImmutableArray<BoundExpression> parameters,
TextSpan span, Type type) : base(span)
{
Identifier = identifier;
Parameters = parameters;
Type = type;
}
public override BoundKind Kind => BoundKind.BoundFunctionCallExpression;
public override IEnumerable<BoundNode> GetNodeAtPosition(int line, int character)
{
if (Identifier.Span.Contains(line, character))
{
foreach (var exp in Identifier.GetNodeAtPosition(line, character))
{
yield return exp;
}
}
foreach (var parameter in Parameters)
{
if (parameter.Span.Contains(line, character))
{
foreach (var exp in parameter.GetNodeAtPosition(line, character))
{
yield return exp;
}
}
}
yield return this;
}
public override Type Type { get; }
}
}