Files
bluflame/intromat/Intromat/Nodes/Code/FunctionCall.cs
2026-04-18 22:31:51 +02:00

31 lines
859 B
C#

using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using Intromat.Model.Compiler;
namespace Intromat.Nodes.Code
{
public class FunctionCall : ExecutionValueBase
{
public string? FunctionName { get; set; }
public List<IExpression> Parameters { get; } = new();
public override void Compile(CompilerContext context, StringBuilder sb)
{
Debug.Assert(FunctionName != null, nameof(FunctionName) + " != null");
sb.Append($"{FunctionName}(");
for (int i = 0, n = Parameters.Count; i < n; ++i)
{
var p = Parameters[i];
p.Compile(context, sb);
if (i != n - 1)
sb.Append(", ");
}
sb.Append(")\n");
base.Compile(context, sb);
}
}
}