Exemplo n.º 1
0
        public int Execute(Frame frame)
        {
            Lambda lambda;

            if (functionName == null)
            {
                if (!RuntimeUtil.TryConvertToLambda(frame.result, out lambda))
                {
                    throw new NotImplementedException();
                }
            }
            else
            {
                if (!MemberResolver.TryResolveLambda(
                        frame.result,
                        calleeTypeHint,
                        functionName,
                        out lambda))
                {
                    throw new NotImplementedException();
                }
            }

            object[] args = new object[argLocations.Length];
            for (int i = 0; i < argLocations.Length; i++)
            {
                args[i] = frame.stack[argLocations[i]];
            }
            if (lambda is LambdaGroup group)
            {
                frame.result = group.RunWithExpectedTypes(argTypesHint, args);
            }
            else
            {
                frame.result = lambda.Run(args);
            }
            return(1);
        }