SetElementType() private method

private SetElementType ( Type baseType ) : void
baseType System.Type
return void
        internal static Type FormCompoundType(char[] bFormat, Type baseType, int curIndex)
        {
            // This function takes a string to describe the compound type, such as "[,][]", and a baseType.
            // 
            // Example: [2..4]  - one dimension array with lower bound 2 and size of 3
            // Example: [3, 5, 6] - three dimension array with lower bound 3, 5, 6
            // Example: [-3, ] [] - one dimensional array of two dimensional array (with lower bound -3 for 
            //          the first dimension)
            // Example: []* - pointer to a one dimensional array
            // Example: *[] - one dimensional array. The element type is a pointer to the baseType
            // Example: []& - ByRef of a single dimensional array. Only one & is allowed and it must appear the last!
            // Example: [?] - Array with unknown bound

            SymbolType symbolType;
            int iLowerBound;
            int iUpperBound;

            if (bFormat == null || curIndex == bFormat.Length)
            {
                // we have consumed all of the format string
                return baseType;
            }

              
             

            if (bFormat[curIndex] == '&')
            {
                // ByRef case

                symbolType = new SymbolType(TypeKind.IsByRef);
                symbolType.SetFormat(bFormat, curIndex, 1);
                curIndex++;
                
                if (curIndex != bFormat.Length)
                    // ByRef has to be the last char!!
                    throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));

                symbolType.SetElementType(baseType);
                return symbolType;
            }

            if (bFormat[curIndex] == '[')
            {
                // Array type.
                symbolType = new SymbolType(TypeKind.IsArray);
                int startIndex = curIndex;
                curIndex++;

                iLowerBound = 0;
                iUpperBound = -1;

                // Example: [2..4]  - one dimension array with lower bound 2 and size of 3
                // Example: [3, 5, 6] - three dimension array with lower bound 3, 5, 6
                // Example: [-3, ] [] - one dimensional array of two dimensional array (with lower bound -3 sepcified)
                
                while (bFormat[curIndex] != ']')
                {
                    if (bFormat[curIndex] == '*')
                    {
                        symbolType.m_isSzArray = false;
                        curIndex++;                        
                    }
                    // consume, one dimension at a time
                    if ((bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9') || bFormat[curIndex] == '-')
                    {
                        bool isNegative = false;
                        if (bFormat[curIndex] == '-')
                        {
                            isNegative = true;
                            curIndex++;
                        }

                        // lower bound is specified. Consume the low bound
                        while (bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9')
                        {
                            iLowerBound = iLowerBound * 10;
                            iLowerBound += bFormat[curIndex] - '0';
                            curIndex++;
                        }

                        if (isNegative)
                        {
                            iLowerBound = 0 - iLowerBound;
                        }

                        // set the upper bound to be less than LowerBound to indicate that upper bound it not specified yet!
                        iUpperBound = iLowerBound - 1;

                    }
                    if (bFormat[curIndex] == '.')
                    {                       
                        // upper bound is specified

                        // skip over ".."
                        curIndex++;
                        if (bFormat[curIndex] != '.')
                        {
                            // bad format!! Throw exception
                            throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                        }

                        curIndex++;
                        // consume the upper bound
                        if ((bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9') || bFormat[curIndex] == '-')
                        {
                            bool isNegative = false;
                            iUpperBound = 0;
                            if (bFormat[curIndex] == '-')
                            {
                                isNegative = true;
                                curIndex++;
                            }

                            // lower bound is specified. Consume the low bound
                            while (bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9')
                            {
                                iUpperBound = iUpperBound * 10;
                                iUpperBound += bFormat[curIndex] - '0';
                                curIndex++;
                            }
                            if (isNegative)
                            {
                                iUpperBound = 0 - iUpperBound;
                            }
                            if (iUpperBound < iLowerBound)
                            {
                                // User specified upper bound less than lower bound, this is an error.
                                // Throw error exception.
                                throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                            }
                        }
                    }

                    if (bFormat[curIndex] == ',')
                    {
                        // We have more dimension to deal with.
                        // now set the lower bound, the size, and increase the dimension count!
                        curIndex++;
                        symbolType.SetBounds(iLowerBound, iUpperBound);

                        // clear the lower and upper bound information for next dimension
                        iLowerBound = 0;
                        iUpperBound = -1;
                    }
                    else if (bFormat[curIndex] != ']')
                    {
                        throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                    }
                }
                
                // The last dimension information
                symbolType.SetBounds(iLowerBound, iUpperBound);

                // skip over ']'
                curIndex++;

                symbolType.SetFormat(bFormat, startIndex, curIndex - startIndex);

                // set the base type of array
                symbolType.SetElementType(baseType);
                return FormCompoundType(bFormat, symbolType, curIndex);
            }
            else if (bFormat[curIndex] == '*')
            {
                // pointer type.

                symbolType = new SymbolType(TypeKind.IsPointer);
                symbolType.SetFormat(bFormat, curIndex, 1);
                curIndex++;
                symbolType.SetElementType(baseType);
                return FormCompoundType(bFormat, symbolType, curIndex);
            }

            return null;
        }
Esempio n. 2
0
        internal static Type FormCompoundType(string format, Type baseType, int curIndex)
        {
            // This function takes a string to describe the compound type, such as "[,][]", and a baseType.
            //
            // Example: [2..4]  - one dimension array with lower bound 2 and size of 3
            // Example: [3, 5, 6] - three dimension array with lower bound 3, 5, 6
            // Example: [-3, ] [] - one dimensional array of two dimensional array (with lower bound -3 for
            //          the first dimension)
            // Example: []* - pointer to a one dimensional array
            // Example: *[] - one dimensional array. The element type is a pointer to the baseType
            // Example: []& - ByRef of a single dimensional array. Only one & is allowed and it must appear the last!
            // Example: [?] - Array with unknown bound

            SymbolType symbolType;
            int        iLowerBound;
            int        iUpperBound;

            if (format == null || curIndex == format.Length)
            {
                // we have consumed all of the format string
                return(baseType);
            }



            if (format[curIndex] == '&')
            {
                // ByRef case

                symbolType = new SymbolType(TypeKind.IsByRef);
                symbolType.SetFormat(format, curIndex, 1);
                curIndex++;

                if (curIndex != format.Length)
                {
                    // ByRef has to be the last char!!
                    throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                }

                symbolType.SetElementType(baseType);
                return(symbolType);
            }

            if (format[curIndex] == '[')
            {
                // Array type.
                symbolType = new SymbolType(TypeKind.IsArray);
                int startIndex = curIndex;
                curIndex++;

                iLowerBound = 0;
                iUpperBound = -1;

                // Example: [2..4]  - one dimension array with lower bound 2 and size of 3
                // Example: [3, 5, 6] - three dimension array with lower bound 3, 5, 6
                // Example: [-3, ] [] - one dimensional array of two dimensional array (with lower bound -3 sepcified)

                while (format[curIndex] != ']')
                {
                    if (format[curIndex] == '*')
                    {
                        symbolType.m_isSzArray = false;
                        curIndex++;
                    }
                    // consume, one dimension at a time
                    if ((format[curIndex] >= '0' && format[curIndex] <= '9') || format[curIndex] == '-')
                    {
                        bool isNegative = false;
                        if (format[curIndex] == '-')
                        {
                            isNegative = true;
                            curIndex++;
                        }

                        // lower bound is specified. Consume the low bound
                        while (format[curIndex] >= '0' && format[curIndex] <= '9')
                        {
                            iLowerBound  = iLowerBound * 10;
                            iLowerBound += format[curIndex] - '0';
                            curIndex++;
                        }

                        if (isNegative)
                        {
                            iLowerBound = 0 - iLowerBound;
                        }

                        // set the upper bound to be less than LowerBound to indicate that upper bound it not specified yet!
                        iUpperBound = iLowerBound - 1;
                    }
                    if (format[curIndex] == '.')
                    {
                        // upper bound is specified

                        // skip over ".."
                        curIndex++;
                        if (format[curIndex] != '.')
                        {
                            // bad format!! Throw exception
                            throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                        }

                        curIndex++;
                        // consume the upper bound
                        if ((format[curIndex] >= '0' && format[curIndex] <= '9') || format[curIndex] == '-')
                        {
                            bool isNegative = false;
                            iUpperBound = 0;
                            if (format[curIndex] == '-')
                            {
                                isNegative = true;
                                curIndex++;
                            }

                            // lower bound is specified. Consume the low bound
                            while (format[curIndex] >= '0' && format[curIndex] <= '9')
                            {
                                iUpperBound  = iUpperBound * 10;
                                iUpperBound += format[curIndex] - '0';
                                curIndex++;
                            }
                            if (isNegative)
                            {
                                iUpperBound = 0 - iUpperBound;
                            }
                            if (iUpperBound < iLowerBound)
                            {
                                // User specified upper bound less than lower bound, this is an error.
                                // Throw error exception.
                                throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                            }
                        }
                    }

                    if (format[curIndex] == ',')
                    {
                        // We have more dimension to deal with.
                        // now set the lower bound, the size, and increase the dimension count!
                        curIndex++;
                        symbolType.SetBounds(iLowerBound, iUpperBound);

                        // clear the lower and upper bound information for next dimension
                        iLowerBound = 0;
                        iUpperBound = -1;
                    }
                    else if (format[curIndex] != ']')
                    {
                        throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                    }
                }

                // The last dimension information
                symbolType.SetBounds(iLowerBound, iUpperBound);

                // skip over ']'
                curIndex++;

                symbolType.SetFormat(format, startIndex, curIndex - startIndex);

                // set the base type of array
                symbolType.SetElementType(baseType);
                return(FormCompoundType(format, symbolType, curIndex));
            }
            else if (format[curIndex] == '*')
            {
                // pointer type.

                symbolType = new SymbolType(TypeKind.IsPointer);
                symbolType.SetFormat(format, curIndex, 1);
                curIndex++;
                symbolType.SetElementType(baseType);
                return(FormCompoundType(format, symbolType, curIndex));
            }

            return(null);
        }
Esempio n. 3
0
 // Token: 0x06004A7F RID: 19071 RVA: 0x0010D148 File Offset: 0x0010B348
 internal static Type FormCompoundType(char[] bFormat, Type baseType, int curIndex)
 {
     if (bFormat == null || curIndex == bFormat.Length)
     {
         return(baseType);
     }
     if (bFormat[curIndex] == '&')
     {
         SymbolType symbolType = new SymbolType(TypeKind.IsByRef);
         symbolType.SetFormat(bFormat, curIndex, 1);
         curIndex++;
         if (curIndex != bFormat.Length)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
         }
         symbolType.SetElementType(baseType);
         return(symbolType);
     }
     else
     {
         if (bFormat[curIndex] == '[')
         {
             SymbolType symbolType = new SymbolType(TypeKind.IsArray);
             int        num        = curIndex;
             curIndex++;
             int num2 = 0;
             int num3 = -1;
             while (bFormat[curIndex] != ']')
             {
                 if (bFormat[curIndex] == '*')
                 {
                     symbolType.m_isSzArray = false;
                     curIndex++;
                 }
                 if ((bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9') || bFormat[curIndex] == '-')
                 {
                     bool flag = false;
                     if (bFormat[curIndex] == '-')
                     {
                         flag = true;
                         curIndex++;
                     }
                     while (bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9')
                     {
                         num2 *= 10;
                         num2 += (int)(bFormat[curIndex] - '0');
                         curIndex++;
                     }
                     if (flag)
                     {
                         num2 = 0 - num2;
                     }
                     num3 = num2 - 1;
                 }
                 if (bFormat[curIndex] == '.')
                 {
                     curIndex++;
                     if (bFormat[curIndex] != '.')
                     {
                         throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                     }
                     curIndex++;
                     if ((bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9') || bFormat[curIndex] == '-')
                     {
                         bool flag2 = false;
                         num3 = 0;
                         if (bFormat[curIndex] == '-')
                         {
                             flag2 = true;
                             curIndex++;
                         }
                         while (bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9')
                         {
                             num3 *= 10;
                             num3 += (int)(bFormat[curIndex] - '0');
                             curIndex++;
                         }
                         if (flag2)
                         {
                             num3 = 0 - num3;
                         }
                         if (num3 < num2)
                         {
                             throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                         }
                     }
                 }
                 if (bFormat[curIndex] == ',')
                 {
                     curIndex++;
                     symbolType.SetBounds(num2, num3);
                     num2 = 0;
                     num3 = -1;
                 }
                 else if (bFormat[curIndex] != ']')
                 {
                     throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                 }
             }
             symbolType.SetBounds(num2, num3);
             curIndex++;
             symbolType.SetFormat(bFormat, num, curIndex - num);
             symbolType.SetElementType(baseType);
             return(SymbolType.FormCompoundType(bFormat, symbolType, curIndex));
         }
         if (bFormat[curIndex] == '*')
         {
             SymbolType symbolType = new SymbolType(TypeKind.IsPointer);
             symbolType.SetFormat(bFormat, curIndex, 1);
             curIndex++;
             symbolType.SetElementType(baseType);
             return(SymbolType.FormCompoundType(bFormat, symbolType, curIndex));
         }
         return(null);
     }
 }
Esempio n. 4
0
        internal static Type FormCompoundType(char[] bFormat, Type baseType, int curIndex)
        {
            if (bFormat == null || curIndex == bFormat.Length)
            {
                return(baseType);
            }
            if ((int)bFormat[curIndex] == 38)
            {
                SymbolType symbolType = new SymbolType(TypeKind.IsByRef);
                symbolType.SetFormat(bFormat, curIndex, 1);
                ++curIndex;
                if (curIndex != bFormat.Length)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                }
                symbolType.SetElementType(baseType);
                return((Type)symbolType);
            }
            if ((int)bFormat[curIndex] == 91)
            {
                SymbolType symbolType = new SymbolType(TypeKind.IsArray);
                int        curIndex1  = curIndex;
                ++curIndex;
                int lower = 0;
                int upper = -1;
                while ((int)bFormat[curIndex] != 93)
                {
                    if ((int)bFormat[curIndex] == 42)
                    {
                        symbolType.m_isSzArray = false;
                        ++curIndex;
                    }
                    if ((int)bFormat[curIndex] >= 48 && (int)bFormat[curIndex] <= 57 || (int)bFormat[curIndex] == 45)
                    {
                        bool flag = false;
                        if ((int)bFormat[curIndex] == 45)
                        {
                            flag = true;
                            ++curIndex;
                        }
                        for (; (int)bFormat[curIndex] >= 48 && (int)bFormat[curIndex] <= 57; ++curIndex)
                        {
                            lower = lower * 10 + ((int)bFormat[curIndex] - 48);
                        }
                        if (flag)
                        {
                            lower = -lower;
                        }
                        upper = lower - 1;
                    }
                    if ((int)bFormat[curIndex] == 46)
                    {
                        ++curIndex;
                        if ((int)bFormat[curIndex] != 46)
                        {
                            throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                        }
                        ++curIndex;
                        if ((int)bFormat[curIndex] >= 48 && (int)bFormat[curIndex] <= 57 || (int)bFormat[curIndex] == 45)
                        {
                            bool flag = false;
                            upper = 0;
                            if ((int)bFormat[curIndex] == 45)
                            {
                                flag = true;
                                ++curIndex;
                            }
                            for (; (int)bFormat[curIndex] >= 48 && (int)bFormat[curIndex] <= 57; ++curIndex)
                            {
                                upper = upper * 10 + ((int)bFormat[curIndex] - 48);
                            }
                            if (flag)
                            {
                                upper = -upper;
                            }
                            if (upper < lower)
                            {
                                throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                            }
                        }
                    }
                    if ((int)bFormat[curIndex] == 44)
                    {
                        ++curIndex;
                        symbolType.SetBounds(lower, upper);
                        lower = 0;
                        upper = -1;
                    }
                    else if ((int)bFormat[curIndex] != 93)
                    {
                        throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                    }
                }
                symbolType.SetBounds(lower, upper);
                ++curIndex;
                symbolType.SetFormat(bFormat, curIndex1, curIndex - curIndex1);
                symbolType.SetElementType(baseType);
                return(SymbolType.FormCompoundType(bFormat, (Type)symbolType, curIndex));
            }
            if ((int)bFormat[curIndex] != 42)
            {
                return((Type)null);
            }
            SymbolType symbolType1 = new SymbolType(TypeKind.IsPointer);

            symbolType1.SetFormat(bFormat, curIndex, 1);
            ++curIndex;
            symbolType1.SetElementType(baseType);
            return(SymbolType.FormCompoundType(bFormat, (Type)symbolType1, curIndex));
        }
        internal static Type FormCompoundType(char[] bFormat, Type baseType, int curIndex)
        {
            SymbolType type;

            if ((bFormat == null) || (curIndex == bFormat.Length))
            {
                return(baseType);
            }
            if (bFormat[curIndex] == '&')
            {
                type = new SymbolType(TypeKind.IsByRef);
                type.SetFormat(bFormat, curIndex, 1);
                curIndex++;
                if (curIndex != bFormat.Length)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                }
                type.SetElementType(baseType);
                return(type);
            }
            if (bFormat[curIndex] == '[')
            {
                type = new SymbolType(TypeKind.IsArray);
                int num3 = curIndex;
                curIndex++;
                int lower = 0;
                int upper = -1;
                while (bFormat[curIndex] != ']')
                {
                    if (bFormat[curIndex] == '*')
                    {
                        type.m_isSzArray = false;
                        curIndex++;
                    }
                    if (((bFormat[curIndex] >= '0') && (bFormat[curIndex] <= '9')) || (bFormat[curIndex] == '-'))
                    {
                        bool flag = false;
                        if (bFormat[curIndex] == '-')
                        {
                            flag = true;
                            curIndex++;
                        }
                        while ((bFormat[curIndex] >= '0') && (bFormat[curIndex] <= '9'))
                        {
                            lower *= 10;
                            lower += bFormat[curIndex] - '0';
                            curIndex++;
                        }
                        if (flag)
                        {
                            lower = -lower;
                        }
                        upper = lower - 1;
                    }
                    if (bFormat[curIndex] == '.')
                    {
                        curIndex++;
                        if (bFormat[curIndex] != '.')
                        {
                            throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                        }
                        curIndex++;
                        if (((bFormat[curIndex] >= '0') && (bFormat[curIndex] <= '9')) || (bFormat[curIndex] == '-'))
                        {
                            bool flag2 = false;
                            upper = 0;
                            if (bFormat[curIndex] == '-')
                            {
                                flag2 = true;
                                curIndex++;
                            }
                            while ((bFormat[curIndex] >= '0') && (bFormat[curIndex] <= '9'))
                            {
                                upper *= 10;
                                upper += bFormat[curIndex] - '0';
                                curIndex++;
                            }
                            if (flag2)
                            {
                                upper = -upper;
                            }
                            if (upper < lower)
                            {
                                throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                            }
                        }
                    }
                    if (bFormat[curIndex] == ',')
                    {
                        curIndex++;
                        type.SetBounds(lower, upper);
                        lower = 0;
                        upper = -1;
                    }
                    else if (bFormat[curIndex] != ']')
                    {
                        throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                    }
                }
                type.SetBounds(lower, upper);
                curIndex++;
                type.SetFormat(bFormat, num3, curIndex - num3);
                type.SetElementType(baseType);
                return(FormCompoundType(bFormat, type, curIndex));
            }
            if (bFormat[curIndex] == '*')
            {
                type = new SymbolType(TypeKind.IsPointer);
                type.SetFormat(bFormat, curIndex, 1);
                curIndex++;
                type.SetElementType(baseType);
                return(FormCompoundType(bFormat, type, curIndex));
            }
            return(null);
        }
Esempio n. 6
0
        private char[] m_bFormat;               // format string to form the full name.



        //***********************************************
        //
        // This function takes a string to describe the compound type, such as "[,][]", and a baseType.
        //
        // Example: [2..4]  - one dimension array with lower bound 2 and size of 3
        // Example: [3, 5, 6] - three dimension array with lower bound 3, 5, 6
        // Example: [-3, ] [] - one dimensional array of two dimensional array (with lower bound -3 for
        //          the first dimension)
        // Example: []* - pointer to a one dimensional array
        // Example: *[] - one dimensional array. The element type is a pointer to the baseType
        // Example: []& - ByRef of a single dimensional array. Only one & is allowed and it must appear the last!
        // Example: [?] - Array with unknown bound
        //
        //***********************************************
        internal static Type FormCompoundType(char[] bFormat, Type baseType, int curIndex)
        {
            SymbolType symbolType;
            int        iLowerBound;
            int        iUpperBound;

            if (bFormat == null || curIndex == bFormat.Length)
            {
                // we have consumed all of the format string
                return(baseType);
            }

            // @todo: baseType cannot be already a array type or a pointer type.
            // We need to do checking here...

            if (bFormat[curIndex] == '&')
            {
                // ByRef case

                symbolType = new SymbolType(TypeKind.IsByRef);
                symbolType.SetFormat(bFormat, curIndex);
                curIndex++;
                if (curIndex != bFormat.Length)
                {
                    // ByRef has to be the last char!!
                    throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                }
                symbolType.SetElementType(baseType);
                return(symbolType);
            }
            if (bFormat[curIndex] == '[')
            {
                // Array type.
                symbolType = new SymbolType(TypeKind.IsArray);
                symbolType.SetFormat(bFormat, curIndex);
                curIndex++;

                iLowerBound = 0;
                iUpperBound = -1;

                // Example: [2..4]  - one dimension array with lower bound 2 and size of 3
                // Example: [3, 5, 6] - three dimension array with lower bound 3, 5, 6
                // Example: [-3, ] [] - one dimensional array of two dimensional array (with lower bound -3 sepcified)
                while (bFormat[curIndex] != ']')
                {
                    // consume, one dimension at a time
                    if ((bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9') || bFormat[curIndex] == '-')
                    {
                        bool isNegative = false;
                        if (bFormat[curIndex] == '-')
                        {
                            isNegative = true;
                            curIndex++;
                        }

                        // lower bound is specified. Consume the low bound
                        while (bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9')
                        {
                            iLowerBound  = iLowerBound * 10;
                            iLowerBound += bFormat[curIndex] - '0';
                            curIndex++;
                        }
                        if (isNegative)
                        {
                            iLowerBound = 0 - iLowerBound;
                        }

                        // set the upper bound to be less than LowerBound to indicate that upper bound it not specified
                        // yet!
                        iUpperBound = iLowerBound - 1;
                    }
                    if (bFormat[curIndex] == '.')
                    {
                        // upper bound is specified

                        // skip over ".."
                        curIndex++;
                        if (bFormat[curIndex] != '.')
                        {
                            // bad format!! Throw exception
                            throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                        }

                        curIndex++;
                        // consume the upper bound
                        if ((bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9') || bFormat[curIndex] == '-')
                        {
                            bool isNegative = false;
                            iUpperBound = 0;
                            if (bFormat[curIndex] == '-')
                            {
                                isNegative = true;
                                curIndex++;
                            }

                            // lower bound is specified. Consume the low bound
                            while (bFormat[curIndex] >= '0' && bFormat[curIndex] <= '9')
                            {
                                iUpperBound  = iUpperBound * 10;
                                iUpperBound += bFormat[curIndex] - '0';
                                curIndex++;
                            }
                            if (isNegative)
                            {
                                iUpperBound = 0 - iUpperBound;
                            }
                            if (iUpperBound < iLowerBound)
                            {
                                // User specified upper bound less than lower bound, this is an error.
                                // Throw error exception.
                                throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                            }
                        }
                    }

                    if (bFormat[curIndex] == ',')
                    {
                        // We have more dimension to deal with.
                        // now set the lower bound, the size, and increase the dimension count!
                        curIndex++;
                        symbolType.SetBounds(iLowerBound, iUpperBound);

                        // clear the lower and upper bound information for next dimension
                        iLowerBound = 0;
                        iUpperBound = -1;
                    }
                    else if (bFormat[curIndex] != ']')
                    {
                        throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                    }
                }

                // The last dimension information
                symbolType.SetBounds(iLowerBound, iUpperBound);

                // skip over ']'
                curIndex++;

                // set the base type of array
                symbolType.SetElementType(baseType);
                return(FormCompoundType(bFormat, symbolType, curIndex));
            }
            else if (bFormat[curIndex] == '*')
            {
                // pointer type.

                symbolType = new SymbolType(TypeKind.IsPointer);
                symbolType.SetFormat(bFormat, curIndex);
                curIndex++;
                symbolType.SetElementType(baseType);
                return(FormCompoundType(bFormat, symbolType, curIndex));
            }
            return(null);
        }
 internal static Type FormCompoundType(char[] bFormat, Type baseType, int curIndex)
 {
     SymbolType type;
     if ((bFormat == null) || (curIndex == bFormat.Length))
     {
         return baseType;
     }
     if (bFormat[curIndex] == '&')
     {
         type = new SymbolType(TypeKind.IsByRef);
         type.SetFormat(bFormat, curIndex, 1);
         curIndex++;
         if (curIndex != bFormat.Length)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
         }
         type.SetElementType(baseType);
         return type;
     }
     if (bFormat[curIndex] == '[')
     {
         type = new SymbolType(TypeKind.IsArray);
         int num3 = curIndex;
         curIndex++;
         int lower = 0;
         int upper = -1;
         while (bFormat[curIndex] != ']')
         {
             if (bFormat[curIndex] == '*')
             {
                 type.m_isSzArray = false;
                 curIndex++;
             }
             if (((bFormat[curIndex] >= '0') && (bFormat[curIndex] <= '9')) || (bFormat[curIndex] == '-'))
             {
                 bool flag = false;
                 if (bFormat[curIndex] == '-')
                 {
                     flag = true;
                     curIndex++;
                 }
                 while ((bFormat[curIndex] >= '0') && (bFormat[curIndex] <= '9'))
                 {
                     lower *= 10;
                     lower += bFormat[curIndex] - '0';
                     curIndex++;
                 }
                 if (flag)
                 {
                     lower = -lower;
                 }
                 upper = lower - 1;
             }
             if (bFormat[curIndex] == '.')
             {
                 curIndex++;
                 if (bFormat[curIndex] != '.')
                 {
                     throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                 }
                 curIndex++;
                 if (((bFormat[curIndex] >= '0') && (bFormat[curIndex] <= '9')) || (bFormat[curIndex] == '-'))
                 {
                     bool flag2 = false;
                     upper = 0;
                     if (bFormat[curIndex] == '-')
                     {
                         flag2 = true;
                         curIndex++;
                     }
                     while ((bFormat[curIndex] >= '0') && (bFormat[curIndex] <= '9'))
                     {
                         upper *= 10;
                         upper += bFormat[curIndex] - '0';
                         curIndex++;
                     }
                     if (flag2)
                     {
                         upper = -upper;
                     }
                     if (upper < lower)
                     {
                         throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
                     }
                 }
             }
             if (bFormat[curIndex] == ',')
             {
                 curIndex++;
                 type.SetBounds(lower, upper);
                 lower = 0;
                 upper = -1;
             }
             else if (bFormat[curIndex] != ']')
             {
                 throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
             }
         }
         type.SetBounds(lower, upper);
         curIndex++;
         type.SetFormat(bFormat, num3, curIndex - num3);
         type.SetElementType(baseType);
         return FormCompoundType(bFormat, type, curIndex);
     }
     if (bFormat[curIndex] == '*')
     {
         type = new SymbolType(TypeKind.IsPointer);
         type.SetFormat(bFormat, curIndex, 1);
         curIndex++;
         type.SetElementType(baseType);
         return FormCompoundType(bFormat, type, curIndex);
     }
     return null;
 }