[generator] Remove logic from the attribute assemblies.

This commit is contained in:
Rolf Bjarne Kvinge 2017-02-23 11:31:52 +01:00
Родитель 9be1d2d172
Коммит 4582a2cd01
2 изменённых файлов: 16 добавлений и 7 удалений

Просмотреть файл

@ -83,13 +83,17 @@ public class BindAsAttribute : Attribute {
public BindAsAttribute (Type type)
{
Type = type;
#if BGENERATOR
var nullable = type.IsArray ? TypeManager.GetUnderlyingNullableType (type.GetElementType ()) : TypeManager.GetUnderlyingNullableType (type);
IsNullable = nullable != null;
IsValueType = IsNullable ? nullable.IsValueType : type.IsValueType;
#endif
}
public Type Type;
#if BGENERATOR
internal readonly bool IsNullable;
internal readonly bool IsValueType;
#endif
}
// Used to flag a type as needing to be turned into a protocol on output for Unified
@ -841,12 +845,8 @@ public class CoreImageFilterAttribute : Attribute {
// default is public - will be skipped for abstract types
DefaultCtorVisibility = MethodAttributes.Public;
// since it was not generated code we never fixed the .ctor(IntPtr) visibility for unified
if (Generator.XamcoreVersion >= 3) {
IntPtrCtorVisibility = MethodAttributes.FamORAssem;
} else {
IntPtrCtorVisibility = MethodAttributes.Public;
}
IntPtrCtorVisibility = MethodAttributes.PrivateScope;
// not needed by default, automaticly `protected` if the type is abstract
StringCtorVisibility = MethodAttributes.PrivateScope;
}

Просмотреть файл

@ -51,8 +51,17 @@ public partial class Generator {
}
// IntPtr constructor - always present
var intptrctor_visibility = filter.IntPtrCtorVisibility;
if (intptrctor_visibility == MethodAttributes.PrivateScope) {
// since it was not generated code we never fixed the .ctor(IntPtr) visibility for unified
if (Generator.XamcoreVersion >= 3) {
intptrctor_visibility = MethodAttributes.FamORAssem;
} else {
intptrctor_visibility = MethodAttributes.Public;
}
}
print ("[CompilerGenerated]");
print ("{0}{1} (IntPtr handle) : base (handle)", GetVisibility (filter.IntPtrCtorVisibility), type_name);
print ("{0}{1} (IntPtr handle) : base (handle)", GetVisibility (intptrctor_visibility), type_name);
PrintEmptyBody ();
// NSObjectFlag constructor - always present (needed to implement NSCoder for subclasses)