public CallMethodAction(ParseInfo parseInfo, Scope scope, FunctionExpression methodContext, bool usedAsExpression, Scope getter)
        {
            _parseInfo        = parseInfo;
            _usedAsExpression = usedAsExpression;

            // Get the invoke target.
            var resolveInvoke = new ResolveInvokeInfo();
            var target        = parseInfo.SetInvokeInfo(resolveInvoke).GetExpression(scope, methodContext.Target, getter: getter);

            // Get the invoke info.
            IInvokeInfo invokeInfo = resolveInvoke.WasResolved ? resolveInvoke.InvokeInfo : target.Type()?.InvokeInfo;

            if (invokeInfo != null)
            {
                Result = invokeInfo.Invoke(new InvokeData(parseInfo, methodContext, target, scope, getter, usedAsExpression));
            }
            // If the target is not invocable and the target is not a missing element, add error.
            else
            {
                DiscardParameters(parseInfo, getter, methodContext.Parameters);
                if (target is MissingElementAction == false)
                {
                    parseInfo.Script.Diagnostics.Error("Method name expected", methodContext.Target.Range);
                }
            }
        }
        public static void ThrowOnError(this IInvokeResult result)
        {
            if (result == null || result.Success)
            {
                return;
            }

            throw new InvokeException($"Invoke failed: {result.ResultDescription}");
        }
        void IInvocableMethodOwnerMirror.ProcessResult(IInvokeResult result)
        {
            var outThis = result.OutThis as StructMirror;

            if (outThis != null)
            {
                SetFields(outThis.Fields);
            }
        }
Exemple #4
0
 void IInvocableMethodOwnerMirror.ProcessResult(IInvokeResult result)
 {
 }