public override IAstNode VisitFunctionCallExpression([NotNull] FunctionCallExpressionContext context) { Prototype function = FindCallTarget(context.CaleeName); var args = from expCtx in context.expression( ) select(IExpression) expCtx.Accept(this); return(new FunctionCallExpression(context.GetSourceSpan( ), function, args)); }
public override Value VisitFunctionCallExpression([NotNull] FunctionCallExpressionContext context) { var function = GetFunction(context.CaleeName); if (function == null) { throw new ArgumentException($"Unknown function reference {context.CaleeName}", nameof(context)); } var args = context.Args.Select(ctx => ctx.Accept(this)).ToArray( ); return(InstructionBuilder.Call(function, args).RegisterName("calltmp")); }
public override IAstNode VisitFunctionCallExpression(FunctionCallExpressionContext context) { Prototype?function = FindCallTarget(context.CaleeName); if (function is null) { return(new ErrorNode(context.GetSourceSpan( ), $"Call to unknown function '{context.CaleeName}'")); } var args = from expCtx in context.expression( ) select(IExpression) expCtx.Accept(this); return(new FunctionCallExpression(context.GetSourceSpan( ), function, args)); }
public override Expression VisitFunctionCallExpression([NotNull] FunctionCallExpressionContext context) { if (!IsPredefined(context.index())) { throw new UnsupportedSyntaxException("User-defined functions", context.index().Start); } var functionIndex = GetIndexNumber(context.index()); var expressions = new List <Expression>(); foreach (var child in context.expressionList().children) { if (child is ExpressionContext) { expressions.Add(VisitExpression(child as ExpressionContext)); } } return(PredefinedObjects.GetFunctionExpression(functionIndex, expressions.ToArray())); }