public AstReflectedType(Type type, Reflector reflector) { Argument.RequireNotNull("type", type); Argument.RequireNotNull("reflector", reflector); this.ActualType = type; this.reflector = reflector; this.baseType = this.ActualType.BaseType != null ? new Lazy<IAstTypeReference>(() => this.reflector.Reflect(this.ActualType.BaseType)) : new Lazy<IAstTypeReference>(() => AstAnyType.Instance); }
public ExternalNamespaceNameSource(string @namespace, IEnumerable<Assembly> assemblies, Reflector reflector) { this.reflector = reflector; Argument.RequireNotNullAndNotEmpty("namespace", @namespace); Argument.RequireNotNull("assemblies", assemblies); // this all is horribly inefficient, especially if using multiple namespaces from a single assembly // but it can wait for now this.typeCache = assemblies.SelectMany(a => a.GetExportedTypes()) .Where(t => t.Namespace == @namespace) .ToDictionary(t => t.Name); if (this.typeCache.Count == 0) throw new NotImplementedException("ExternalNamespaceNameSource: No types in " + @namespace); this.memberCache = this.typeCache.Values .SelectMany(t => t.GetMethods()) .Where(m => m.IsStatic) .Where(m => m.IsDefined<ExtensionAttribute>(false)) .GroupBy(m => m.Name) .ToDictionary(g => g.Key, g => g.ToArray()); }
public AstReflectedMethod(MethodInfo method, Reflector reflector) { Argument.RequireNotNull("reflector", reflector); Argument.RequireNotNull("method", method); this.Method = method; this.ReturnType = method.ReturnType != typeof(void) ? reflector.Reflect(method.ReturnType) : AstVoidType.Instance; this.parameterTypes = new Lazy<ReadOnlyCollection<IAstTypeReference>>( () => method.GetParameters() .Select(p => reflector.Reflect(p.ParameterType)) .ToArray() .AsReadOnly() ); this.genericParameterTypes = new Lazy<ReadOnlyCollection<IAstTypeReference>>( () => method.IsGenericMethodDefinition ? method.GetGenericArguments().Select(reflector.Reflect).ToArray().AsReadOnly() : No.Types ); this.Location = method.IsDefined<ExtensionAttribute>(false) ? MethodLocation.Extension : MethodLocation.Target; }
public AstReflectedProperty(PropertyInfo property, Reflector reflector) { Argument.RequireNotNull("property", property); this.Property = property; this.Type = new AstReflectedType(property.PropertyType, reflector); }
public AstReflectedConstructor(ConstructorInfo constructor, Reflector reflector) { this.Constructor = constructor; }
public BuiltInNamespacesNameSource(Reflector reflector) { this.namespaces = new[] { new ExternalNamespaceNameSource("Light.Framework", new[] { typeof(Range<>).Assembly }, reflector), }; }
public BuiltInTypesNameSource(BuiltInTypeMap map, Reflector reflector) { this.map = map; this.reflector = reflector; }