Esempio n. 1
0
 internal GenerateInsertIntoInfoForDiscAction(UnionGenerationHelper ugh,
                                              MethodInfo addValueMethod,
                                              MethodInfo getTypeFromH)
 {
     m_ugh            = ugh;
     m_addValueMethod = addValueMethod;
     m_getTypeFromH   = getTypeFromH;
 }
Esempio n. 2
0
 internal GenerateAssignFromInfoForDiscAction(UnionGenerationHelper ugh,
                                              MethodInfo getValueMethod,
                                              MethodInfo getTypeFromH)
 {
     m_ugh            = ugh;
     m_getValueMethod = getValueMethod;
     m_getTypeFromH   = getTypeFromH;
 }
Esempio n. 3
0
        internal override Type CreateType(ModuleBuilder modBuilder, string fullTypeName)
        {
            UnionGenerationHelper genHelper = new UnionGenerationHelper(modBuilder, fullTypeName,
                                                                        TypeAttributes.Public);

            TypeContainer discrType = new TypeContainer(((TypeCodeImpl)m_discriminatorType).GetClsForTypeCode(),
                                                        ((TypeCodeImpl)m_discriminatorType).GetClsAttributesForTypeCode());
            // extract covered discr range from m_members
            ArrayList coveredDiscriminatorRange = CoveredDiscriminatorRange();
            genHelper.AddDiscriminatorFieldAndProperty(discrType, coveredDiscriminatorRange);

            Hashtable cases = CollectCases();
            foreach (ElementCase elemCase in cases.Values)
            {
                genHelper.GenerateSwitchCase(elemCase.ElemType, elemCase.ElemName,
                                             elemCase.GetDiscriminatorValues());
            }

            // add rep-id Attr
            IlEmitHelper.GetSingleton().AddRepositoryIDAttribute(genHelper.Builder, m_id);

            // create the resulting type
            return genHelper.FinalizeType();
        }
 internal GenerateInsertIntoInfoForDiscAction(UnionGenerationHelper ugh,
                                              MethodInfo addValueMethod,
                                              MethodInfo getTypeFromH) {
     m_ugh = ugh;    
     m_addValueMethod = addValueMethod;
     m_getTypeFromH = getTypeFromH;
 }            
 internal GenerateAssignFromInfoForDiscAction(UnionGenerationHelper ugh,
                                              MethodInfo getValueMethod,
                                              MethodInfo getTypeFromH) {
     m_ugh = ugh;                
     m_getValueMethod = getValueMethod;
     m_getTypeFromH = getTypeFromH;                
 }
 internal GenerateGetFieldInfoForDiscAction(UnionGenerationHelper ugh) {
     m_ugh = ugh;
 }
Esempio n. 7
0
 public Type EndUnionTypeDefinition(Symbol typeSymbol, UnionGenerationHelper helper) {
     Type resultType = helper.FinalizeType();
     
     // book-keeping
     m_typesInCreation.Remove(typeSymbol);
     AddCompleteTypeDefinition(typeSymbol, new CompileTimeTypeContainer(this, resultType));
     
     return resultType;            
 }
Esempio n. 8
0
        public UnionGenerationHelper StartUnionTypeDefinition(Symbol typeSymbol, string fullyQualName) {            
            
            if (IsTypeDeclarded(typeSymbol)) {
                // was not skipped, tried to redeclare -> internal error
                throw new InternalCompilerException("A type with the name " + 
                                                    GetKnownType(typeSymbol).GetCompactClsType().FullName +
                                                    " is already declared for symbol: " + typeSymbol);
            }            
            
            UnionGenerationHelper genHelper = new UnionGenerationHelper(m_modBuilder, fullyQualName,
                                                                        TypeAttributes.Public);
            AddRepositoryIdAttribute(genHelper.Builder, typeSymbol);
            // book-keeping
            TypeContainer container = new CompileTimeTypeContainer(this, genHelper.Builder);
            m_typesInCreation[typeSymbol] = container;

            return genHelper;
        }
Esempio n. 9
0
 internal GenerateGetFieldInfoForDiscAction(UnionGenerationHelper ugh)
 {
     m_ugh = ugh;
 }
 public UnionBuildInfo(Scope buildScope, UnionGenerationHelper helper,
                       Symbol containerSymbol) : 
                       base(buildScope, helper.Builder, containerSymbol) {
     m_helper = helper;
 }