Exemple #1
0
        static ILFile()
        {
            ILBlankElement.initialize();
            ILCommentElement.initialize();
            ILAssemblyElement.initialize();
            ILCustomElement.initialize();
            ILModuleElement.initialize();
            ILPublickeytokenElement.initialize();
            ILPublickeyElement.initialize();
            ILNamespaceElement.initialize();
            ILClassElement.initialize();
            ILFieldElement.initialize();
            ILPropertyElement.initialize();
            ILGetElement.initialize();
            ILSetElement.initialize();
            ILMethodElement.initialize();
            ILTryElement.initialize();
            ILCatchElement.initialize();
            ILStatementElement.initialize();
            ILLineElement.initialize();
            ILLocalsElement.initialize();
            ILMaxstackElement.initialize();

            ILUnknownElement.initialize();
        }
Exemple #2
0
        getNamespace()
        {
            ILNamespaceElement nsElem = getOwner() as ILNamespaceElement;

            if (null != nsElem)
            {
                return(nsElem);
            }

            ILClassElement clsElem = getOwner() as ILClassElement;

            if (null == clsElem)
            {
                return(null);
            }

            return(clsElem.getNamespace());
        }
Exemple #3
0
 getNamespaceIterator()
 {
     return(ILNamespaceElement.getIterator(this));
 }
Exemple #4
0
        resolve()
        {
            if (null != m_name)
            {
                return;
            }

            string[] words = splitWords(getLine(0));
            int      count = words.Length;

            m_name = words[--count];

            int p = m_name.LastIndexOf('.');

            if (p > -1)
            {
                m_fullName             = m_name;
                this.internalNamespace = m_name.Substring(0, p);
                m_name = m_name.Substring(p + 1);
            }

            p = m_name.IndexOf('<');
            if (p > 1)
            {
                m_genericArguments = m_name.Substring(p);
            }

            int i;

            for (i = 1; i < count; i++)
            {
                if (words[i].Equals("interface"))
                {
                    m_isInterface = true;
                }
                else if (words[i].Equals("private"))
                {
                    m_isPrivate = true;
                }
                else if (words[i].Equals("public"))
                {
                    m_isPublic = true;
                }
                else if (words[i].Equals("abstract"))
                {
                    m_isAbstract = true;
                }
                else if (words[i].Equals("sealed"))
                {
                    m_isSealed = true;
                }
            }

            // fullname

            ILNamespaceElement nsElement = getOwner() as ILNamespaceElement;

            //TODO: Check, how the full name should be determined for nested classes
            if (m_fullName == null) // In .NET 2.0 .class contains the full name
            {
                string nsName = (null == nsElement ? "" : nsElement.getNamespaceName());
                if (nsName == "")
                {
                    ILClassElement clsElement = getOwner() as ILClassElement;
                    if (null == clsElement)
                    {
                        m_fullName = m_name;
                    }
                    else
                    {
                        m_fullName = clsElement.getClassFullName() + "/" + m_name;
                    }
                }
                else
                {
                    m_fullName = nsName + "." + m_name;
                }
            }

            // basefullname

            string line = null;

            for (i = 0; i < getLineCount(); i++)
            {
                line = getLine(i);

                if (line.StartsWith("extends"))
                {
                    break;
                }
            }

            if (i < getLineCount())
            {
                m_baseFullName = line.Substring(7);                     //extends has 7 chars
                m_baseFullName = stripComment(m_baseFullName);

                if (m_baseFullName.Equals("[mscorlib]System.ValueType") || m_baseFullName.Equals("[netstandard]System.ValueType"))
                {
                    m_isValueType = true;
                }
                else if (m_baseFullName.Equals("[mscorlib]System.Enum") || m_baseFullName.Equals("[netstandard]System.Enum"))
                {
                    m_isEnum = true;
                }
            }
        }