Пример #1
0
		public override void ProcessType (TypeDefinition type)
		{
			if (!type.IsNSObject () || !type.IsNativeObject ())
				return;

			base.ProcessType (type);
		}
Пример #2
0
        public override void ProcessType(TypeDefinition type)
        {
            if (ProductAssembly == null)
                ProductAssembly = (Profile.Current as BaseProfile).ProductAssembly;

            bool nsobject = type.IsNSObject ();
            if (!nsobject && !type.IsNativeObject ())
                return;

            if (!IsProductType (type)) {
                // we need to annotate the parent type(s) of a nested type
                // otherwise the sweeper will not keep the parents (nor the childs)
                if (type.IsNested) {
                    var parent = type.DeclaringType;
                    while (parent != null) {
                        Annotations.Mark (parent);
                        parent = parent.DeclaringType;
                    }
                }
                Annotations.Mark (type);
                Annotations.SetPreserve (type, TypePreserve.All);
            } else {
                PreserveIntPtrConstructor (type);
                if (nsobject)
                    PreserveExportedMethods (type);
            }
        }
        public override void ProcessType(TypeDefinition type)
        {
            // if 'type' inherits from NSObject inside an assembly that has [GeneratedCode]
            // or for static types used for optional members (using extensions methods), they can be optimized too
            bool extensions = type.IsSealed && type.IsAbstract && type.Name.EndsWith ("_Extensions", StringComparison.Ordinal);
            if (!HasGeneratedCode && (type.IsNSObject () || !extensions))
                return;

            if (type.HasMethods)
                ProcessMethods (type.Methods, extensions);
        }
Пример #4
0
 void ProcessType(TypeDefinition type)
 {
     if (type.IsNSObject ()) {
         ProcessNSObject (type);
     } else if (type.HasNestedTypes) {
         foreach (var nested in type.NestedTypes)
             ProcessType (nested);
     }
 }
Пример #5
0
 // called once for each 'type' so it's a nice place to cache the result
 // and ensure later steps re-use the same, pre-computed, result
 static bool IsNSObject(TypeDefinition type)
 {
     if (!type.IsNSObject ())
         return false;
     cached_isnsobject.Add (type);
     return true;
 }