internal override sealed void ProvideScopes( ProjectionType projectionType, Type underlyingType, ITypeScopeAggregator aggregator) { scope.ProvideScopes(projectionType, underlyingType, aggregator); }
internal TypeInitializerInvocation( ProjectionType type, Cell<IProjectionBehavior> behavior) { this.type = type; this.behavior = behavior; }
public void CopyTo() { var array = new ProjectionType[2]; BaseTypes.CopyTo(array, 1); Assert.That(array[0], Is.Null); Assert.That(array[1], Is.Null); }
internal bool AppliesTo(ProjectionType type) { var restrictions = this.restrictions; if (restrictions != null) foreach (var restriction in restrictions) if (!restriction.AppliesTo(type)) return false; return true; }
public void GetProjectionType_Concurrent() { var types = new ProjectionType[ConcurrentTests.ThreadCount]; ConcurrentTests.ParallelInvoke(i => { types[i] = Factory.GetProjectionType(typeof(PopularType)); }); Assert.That(types, Has.All.SameAs(types[0])); }
// TODO: 'trait' instead of 'attribute'? internal static Exception AttributeConflict(ProjectionType projectionType, Type attributeType) { var message = string.Format ( "Conflicting '{0}' attributes inherited by type {1}. " + "Override the attribute, or use inheritance directives to resolve the conflict.", attributeType.GetPrettyName(false).RemoveSuffix(AttributeSuffix), projectionType.UnderlyingType.GetPrettyName(true) ); return new ProjectionException(message); }
internal ProjectionCollectionType(TypeKind kind, Type type, ProjectionFactory factory) : base(type, kind, factory) { // Must register before getting key/item types, due to possible cycles // Example: A -> IList<B> -> B -> IList<B> factory.RegisterProjectionType(this); Type keyType, itemType; GetSubtypes(out keyType, out itemType); this.keyType = factory.GetProjectionTypeUnsafe(keyType ); this.itemType = factory.GetProjectionTypeUnsafe(itemType); }
public ITraitResolution Resolve(ProjectionType projectionType, Type underlyingType) { if (projectionType == null) throw Error.ArgumentNull("projectionType"); if (underlyingType == null) throw Error.ArgumentNull("underlyingType"); var resolution = new StandardTraitResolution(projectionType, underlyingType); var assembly = underlyingType.Assembly; AddIncludedSpecs(resolution); AddDetectedSpecs(resolution, GetSharedSpecName (underlyingType), assembly); AddDetectedSpecs(resolution, GetPerTypeSpecName(underlyingType), assembly); return resolution; }
internal ProjectionProperty(PropertyInfo property, ProjectionStructureType declaringType, ProjectionPropertyCollection properties, ProjectionFactory factory, ITraitResolution resolution) { this.name = property.Name; this.declaringType = declaringType; this.propertyType = factory.GetProjectionTypeUnsafe(property.PropertyType); this.accessors = new IPropertyAccessor[4]; // factory.Providers.Count var getter = property.GetGetMethod(); var setter = property.GetSetMethod(); if (getter != null) { getterHandle = getter.MethodHandle; flags |= Flags.CanRead; } if (setter != null) { setterHandle = setter.MethodHandle; flags |= Flags.CanWrite; } var aggregator = new ProjectionPropertyTraitAggregator(this, properties); resolution.ProvidePropertyTraits(this, property, aggregator); this.aggregator = aggregator; this.overrides = aggregator.Overrides; }
public bool AppliesTo(ProjectionType type) { return regex.IsMatch(type.Name); }
private static void InitializeTypeProperty(Type type, ProjectionType projectionType) { SetStaticField(type, TypeFieldName, projectionType); }
internal StandardTraitResolution(ProjectionType projectionType, Type underlyingType) { this.projectionType = projectionType; this.underlyingType = underlyingType; }
private static MethodInfo GetMethod(RuntimeMethodHandle handle, ProjectionType declaringType) { var typeHandle = declaringType.UnderlyingType.TypeHandle; return (MethodInfo) MethodBase.GetMethodFromHandle(handle, typeHandle); }
public void CopyTo() { var array = new ProjectionType[3]; BaseTypes.CopyTo(array, 1); Assert.That(array[0], Is.Null); Assert.That(array[1], Is.SameAs(TypeOf<IBase>())); Assert.That(array[2], Is.Null); }
public bool AppliesTo(ProjectionType type) { return HasKind(type.Kind); }
public bool AppliesTo(ProjectionType type) { return type.UnderlyingType == typeof(TestType); }
public bool AppliesTo(ProjectionType type) { return AppliesTo(type.Name); }
internal abstract void ProvideScopes( ProjectionType projectionType, Type underlyingType, ITypeScopeAggregator action );
private static HashSet<ProjectionType> GetImmediateBaseTypes(ProjectionType[] baseTypes) { var result = new HashSet<ProjectionType>(); foreach (var baseType in baseTypes) result.Add(baseType); foreach (var baseType in baseTypes) result.ExceptWith(baseType.BaseTypes); return result; }
public bool AppliesTo(ProjectionType type) { return type.Name.Equals(name, comparison); }
private static ProjectionType[] GetProjectionTypes(Type[] interfaces, ProjectionFactory factory) { var baseTypes = new ProjectionType[interfaces.Length]; for (var i = 0; i < interfaces.Length; i++) { var baseType = baseTypes[i] = factory.GetProjectionTypeUnsafe(interfaces[i]) as ProjectionStructureType; if (baseType == null) throw Error.InvalidProjectionType(interfaces[i]); } return baseTypes; }
internal override sealed void ProvideScopes( ProjectionType projectionType, Type underlyingType, ITypeScopeAggregator action) { // Stub only }
public bool AppliesTo(ProjectionType type) { return type.Kind == kind; }