Hi Javeriya Riaz,

Actually, the code-analysis info is not really meant to be extended...
Yes, you can create your own builder and get the AST, but there's so
much more semantic info needed to actually do the code-analysis that
it's not really worth extending it that way.

There was an initial attempt to do exactly what you said (function
call analysis)... it can be activated by making
com.python.pydev.analysis.visitors.OccurrencesVisitor.analyzeArgumentsMismatch
= true in the OccurrencesVisitor constructor -- there's no UI for it
(the preference that changes it has been removed from the UI).

The actual checking is implemented in
/com.python.pydev.analysis/src/com/python/pydev/analysis/visitors/ArgumentsChecker.java,
but the problem with the current approach is that it is slow...
although it's possible to get to the definition of places in PyDev (as
is done in the current approach), for that analysis to work properly,
it shouldn't rely on that, and the code-analysis should discover what
each variable is when it's defined and save that info in some cache,
so that later on when a call it's done, it should be fast to get that
information, but that requires changing the
com.python.pydev.analysis.visitors.OccurrencesVisitor (which is the
class that actually does the code-analysis) to actually discover and
keep that information (which is not really trivial).

Also, right now in the current approach, it's not getting properly if
a variable is bound or not at a given place, so, the analysis does not
check for that properly and may give false positive or negatives if it
gets it wrong (so, keeping if a variable is bound or not at each step
is something that would need to be done properly also, not only the
type at each place).

If you're really going to implement something related to that, please
don't forget to create proper unit-tests for each use-case. There are
currently many unit-tests related in
com.python.pydev.analysis.OccurrencesAnalyzer2Test.testParameterAnalysisXXX()
already.

Cheers,

Fabio

On Sun, May 20, 2012 at 11:47 AM, Javeriya Riaz <riaz.javer...@gmail.com> wrote:
> hi,
>
> I am fairly new to pydev and eclipse development. I want to use the pydev
> analysis in my own plugin to do some further analysis for e.g. get all
> function call sites for a function to find errors in function argument
> passing.
> I am guessing I need to extend the PyDevBuilderVisitor to get the AST, where
> to get function call sites and argument information from?
>
> --
>
> rjay
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> pydev-code mailing list
> pydev-code@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pydev-code
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
pydev-code mailing list
pydev-code@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to