public override void CreateMember(Generators.TypeGenerator generator) { System.Type baseType; if (BaseType != null) { baseType = BaseType.ResolveType(generator.Context); } else { baseType = typeof(FSObject); } var type = generator.DefineNestedType(Name, baseType, System.Reflection.TypeAttributes.Public); System.Type[] types = null; if (Implements != null) { types = Implements.Map(impl => impl.ResolveType(generator.Context)).AddLast(typeof(IFSObject)); } else { types = new System.Type[1] { typeof(IFSObject) }; } type.SetInterfaces(types); type.Source = Source; type.SetCustomAttribute(typeof(Runtime.RegisterAttribute), Utils.ReflectionHelpers.Register_Attr_Ctor, new object[] { Name }); foreach (var member in Members) { member.CreateMember(type); } generator.Add(type); }
/// <inheritdoc/> public override string ToString() { string args = Arguments == null ? string.Empty : string.Join(",", Arguments.Map(arg => arg.ToString())); if (ArrayType == null) { return(string.Concat("[", string.Join(",", Expressions.Map(exp => exp.ToString())), "]<any>(", args, ")")); } return(string.Concat("[", string.Join(",", Expressions.Map(exp => exp.ToString())), "]<", ArrayType, ">(", args, ")")); }
public override System.Type ResolveType(ITypeContext provider) { if (Type == null) { if (GenericPrameters == null) { Type = provider.GetType(Name); } else { Type = provider.GetType(string.Concat(Name, '`', GenericPrameters.Count)); if (Type == null) { Type = TypeProvider.AnyType; } Type = Type.MakeGenericType(GenericPrameters.Map(p => p.ResolveType(provider))); } } return(Type); }
public override string ToString() { return($"import {string.Join(",", Imports.Map(m => m.ToString()))} from {Library}"); }