Upsilon/Upsilon/Binder/BoundExpressions/BoundFunctionCallExpression.cs

48 lines
1.4 KiB
C#
Raw Normal View History

using System.Collections.Generic;
2018-11-15 19:13:53 +00:00
using System.Collections.Immutable;
using Upsilon.BaseTypes;
using Upsilon.Text;
2018-11-15 19:13:53 +00:00
namespace Upsilon.Binder
{
public class BoundFunctionCallExpression : BoundExpression
{
2018-11-18 19:20:03 +00:00
public BoundExpression Identifier { get; }
2018-11-15 19:13:53 +00:00
public ImmutableArray<BoundExpression> Parameters { get; }
public BoundFunctionCallExpression(BoundExpression identifier, ImmutableArray<BoundExpression> parameters,
TextSpan span, Type type) : base(span)
2018-11-15 19:13:53 +00:00
{
Identifier = identifier;
Parameters = parameters;
Type = type;
2018-11-15 19:13:53 +00:00
}
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; }
2018-11-15 19:13:53 +00:00
}
}