Exemplo n.º 1
0
                public TypeDef (PEAPI.TypeAttr attr, string name_space, string name,
                                BaseClassRef parent, ArrayList impl_list, Location location, GenericParameters gen_params, TypeDef outer)
                {
                        this.attr = attr;
                        this.parent = parent;
                        this.impl_list = impl_list;
                        this.gen_params = gen_params;
                        this.outer = outer;
                        this.location = location;

                        field_table = new Hashtable ();
                        field_list = new ArrayList ();

                        method_table = new Hashtable ();
                        method_list = new ArrayList ();

                        size = -1;
                        pack = -1;

                        is_defined = false;
                        is_intransit = false;

                        is_value_class = false;
                        is_enum_class = false;

                        ResolveGenParams ();

                        int lastdot = name.LastIndexOf ('.');
                        /* Namespace . name split should not be done for nested classes */
                        if (lastdot >= 0 && outer == null) {
                                if (name_space == null || name_space == "")
                                        this.name_space = name.Substring (0, lastdot);
                                else
                                        this.name_space = name_space + "." + name.Substring (0, lastdot);
                                this.name = name.Substring (lastdot + 1);
                        } else {
                                this.name_space = name_space;
                                this.name = name;
                        }

                        //Fixup attributes
                        if (IsInterface)
                                this.attr |= PEAPI.TypeAttr.Abstract;
                }
Exemplo n.º 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);
                }
Exemplo n.º 3
0
 public void AddToDefineContentsList (TypeDef typedef)
 {
         defcont_list.Add (typedef);
 }
Exemplo n.º 4
0
                public void EndTypeDef ()
                {
			typedef_stack_top--;
			typedef_stack.RemoveAt (typedef_stack_top);

                        if (typedef_stack_top > 0)
                                current_typedef = (TypeDef) typedef_stack [typedef_stack_top-1];
                        else
                                current_typedef = null;

                }
Exemplo n.º 5
0
                public void BeginTypeDef (TypeAttr attr, string name, BaseClassRef parent,
                                ArrayList impl_list, Location location, GenericParameters gen_params)
                {
                        TypeDef outer = null;
                        string cache_name = CacheName (name);
                        if (typedef_stack_top > 0) {
				StringBuilder sb = new StringBuilder ();

				for (int i = 0; i < typedef_stack_top; i++){
					outer = (TypeDef) typedef_stack [i];
					if (i == 0)
						/* Use FullName for outermost class to get the
						   namespace also */
						sb.Append (outer.FullName);
					else
						sb.Append (outer.Name);
					sb.Append ("/");
				}
				sb.Append (name);
				cache_name = sb.ToString ();
                        }

                        TypeDef typedef = type_manager[cache_name];

                        if (typedef != null) {
                                // Class head is allready defined, we are just reopening the class
                                current_customattrtarget = current_typedef = typedef;
                                current_declsectarget = typedef;
                                typedef_stack.Add (current_typedef);
				typedef_stack_top++;
                                return;
                        }

                        typedef = new TypeDef (attr, current_namespace,
                                        name, parent, impl_list, location, gen_params, outer);

                        type_manager[cache_name] = typedef;
                        current_customattrtarget = current_typedef = typedef;
                        current_declsectarget = typedef;
			typedef_stack.Add (typedef);
			typedef_stack_top++;
                }