port from perforce
This commit is contained in:
31
intromat/Intromat/Nodes/Code/FunctionCall.cs
Normal file
31
intromat/Intromat/Nodes/Code/FunctionCall.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user