#227 Python parser incorrectly detects function as methods


In the attached test case, the python parser detects "im_a_function" as a method of testClass but it is a function.
This happens because "im_a_function" starts on the same indentation level as the last parsed class before.

func_vs_method.patch tries to solve this by clearing the last parent string for the indentation level of the parsed line.
But this is more or less only a quick hack, I guess there is a better, proper solution.


  • Enrico Tröger

    Enrico Tröger - 2008-06-08

    Logged In: YES
    Originator: YES

    File Added: func_vs_method.patch

  • Elias Pschernig

    Elias Pschernig - 2008-06-11

    Logged In: YES
    Originator: NO

    Thanks, committed as of revision 667. The patch looked fine to me. So far, the only time the indentation level was checked was on encountering "def" or "class". Obviously, a check was needed also for the case when something else would have a smaller indentation, thus ending the block. Which is what you implemented.

  • Elias Pschernig

    Elias Pschernig - 2008-06-11
    • assigned_to: nobody --> elias
    • status: open --> open-accepted

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks