Beispiel #1
0
        protected virtual void _Generate(AstNodeExprCallStatic call)
        {
            if (call.MethodInfo.CallingConvention.HasFlag(CallingConventions.HasThis))
            {
                throw new Exception("CallString calling convention shouldn't have this '" + call.MethodInfo + "'");
            }
            switch (call.MethodInfo.CallingConvention & CallingConventions.Any)
            {
            case CallingConventions.Standard:
                foreach (var parameter in call.Parameters)
                {
                    Generate(parameter);
                }
                if (call.IsTail)
                {
                    Emit(OpCodes.Tailcall);
                    Emit(OpCodes.Call, call.MethodInfo);
                    Emit(OpCodes.Ret);
                    //Emit(OpCodes.Jmp, call.MethodInfo);
                }
                else
                {
                    Emit(OpCodes.Call, call.MethodInfo);
                }
                break;

            default:
                throw new Exception($"Can't handle calling convention {call.MethodInfo.CallingConvention}");
            }
        }
Beispiel #2
0
        protected virtual void _Generate(AstNodeExprCallStatic Call)
        {
            if (Call.MethodInfo.CallingConvention.HasFlag(CallingConventions.HasThis))
            {
                throw (new Exception("CallString calling convention shouldn't have this '" + Call.MethodInfo + "'"));
            }
            switch (Call.MethodInfo.CallingConvention & CallingConventions.Any)
            {
            case CallingConventions.Standard:
                foreach (var Parameter in Call.Parameters)
                {
                    Generate(Parameter);
                }
                if (Call.IsTail)
                {
                    Emit(OpCodes.Tailcall);
                }
                Emit(OpCodes.Call, Call.MethodInfo);
                break;

            default:
                throw (new Exception(String.Format("Can't handle calling convention {0}", Call.MethodInfo.CallingConvention)));
            }
        }
Beispiel #3
0
 protected virtual void _Generate(AstNodeExprCallStatic call)
 {
     Output.Write(call.MethodInfo.DeclaringType?.Name + "." + call.MethodInfo.Name);
     GenerateCallParameters(call.Parameters);
 }