SetParent() public method

public SetParent ( System parent ) : void
parent System
return void
Ejemplo n.º 1
0
 public void SetBaseTypeConstraint(
     [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
     Type?baseTypeConstraint
     )
 {
     AssemblyBuilder.CheckContext(baseTypeConstraint);
     m_type.SetParent(baseTypeConstraint);
 }
Ejemplo n.º 2
0
        public TypeBuilder SetParent(Type parent)
        {
            if (null == parent)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            _typeBuilder.SetParent(parent);
            return(this);
        }
 public void SetBaseTypeConstraint(Type baseTypeConstraint)
 {
     m_type.CheckContext(baseTypeConstraint);
     m_type.SetParent(baseTypeConstraint);
 }
Ejemplo n.º 4
0
        private void DefineType()
        {
            const string dispatcherName = IntegrationAssemblyBuilder.IntegrationAssemblyName + ".ExecutorDispatcher";

            _dispatcherBuilder = _modBuilder.DefineType(dispatcherName, TypeAttributes.Class | TypeAttributes.Public);
            _dispatcherBuilder.SetParent(typeof(RuleBasedDispatcher));
        }
Ejemplo n.º 5
0
        void EmitBaseTypesAndAttributes(TypeDefinition typeDefinition, TypeBuilder typeBuilder)
        {
            foreach (TypeReference baseType in typeDefinition.BaseTypes)
            {
                Type type = GetSystemType(baseType);

                // For some reason you can't call IsClass on constructed types created at compile time,
                // so we'll ask the generic definition instead
                if ((type.IsGenericType && type.GetGenericTypeDefinition().IsClass) || (type.IsClass))
                {
                    typeBuilder.SetParent(type);
                }
                else
                {
                    typeBuilder.AddInterfaceImplementation(type);
                }
            }
        }
Ejemplo n.º 6
0
 void Generate(ref TypeBuilder tBuilder, Class c)
 {
     // parent and interfaces
     foreach (Class baseType in c.BaseTypes) {
         Type t = GetType(baseType);
         if (t == null) {
             // parent, or interface is not
             // public namespace, or inner
             Console.WriteLine("WARNING: skipped base type {0} for {1}",
                 baseType, tBuilder.FullName);
             continue;
         }
         if (baseType.IsInterface) {
             tBuilder.AddInterfaceImplementation(t);
         } else {
             tBuilder.SetParent(t);
         }
     }
 }
Ejemplo n.º 7
0
 protected override void PreBuild()
 {
     if(Info != null)
     {
         return;
     }
     var cont = CurrentContainer;
     Builder = cont.CreateType(Name, Attributes);
     Info = Builder;
     if (Generics.Count > 0)
     {
         var gb = Builder.DefineGenericParameters(Generics.ToNames());
         Generics.RegisterBuilders(gb);
     }
     if (BaseType != null)
     {
         Builder.SetParent(BaseType.GainType()); //todo ジェネリクスに対応したTypeを生成する。
     }
     Builder.AddImplements(Implements);
 }
Ejemplo n.º 8
0
 private void Visit(ITypeDefinition typeDefinition, TypeBuilder typeBuilder) {
   if (typeDefinition.HasDeclarativeSecurity) {
     foreach (var securityAttribute in typeDefinition.SecurityAttributes)
       typeBuilder.AddDeclarativeSecurity(GetSecurityAction(securityAttribute), GetPermissionSet(securityAttribute));
   }
   foreach (var implementedInterface in typeDefinition.Interfaces)
     typeBuilder.AddInterfaceImplementation(this.loader.mapper.GetType(implementedInterface));
   foreach (var explicitOverride in typeDefinition.ExplicitImplementationOverrides) {
     typeBuilder.DefineMethodOverride((MethodInfo)this.loader.mapper.GetMethod(explicitOverride.ImplementingMethod),
       (MethodInfo)this.loader.mapper.GetMethod(explicitOverride.ImplementedMethod));
   }
   if (typeDefinition.IsGeneric) {
     foreach (var genericParameter in typeDefinition.GenericParameters)
       this.Visit(genericParameter);
   }
   foreach (var customAttribute in typeDefinition.Attributes) {
     var customAttributeBuilder = this.GetCustomAttributeBuilder(customAttribute);
     typeBuilder.SetCustomAttribute(customAttributeBuilder);
   }
   foreach (var baseType in typeDefinition.BaseClasses) {
     typeBuilder.SetParent(this.loader.mapper.GetType(baseType));
     break;
   }
 }
Ejemplo n.º 9
0
		internal void InitTypeBuilder (ModuleBuilder moduleBuilder, string next_type)
		{ 
			type_builder = moduleBuilder.DefineType (next_type, TypeAttributes.Public);
			type_builder.SetParent (typeof (GlobalScope));
			type_builder.SetCustomAttribute (new CustomAttributeBuilder
							 (typeof (CompilerGlobalScopeAttribute).GetConstructor (new Type [] {}), new object [] {}));
		}
 public void SetBaseTypeConstraint([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type?baseTypeConstraint)
 {
     m_type.SetParent(baseTypeConstraint);
 }