コード例 #1
0
ファイル: TypeBuilderState.cs プロジェクト: rdlaitila/corert
        /// <summary>
        /// Get an enumerable list of the fields used for dynamic gc layout calculation.
        /// </summary>
        private IEnumerable <FieldDesc> GetFieldsForGCLayout()
        {
            DefType defType = (DefType)TypeBeingBuilt;

            IEnumerable <FieldDesc> fields;

            if (defType.ComputeTemplate(false) != null)
            {
                // we have native layout and a template. Use the NativeLayoutFields as that is the only complete
                // description of the fields available. (There may be metadata fields, but those aren't guaranteed
                // to be a complete set of fields due to reflection reduction.
                NativeLayoutFieldAlgorithm.EnsureFieldLayoutLoadedForGenericType(defType);
                fields = defType.NativeLayoutFields;
            }
            else
            {
                // The metadata case. We're loading the type from regular metadata, so use the regular metadata fields
                fields = defType.GetFields();
            }

            return(fields);
        }