src/eric7/Utilities/ClassBrowsers/pyclbr.py

branch
eric7
changeset 10468
fcae57045733
parent 10458
2074b8393649
child 10471
28d4780d6a66
diff -r b3929f6748ae -r fcae57045733 src/eric7/Utilities/ClassBrowsers/pyclbr.py
--- a/src/eric7/Utilities/ClassBrowsers/pyclbr.py	Tue Jan 02 14:06:09 2024 +0100
+++ b/src/eric7/Utilities/ClassBrowsers/pyclbr.py	Tue Jan 02 16:08:13 2024 +0100
@@ -112,7 +112,7 @@
         ^
         (?P<TypedVariableIndent> [ \t]* )
         (?P<TypedVariableName> \w+ )
-        [ \t]* :
+        [ \t]* : [^\r\n]*? =
     )
 
 |   (?P<Main>
@@ -535,7 +535,7 @@
                     deltaindentcalculated = False
             # close all classes indented at least as much
             while classstack and classstack[-1][1] >= thisindent:
-                del classstack[-1]
+                classstack.pop()
             if classstack:
                 # it's a class method
                 cur_class = classstack[-1][0]
@@ -587,7 +587,7 @@
             thisindent = _indent(m.captured("ClassIndent"))
             # close all classes indented at least as much
             while classstack and classstack[-1][1] >= thisindent:
-                del classstack[-1]
+                classstack.pop()
             lineno += src.count("\n", last_lineno_pos, start)
             last_lineno_pos = start
             class_name = m.captured("ClassName")
@@ -692,6 +692,10 @@
                             classstack[index][0]._addglobal(
                                 Attribute(module, variable_name, file, lineno)
                             )
+                        elif isinstance(classstack[index][0], Function):
+                            classstack[index][0]._addattribute(
+                                Attribute(module, variable_name, file, lineno)
+                            )
                         break
 
         elif m.captured("TypedVariable"):
@@ -722,6 +726,10 @@
                                 classstack[index][0]._addglobal(
                                     Attribute(module, variable_name, file, lineno)
                                 )
+                            elif isinstance(classstack[index][0], Function):
+                                classstack[index][0]._addattribute(
+                                    Attribute(module, variable_name, file, lineno)
+                                )
                             break
 
         elif m.captured("Publics"):

eric ide

mercurial