--- a/Utilities/ClassBrowsers/pyclbr.py Wed Jul 03 19:34:42 2013 +0200 +++ b/Utilities/ClassBrowsers/pyclbr.py Fri Jul 05 19:17:29 2013 +0200 @@ -271,6 +271,8 @@ return dict lineno, last_lineno_pos = 1, 0 + lastGlobalEntry = None + cur_obj = None i = 0 modifierType = ClbrBaseClasses.Function.General modifierIndent = -1 @@ -342,6 +344,13 @@ else: dict_counts[meth_name] = 0 dict[meth_name] = f + if not classstack: + if lastGlobalEntry: + lastGlobalEntry.setEndLine(lineno - 1) + lastGlobalEntry = f + if cur_obj and isinstance(cur_obj, Function): + cur_obj.setEndLine(lineno - 1) + cur_obj = f classstack.append((f, thisindent)) # Marker for nested fns # reset the modifier settings @@ -403,6 +412,10 @@ dict[class_name] = cur_class else: classstack[-1][0]._addclass(class_name, cur_class) + if not classstack: + if lastGlobalEntry: + lastGlobalEntry.setEndLine(lineno - 1) + lastGlobalEntry = cur_class classstack.append((cur_class, thisindent)) elif m.start("Attribute") >= 0: @@ -430,6 +443,9 @@ ClbrBaseClasses.ClbrBase(module, "Globals", file, lineno) dict["@@Globals@@"]._addglobal( Attribute(module, variable_name, file, lineno)) + if lastGlobalEntry: + lastGlobalEntry.setEndLine(lineno - 1) + lastGlobalEntry = None else: index = -1 while index >= -len(classstack):