コード例 #1
0
        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);
        }
コード例 #2
0
        /// <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, ")"));
        }
コード例 #3
0
 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);
 }
コード例 #4
0
 public override string ToString()
 {
     return($"import {string.Join(",", Imports.Map(m => m.ToString()))} from {Library}");
 }