eric6/Utilities/ClassBrowsers/rbclbr.py

changeset 8205
4a0f1f896341
parent 7923
91e843545d9a
child 8217
385f60c94548
equal deleted inserted replaced
8204:fd477cded1c1 8205:4a0f1f896341
345 while acstack and acstack[-1][1] >= thisindent: 345 while acstack and acstack[-1][1] >= thisindent:
346 del acstack[-1] 346 del acstack[-1]
347 if classstack: 347 if classstack:
348 # it's a class/module method 348 # it's a class/module method
349 cur_class = classstack[-1][0] 349 cur_class = classstack[-1][0]
350 if ( 350 if isinstance(cur_class, (Class, Module)):
351 isinstance(cur_class, Class) or
352 isinstance(cur_class, Module)
353 ):
354 # it's a method 351 # it's a method
355 f = Function(None, meth_name, 352 f = Function(None, meth_name,
356 file, lineno, meth_sig) 353 file, lineno, meth_sig)
357 cur_class._addmethod(meth_name, f) 354 cur_class._addmethod(meth_name, f)
358 else: 355 else:
424 dictionary[class_name] = cur_class 421 dictionary[class_name] = cur_class
425 else: 422 else:
426 cls = classstack[-1][0] 423 cls = classstack[-1][0]
427 if class_name in cls.classes: 424 if class_name in cls.classes:
428 cur_class = cls.classes[class_name] 425 cur_class = cls.classes[class_name]
429 elif cls.name == class_name or class_name == "self": 426 elif class_name in (cls.name, "self"):
430 cur_class = cls 427 cur_class = cls
431 else: 428 else:
432 cls._addclass(class_name, cur_class) 429 cls._addclass(class_name, cur_class)
433 if not classstack: 430 if not classstack:
434 if lastGlobalEntry: 431 if lastGlobalEntry:
498 index = -1 495 index = -1
499 while index >= -len(classstack): 496 while index >= -len(classstack):
500 if ( 497 if (
501 classstack[index][0] is not None and 498 classstack[index][0] is not None and
502 not isinstance(classstack[index][0], Function) and 499 not isinstance(classstack[index][0], Function) and
503 not classstack[index][1] >= indent 500 classstack[index][1] < indent
504 ): 501 ):
505 parent = classstack[index][0] 502 parent = classstack[index][0]
506 actype = ( 503 actype = (
507 m.group("AccessControlType") or 504 m.group("AccessControlType") or
508 m.group("AccessControlType2").split('_')[0] 505 m.group("AccessControlType2").split('_')[0]
529 index = -1 526 index = -1
530 while index >= -len(classstack): 527 while index >= -len(classstack):
531 if ( 528 if (
532 classstack[index][0] is not None and 529 classstack[index][0] is not None and
533 not isinstance(classstack[index][0], Function) and 530 not isinstance(classstack[index][0], Function) and
534 not classstack[index][1] >= indent 531 classstack[index][1] < indent
535 ): 532 ):
536 attr = Attribute( 533 attr = Attribute(
537 module, m.group("AttributeName"), file, lineno) 534 module, m.group("AttributeName"), file, lineno)
538 classstack[index][0]._addattribute(attr) 535 classstack[index][0]._addattribute(attr)
539 break 536 break
549 index = -1 546 index = -1
550 while index >= -len(classstack): 547 while index >= -len(classstack):
551 if ( 548 if (
552 classstack[index][0] is not None and 549 classstack[index][0] is not None and
553 not isinstance(classstack[index][0], Function) and 550 not isinstance(classstack[index][0], Function) and
554 not classstack[index][1] >= indent 551 classstack[index][1] < indent
555 ): 552 ):
556 parent = classstack[index][0] 553 parent = classstack[index][0]
557 if m.group("AttrType") is None: 554 if m.group("AttrType") is None:
558 nv = m.group("AttrList").split(",") 555 nv = m.group("AttrList").split(",")
559 if not nv: 556 if not nv:
578 parent._getattribute("@@" + name) or 575 parent._getattribute("@@" + name) or
579 Attribute(module, "@" + name, file, lineno) 576 Attribute(module, "@" + name, file, lineno)
580 ) 577 )
581 if access == "_accessor": 578 if access == "_accessor":
582 attr.setPublic() 579 attr.setPublic()
583 elif access == "_reader" or access == "_writer": 580 elif access in ("_reader", "_writer"):
584 if attr.isPrivate(): 581 if attr.isPrivate():
585 attr.setProtected() 582 attr.setProtected()
586 elif attr.isProtected(): 583 elif attr.isProtected():
587 attr.setPublic() 584 attr.setPublic()
588 parent._addattribute(attr) 585 parent._addattribute(attr)

eric ide

mercurial