static references

Dec 29, 2009 at 10:50 AM

Hi,

 

The parser doesn’t seem to recognize static references. I would like to able to know all the static references of a c# class/method, but if parsing a piece of code like this:

 

using System;

namespace ClassLibrary2

{

    public class Class1

    {

        public void Class1Method()

        {

            Math.Abs(-1);

        }

    }

}

 

there seems to be no way to tell that the method Class1Method references the System.Math class. Nowhere can I find the information. The CSharpParser.ProjectModel.MethodDeclaration contains only references to non-static types in properties: TypeParameters, Variables etc. There seems to be no property of that class that would tell you all the static references. Can anybody help?

 

Thanks,

Developer
Dec 29, 2009 at 3:04 PM

Hi,

The MethodDeclaration class is the product of the syntax analysis step that doesn't know the meaning of the identifiers (like "Math").

It's the semantic analysis step that resolves "Math" to a class.

Unfortunately this part is still under development, so you can't use it yet.

Regards,