Beispiel #1
0
        public GenericType(string signature)
        {
            int    type     = 0;
            int    arrayDim = 0;
            string value    = null;
            int    index    = 0;

            while (index < signature.Length)
            {
                switch (signature[index])
                {
                case '[':
                {
                    arrayDim++;
                    break;
                }

                case 'T':
                {
                    type  = ICodeConstants.Type_Genvar;
                    value = Sharpen.Runtime.Substring(signature, index + 1, signature.Length - 1);
                    goto loop_break;
                }

                case 'L':
                {
                    type      = ICodeConstants.Type_Object;
                    signature = Sharpen.Runtime.Substring(signature, index + 1, signature.Length - 1);
                    while (true)
                    {
                        string cl       = GetNextClassSignature(signature);
                        string name     = cl;
                        string args     = null;
                        int    argStart = cl.IndexOf("<");
                        if (argStart >= 0)
                        {
                            name = Sharpen.Runtime.Substring(cl, 0, argStart);
                            args = Sharpen.Runtime.Substring(cl, argStart + 1, cl.Length - 1);
                        }
                        if (cl.Length < signature.Length)
                        {
                            signature = Sharpen.Runtime.Substring(signature, cl.Length + 1);
                            // skip '.'
                            GenericType type11 = new GenericType(ICodeConstants.Type_Object, 0, name);
                            ParseArgumentsList(args, type11);
                            enclosingClasses.Add(type11);
                        }
                        else
                        {
                            value = name;
                            ParseArgumentsList(args, this);
                            break;
                        }
                    }
                    goto loop_break;
                }

                default:
                {
                    value = Sharpen.Runtime.Substring(signature, index, index + 1);
                    type  = VarType.GetType(value[0]);
                    break;
                }
                }
                index++;
                loop_continue :;
            }
            loop_break :;
            this.type     = type;
            this.arrayDim = arrayDim;
            this.value    = value;
        }