Esempio n. 1
0
        private static CallContext createCallContext(ComputationContext ctx, NameReference name, FunctionDefinition callTarget)
        {
            IExpression this_context = name.GetContext(callTarget);

            if (this_context == null)
            {
                return(new CallContext());
            }

            this_context.Evaluated(ctx, EvaluationCall.AdHocCrossJump);

            bool is_static_call;

            if (callTarget.IsExtension)
            {
                is_static_call = this_context is NameReference name_ref &&
                                 name_ref.Binding.Match.Instance.Target is Extension;
            }
            else
            {
                is_static_call = callTarget.Modifier.HasStatic;
            }

            if (is_static_call)
            {
                return new CallContext()
                       {
                           StaticContext = this_context.Evaluation.Components
                       }
            }
            ;
            else
            {
                return new CallContext()
                       {
                           MetaThisArgument = FunctionArgument.Create(this_context)
                       }
            };
        }