public override void Resolve(CodeGen code_gen)
        {
            if (is_resolved)
            {
                return;
            }

            PEAPI.Type [] arg_array;
            PEAPI.Type [] opt_array;
            bool          is_vararg = false;

            if (param_list != null)
            {
                ArrayList opt_list = new ArrayList();
                ArrayList arg_list = new ArrayList();
                bool      in_opt   = false;
                int       max      = param_list.Count;

                for (int i = 0; i < max; i++)
                {
                    ParamDef param = (ParamDef)param_list [i];

                    if (param.IsSentinel())
                    {
                        is_vararg = true;
                        in_opt    = true;
                        param.Type.Resolve(code_gen);
                    }
                    else if (in_opt)
                    {
                        param.Type.Resolve(code_gen);
                        opt_list.Add(param.Type.PeapiType);
                    }
                    else
                    {
                        param.Type.Resolve(code_gen);
                        arg_list.Add(param.Type.PeapiType);
                    }
                }

                arg_array = (PEAPI.Type [])arg_list.ToArray(typeof(PEAPI.Type));
                opt_array = (PEAPI.Type [])opt_list.ToArray(typeof(PEAPI.Type));
            }
            else
            {
                arg_array = new PEAPI.Type [0];
                opt_array = new PEAPI.Type [0];
            }

            ret.Resolve(code_gen);

            type = new PEAPI.MethPtrType(callconv, ret.PeapiType, arg_array, is_vararg, opt_array);
            type = Modify(code_gen, type);

            is_resolved = true;
        }
Пример #2
0
                public override void Resolve (CodeGen code_gen)
                {
                        if (is_resolved)
                                return;

                        PEAPI.Type [] arg_array;
                        PEAPI.Type [] opt_array;
                        bool is_vararg = false;

                        if (param_list != null) {
                                ArrayList opt_list = new ArrayList ();
                                ArrayList arg_list = new ArrayList ();
                                bool in_opt = false;
                                int max = param_list.Count;

                                for (int i = 0; i < max; i++) {
                                        ParamDef param = (ParamDef) param_list [i];

                                        if (param.IsSentinel ()) {
                                                is_vararg = true;
                                                in_opt = true;
                                                param.Type.Resolve (code_gen);
                                        } else if (in_opt) {
                                                param.Type.Resolve (code_gen);
                                                opt_list.Add (param.Type.PeapiType);
                                        } else {
                                                param.Type.Resolve (code_gen);
                                                arg_list.Add (param.Type.PeapiType);
                                        }
                                }

                                arg_array = (PEAPI.Type []) arg_list.ToArray (typeof (PEAPI.Type));
                                opt_array = (PEAPI.Type []) opt_list.ToArray (typeof (PEAPI.Type));
                        } else {
                                arg_array = new PEAPI.Type [0];
                                opt_array = new PEAPI.Type [0];
                        }

                        ret.Resolve (code_gen);

                        type = new PEAPI.MethPtrType (callconv, ret.PeapiType, arg_array, is_vararg, opt_array);
                        type = Modify (code_gen, type);

                        is_resolved = true;
                }