Beispiel #1
0
        getAllStatementElements(ArrayList statements)
        {
            if (null == m_elements)
            {
                return;
            }

            for (int i = 0; i < m_elements.Count; i++)
            {
                ILClassElement classElement = m_elements[i] as ILClassElement;
                if (null != classElement)
                {
                    continue;
                }

                ILStatementElement statementElement = m_elements[i] as ILStatementElement;
                if (null != statementElement)
                {
                    statements.Add(statementElement);
                    continue;
                }

                (m_elements[i] as ILElement).getAllStatementElements(statements);
            }
        }
Beispiel #2
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();
        }
Beispiel #3
0
        getAllClassElements(ArrayList forwardClasses, ArrayList classes)
        {
            if (null == m_elements)
            {
                return;
            }

//			Debug.WriteLine("Type: " + this.GetType().Name);
//			Debug.Indent();
            for (int i = 0; i < m_elements.Count; i++)
            {
                ILClassElement classElement = m_elements[i] as ILClassElement;
                if (classElement != null)
                {
#if NET20
                    classes.Add(classElement);
#else
                    string classname = classElement.getClassFullName();
//					Debug.Write(classname + " -> ");
                    for (int j = 0; j < forwardClasses.Count; j++)
                    {
                        ILClassElement forwardClassElement = forwardClasses[j] as ILClassElement;
                        string         forwardClassname    = forwardClassElement.getClassFullName();

                        if (classname.Equals(forwardClassname))
                        {
                            forwardClasses.RemoveAt(j);
                            classElement.setForwardClassElement(forwardClassElement);
//							Debug.WriteLine(forwardClassname);

                            break;
                        }
                    }

                    if (null == classElement.getForwardClassElement())
                    {
//						Debug.WriteLine("nix");
                        forwardClasses.Add(classElement);
                    }
                    else
                    {
                        classes.Add(classElement);
                    }
#endif
                }

                (m_elements[i] as ILElement).getAllClassElements(forwardClasses, classes);
            }
//			Debug.Unindent();
        }
Beispiel #4
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());
        }
Beispiel #5
0
 getClassIterator()
 {
     return(ILClassElement.getIterator(this));
 }
Beispiel #6
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;
                }
            }
        }