コード例 #1
0
 /// <summary>
 /// Mark all properties with the given name reachable.
 /// </summary>
 internal static void MarkPropertiesReachable(this TypeReference type, string propertyName, ReachableContext context)
 {
     while ((type != null) && (context.Contains(type)))
     {
         TypeDefinition typeDef = context.GetTypeDefinition(type);
         if (typeDef != null)
         {
             if (typeDef.HasProperties)
             {
                 foreach (PropertyDefinition prop in typeDef.Properties)
                 {
                     if (prop.Name == propertyName)
                     {
                         prop.MarkReachable(context);
                     }
                 }
             }
             type = typeDef.BaseType;
         }
         else
         {
             type = null;
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Mark all fields with the given name reachable.
 /// </summary>
 internal static void MarkFieldsReachable(this TypeReference type, string fieldName, ReachableContext context)
 {
     while ((type != null) && (context.Contains(type)))
     {
         TypeDefinition typeDef = context.GetTypeDefinition(type);
         if (typeDef != null)
         {
             if (typeDef.HasFields)
             {
                 foreach (FieldDefinition field in typeDef.Fields)
                 {
                     if (field.Name == fieldName)
                     {
                         field.MarkReachable(context);
                     }
                 }
             }
             type = typeDef.BaseType;
         }
         else
         {
             type = null;
         }
     }
 }
コード例 #3
0
ファイル: Reachable.DotNet.cs プロジェクト: rfcclub/dot42
 /// <summary>
 /// Mark all properties with the given name reachable.
 /// </summary>
 internal static void MarkPropertiesReachable(this TypeReference type, string propertyName, ReachableContext context)
 {
     while ((type != null) && (context.Contains(type)))
     {
         TypeDefinition typeDef = context.GetTypeDefinition(type);
         if (typeDef != null)
         {
             if (typeDef.HasProperties)
             {
                 foreach (PropertyDefinition prop in typeDef.Properties)
                 {
                     if (prop.Name == propertyName)
                     {
                         prop.MarkReachable(context);
                     }
                 }
             }
             type = typeDef.BaseType;
         }
         else
         {
             type = null;
         }
     }
 }
コード例 #4
0
ファイル: Reachable.DotNet.cs プロジェクト: rfcclub/dot42
 /// <summary>
 /// Mark all fields with the given name reachable.
 /// </summary>
 internal static void MarkFieldsReachable(this TypeReference type, string fieldName, ReachableContext context)
 {
     while ((type != null) && (context.Contains(type)))
     {
         TypeDefinition typeDef = context.GetTypeDefinition(type);
         if (typeDef != null)
         {
             if (typeDef.HasFields)
             {
                 foreach (FieldDefinition field in typeDef.Fields)
                 {
                     if (field.Name == fieldName)
                     {
                         field.MarkReachable(context);
                     }
                 }
             }
             type = typeDef.BaseType;
         }
         else
         {
             type = null;
         }
     }
 }
コード例 #5
0
ファイル: ReachableResolver.cs プロジェクト: Xtremrules/dot42
        /// <summary>
        /// Resolve type reference into type defition.
        /// Generic instance types are resolved to their element type.
        /// </summary>
        internal static TypeDefinition Resolve(this TypeReference type, ReachableContext context)
        {
            if (context.Contains(type))
            {
                var typeDef = type as TypeDefinition;
                if (typeDef != null) { return typeDef; }

                var git = type as GenericInstanceType;
                if (git != null) { return git.ElementType.Resolve(context); }

                return context.GetTypeDefinition(type);
            }

            // Type not in project, don't care about it.
            return null;
        }
コード例 #6
0
        /// <summary>
        /// Resolve type reference into type defition.
        /// Generic instance types are resolved to their element type.
        /// </summary>
        internal static TypeDefinition Resolve(this TypeReference type, ReachableContext context)
        {
            if (context.Contains(type))
            {
                var typeDef = type as TypeDefinition;
                if (typeDef != null)
                {
                    return(typeDef);
                }

                var git = type as GenericInstanceType;
                if (git != null)
                {
                    return(git.ElementType.Resolve(context));
                }

                return(context.GetTypeDefinition(type));
            }

            // Type not in project, don't care about it.
            return(null);
        }