Exemplo n.º 1
0
    [ANonOptimize][AInvariant] public static void CreateMember(TypeDefinitionInfo type, int index, string name, MemberAttributes att, MemberDefinitionKind kind, string returnType, int accessor, string[] atts)
    {
        MemberDefinitionInfo member = type.CreateMemberDefinition(index);

        member._Name             = new Named(name);
        member._MemberAttributes = att;
        member._Kind             = kind;
        if (returnType != null)
        {
            member._ReturnType = AllocType(returnType);
        }
        if (accessor > 0)
        {
            if (accessor == 1 || accessor == 3)
            {
                member._Accessors.Add(new MemberAccessor(member, true));
            }
            if (accessor == 2 || accessor == 3)
            {
                member._Accessors.Add(new MemberAccessor(member, false));
            }
        }
        if (atts != null)
        {
            for (int i = 0; i < atts.Length; i++)
            {
                member._Attributes.Add(AllocType(atts[i]), null);
            }
        }
    }
Exemplo n.º 2
0
        private void PutValue(DbType typecode, int length, TypeDefinitionInfo value)
        {
            SortedList <int, TypeDefinitionInfo> map;

            if (!typeMapping.TryGetValue(typecode, out map))
            {
                typeMapping[typecode] = map = new SortedList <int, TypeDefinitionInfo>();
            }

            map[length] = value;
        }
Exemplo n.º 3
0
        public string Get(DbType typecode, int?length, int?scale)
        {
            TypeDefinitionInfo result = null;

            if (length.HasValue)
            {
                result = GetValue(typecode, length.Value);
            }

            if (result == null)
            {
                result = new TypeDefinitionInfo {
                    TypeDefinitionPattern = GetDefaultValue(typecode), DefaultScale = null
                };
            }

            return(Replace(result.TypeDefinitionPattern, length, scale ?? result.DefaultScale));
        }
Exemplo n.º 4
0
    [ANonOptimize][AInvariant] private static TypeDefinitionInfo CreateType(string name, string aname, TypeAttributes att, string underlyingType, string[] typeParameters, string[] baseTypes)
    {
        var type = new TypeDefinitionInfo();

        _t.Add(name, type);

        type._Name     = new Named(name);
        type._Assembly = AllocA(aname);
        type._Assembly.Add(type);
        type._TypeAttributes = att;
        if (underlyingType != null)
        {
            type._UnderlyingType = AllocType(underlyingType);
        }
        if (typeParameters != null)
        {
            type._TypeParameters = new TypeParameterData[typeParameters.Length];
            for (int i = 0; i < typeParameters.Length; i++)
            {
                type._TypeParameters[0]      = new TypeParameterData();
                type._TypeParameters[0].Name = new Named(typeParameters[i]);
            }
        }
        if (baseTypes != null)
        {
            for (int i = 0; i < baseTypes.Length; i++)
            {
                var bt = AllocType(baseTypes[i]);
                if (bt != null)
                {
                    type._BaseTypes.Add(bt);
                }
            }
        }

        return(type);
    }