예제 #1
0
파일: TypeDef.cs 프로젝트: zixing131/mono
        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;
            }
        }
예제 #2
0
                public GenericTypeInst (BaseClassRef class_ref, GenericArguments gen_args, bool is_valuetypeinst,
                                string sig_mod, ArrayList conv_list)
                        : base ("", is_valuetypeinst, conv_list, sig_mod)
                {
                        if (class_ref is GenericTypeInst)
                                throw new InternalErrorException ("Cannot create nested GenericInst, '" +
                                                        class_ref.FullName + "' '" + gen_args.ToString () + "'");

                        this.class_ref = class_ref;
                        this.gen_args = gen_args;
                        is_added = false;
                }
예제 #3
0
파일: CodeGen.cs 프로젝트: zixing131/mono
        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++;
        }
예제 #4
0
        public GenericTypeInst(BaseClassRef class_ref, GenericArguments gen_args, bool is_valuetypeinst,
                               string sig_mod, ArrayList conv_list)
            : base("", is_valuetypeinst, conv_list, sig_mod)
        {
            if (class_ref is GenericTypeInst)
            {
                throw new InternalErrorException("Cannot create nested GenericInst, '" +
                                                 class_ref.FullName + "' '" + gen_args.ToString() + "'");
            }

            this.class_ref = class_ref;
            this.gen_args  = gen_args;
            is_added       = false;
        }
예제 #5
0
        public void MakeCustomModified(CodeGen code_gen, PEAPI.CustomModifier modifier,
                                       BaseClassRef klass)
        {
            use_type_spec = true;
            conversion_list.Add(ConversionMethod.MakeCustomModified);
            conversion_list.Add(modifier);
            conversion_list.Add(klass);

            if (modifier == PEAPI.CustomModifier.modreq)
            {
                SigMod += ("modreq (" + klass.FullName + ")");
            }
            else if (modifier == PEAPI.CustomModifier.modopt)
            {
                SigMod += ("modopt (" + klass.FullName + ")");
            }
        }
예제 #6
0
파일: TypeDef.cs 프로젝트: Profit0004/mono
                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;
                }
예제 #7
0
        public void MakeCustomModified(CodeGen code_gen, PEAPI.CustomModifier modifier,
                                       BaseClassRef klass)
        {
            PEAPI.Type type;

            use_type_spec = true;

            Pair p = new Pair(peapi_type, modifier.ToString());

            type = type_table [p] as PEAPI.Type;
            if (type == null)
            {
                klass.Resolve(code_gen);
                type = new PEAPI.CustomModifiedType(peapi_type,
                                                    modifier, klass.PeapiClass);
                type_table [p] = type;
            }
            peapi_type = type;
        }
예제 #8
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++;
                }
예제 #9
0
		public void MakeCustomModified (CodeGen code_gen,
				PEAPI.CustomModifier modifier, BaseClassRef klass)
		{
			type_ref.MakeCustomModified (code_gen, modifier, klass);
		}
예제 #10
0
 public GenericTypeInst(BaseClassRef class_ref, GenericArguments gen_args, bool is_valuetypeinst)
     : this(class_ref, gen_args, is_valuetypeinst, null, null)
 {
 }
예제 #11
0
 public void MakeCustomModified(CodeGen code_gen,
                                PEAPI.CustomModifier modifier, BaseClassRef klass)
 {
     type_ref.MakeCustomModified(code_gen, modifier, klass);
 }
예제 #12
0
 public GenericTypeInst (BaseClassRef class_ref, GenericArguments gen_args, bool is_valuetypeinst)
         : this (class_ref, gen_args, is_valuetypeinst, null, null)
 {
 }
예제 #13
0
                public void MakeCustomModified (CodeGen code_gen, PEAPI.CustomModifier modifier,
                                BaseClassRef klass)
                {
                        use_type_spec = true;
                        conversion_list.Add (ConversionMethod.MakeCustomModified);
                        conversion_list.Add (modifier);
                        conversion_list.Add (klass);

                        if (modifier == PEAPI.CustomModifier.modreq)
                                SigMod += ("modreq (" + klass.FullName + ")");
                        else if (modifier == PEAPI.CustomModifier.modopt)
                                SigMod += ("modopt (" + klass.FullName + ")");
                }
예제 #14
0
파일: PeapiTypeRef.cs 프로젝트: nobled/mono
                public void MakeCustomModified (CodeGen code_gen, PEAPI.CustomModifier modifier,
                                BaseClassRef klass)
                {
			PEAPI.Type type;

                        use_type_spec = true;
                        
                        Pair p = new Pair (peapi_type, modifier.ToString ());
                        type = type_table [p] as PEAPI.Type;
                        if (type == null) {
                                klass.Resolve (code_gen);
                                type = new PEAPI.CustomModifiedType (peapi_type,
                                        modifier, klass.PeapiClass);
                                type_table [p] = type;
                        }
                        peapi_type = type;
                }