当前位置: 首页>>代码示例>>C#>>正文


C# CodeGen.AddToDefineContentsList方法代码示例

本文整理汇总了C#中Mono.ILASM.CodeGen.AddToDefineContentsList方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGen.AddToDefineContentsList方法的具体用法?C# CodeGen.AddToDefineContentsList怎么用?C# CodeGen.AddToDefineContentsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.ILASM.CodeGen的用法示例。


在下文中一共展示了CodeGen.AddToDefineContentsList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Define

                public void Define (CodeGen code_gen)
                {
                        if (is_defined)
                                return;

                        if (is_intransit) {
                                // Circular definition
                                Report.Error ("Circular definition of class: " + FullName);
                        }

                        if (outer != null) {
				PEAPI.TypeAttr vis = attr & PEAPI.TypeAttr.VisibilityMask;

				if (vis == PEAPI.TypeAttr.Private || vis == PEAPI.TypeAttr.Public) {
					/* Nested class, but attr not set accordingly. */
					Report.Warning (location, String.Format ("Nested class '{0}' has non-nested visibility, set to such.", NestedFullName));
					attr = attr ^ vis;
					attr |= (vis == PEAPI.TypeAttr.Public ? PEAPI.TypeAttr.NestedPublic : PEAPI.TypeAttr.NestedPrivate);
				}		
                        }
                        
                        if (parent != null) {
                                is_intransit = true;
                                parent.Resolve (code_gen);

                                is_intransit = false;
                                if (parent.PeapiClass == null) {
                                        Report.Error ("this type can not be a base type: "
                                                        + parent);
                                }

                                if (IsValueType (parent.PeapiClass.nameSpace, parent.PeapiClass.name))
                                        is_value_class = true;
                                else if (IsEnumType (parent.PeapiClass.nameSpace, parent.PeapiClass.name))
                                        is_enum_class = true;

                                if (!IsValueType (name_space, name) && !IsEnumType (name_space, name) &&
                                        is_value_class && (attr & PEAPI.TypeAttr.Sealed) == 0) {

                                        attr |= PEAPI.TypeAttr.Sealed;
                                }

                                if (outer != null) {
                                        if (!outer.IsDefined)
                                                outer.Define (code_gen);
                                        classdef = outer.PeapiType.AddNestedClass (attr,
                                                        name_space, name, parent.PeapiClass);
                                } else {
                                        if (is_value_class || is_enum_class) {
                                                // Should probably confirm that the parent is System.ValueType
                                                classdef = code_gen.PEFile.AddValueClass (attr,
                                                        name_space, name, is_value_class ? PEAPI.ValueClass.ValueType : PEAPI.ValueClass.Enum);
                                        } else {
                                                classdef = code_gen.PEFile.AddClass (attr,
                                                        name_space, name, parent.PeapiClass);
                                        }
                                }
                        } else {
                                if (outer != null) {
                                        if (!outer.IsDefined)
                                                outer.Define (code_gen);
                                        classdef = outer.PeapiType.AddNestedClass (attr,
                                                name_space, name);
                                } else {
                                        if (is_value_class || is_enum_class) {
                                                classdef = code_gen.PEFile.AddValueClass (attr,
                                                        name_space, name, is_value_class ? PEAPI.ValueClass.ValueType : PEAPI.ValueClass.Enum);
                                        } else {
                                                classdef = code_gen.PEFile.AddClass (attr,
                                                        name_space, name);
                                        }
                                }
                                if (FullName == "System.Object")
                                        classdef.SpecialNoSuper ();
                        }

                        is_defined = true;

                        if (size != -1 || pack != -1)
                                classdef.AddLayoutInfo ( (pack == -1) ? 1 : pack, (size == -1) ? 0 : size);

                        if (impl_list != null) {
                                foreach (BaseClassRef impl in impl_list) {
                                        impl.Resolve (code_gen);
                                        classdef.AddImplementedInterface (impl.PeapiClass);
                                }
                        }

                        if (gen_params != null)
                                gen_params.Resolve (code_gen, classdef);

                        is_intransit = false;

                        code_gen.AddToDefineContentsList (this);
                }
开发者ID:Profit0004,项目名称:mono,代码行数:95,代码来源:TypeDef.cs


注:本文中的Mono.ILASM.CodeGen.AddToDefineContentsList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。