コード例 #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
ファイル: GenericTypeInst.cs プロジェクト: mono/mono
                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
ファイル: GenericTypeInst.cs プロジェクト: pmq20/mono_forked
        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
ファイル: ModifiableType.cs プロジェクト: pmq20/mono_forked
        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
ファイル: ExternTypeRefInst.cs プロジェクト: nobled/mono
		public void MakeCustomModified (CodeGen code_gen,
				PEAPI.CustomModifier modifier, BaseClassRef klass)
		{
			type_ref.MakeCustomModified (code_gen, modifier, klass);
		}
コード例 #10
0
ファイル: GenericTypeInst.cs プロジェクト: pmq20/mono_forked
 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
ファイル: GenericTypeInst.cs プロジェクト: mono/mono
 public GenericTypeInst (BaseClassRef class_ref, GenericArguments gen_args, bool is_valuetypeinst)
         : this (class_ref, gen_args, is_valuetypeinst, null, null)
 {
 }
コード例 #13
0
ファイル: ModifiableType.cs プロジェクト: nobled/mono
                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;
                }