Example #1
0
        public MethodDef(CodeGen codegen, PEAPI.MethAttr meth_attr,
                         PEAPI.CallConv call_conv, PEAPI.ImplAttr impl_attr,
                         string name, BaseTypeRef ret_type, ArrayList param_list,
                         Location start, GenericParameters gen_params, TypeDef type_def)
        {
            this.codegen    = codegen;
            this.meth_attr  = meth_attr;
            this.call_conv  = call_conv;
            this.impl_attr  = impl_attr;
            this.name       = name;
            this.param_list = param_list;
            this.type_def   = type_def;
            this.gen_params = gen_params;
            this.ret_param  = new ParamDef(PEAPI.ParamAttr.Default, "", ret_type);
            this.start      = (Location)start.Clone();

            inst_list          = new ArrayList();
            label_table        = new Hashtable();
            labelref_table     = new Hashtable();
            label_list         = new ArrayList();
            local_list         = new ArrayList();
            named_local_tables = new ArrayList();
            named_local_tables.Add(new Hashtable());
            current_scope_depth = 0;

            entry_point  = false;
            zero_init    = false;
            init_locals  = false;
            max_stack    = -1;
            pinvoke_info = false;

            is_defined  = false;
            is_resolved = false;
            ResolveGenParams();
            CreateSignature();

            codegen.BeginMethodDef(this);

            if (codegen.SymbolWriter != null)
            {
                source = codegen.SymbolWriter.BeginMethod(this, start);
            }
        }
Example #2
0
                public MethodDef (CodeGen codegen, PEAPI.MethAttr meth_attr,
				  PEAPI.CallConv call_conv, PEAPI.ImplAttr impl_attr,
				  string name, BaseTypeRef ret_type, ArrayList param_list,
				  Location start, GenericParameters gen_params, TypeDef type_def)
                {
                        this.codegen = codegen;
                        this.meth_attr = meth_attr;
                        this.call_conv = call_conv;
                        this.impl_attr = impl_attr;
                        this.name = name;
                        this.param_list = param_list;
                        this.type_def = type_def;
                        this.gen_params = gen_params;
                        this.ret_param = new ParamDef (PEAPI.ParamAttr.Default, "", ret_type);
                        this.start = (Location) start.Clone ();

                        inst_list = new ArrayList ();
                        label_table = new Hashtable ();
                        labelref_table = new Hashtable ();
                        label_list = new ArrayList ();
                        local_list = new ArrayList ();
                        named_local_tables = new ArrayList ();
                        named_local_tables.Add (new Hashtable ());
                        current_scope_depth = 0;

                        entry_point = false;
                        zero_init = false;
                        init_locals = false;
                        max_stack = -1;
                        pinvoke_info = false;

                        is_defined = false;
                        is_resolved = false;
                        ResolveGenParams ();
                        CreateSignature ();

			codegen.BeginMethodDef (this);

			if (codegen.SymbolWriter != null)
				source = codegen.SymbolWriter.BeginMethod (this, start);
                }
Example #3
0
        static string CreateVarargSignature(BaseTypeRef RetType, string name, IList param_list)
        {
            StringBuilder builder = new StringBuilder();
            ParamDef      last    = null;

            builder.Append(RetType.FullName);
            builder.Append(" ");
            builder.Append(name);
            builder.Append('(');

            bool first = true;

            if (param_list != null)
            {
                foreach (ParamDef paramdef in param_list)
                {
                    if (!first)
                    {
                        builder.Append(',');
                    }
                    builder.Append(paramdef.TypeName);
                    first = false;
                }
                last = (ParamDef)param_list[param_list.Count - 1];
            }


            if (last == null || !last.IsSentinel())
            {
                if (!first)
                {
                    builder.Append(',');
                }
                builder.Append("...");
            }

            builder.Append(')');

            return(builder.ToString());
        }