Function: wisent-python-reconstitute-class-tag
wisent-python-reconstitute-class-tag is a byte-compiled function
defined in python.el.gz.
Signature
(wisent-python-reconstitute-class-tag TAG)
Documentation
Move a docstring from TAG's members into its :documentation attribute.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/wisent/python.el.gz
(defun wisent-python-reconstitute-class-tag (tag)
"Move a docstring from TAG's members into its :documentation attribute."
;; The first member of TAG may be a documentation string. If that is
;; the case, remove of it from the members list and stick its
;; content into the :documentation attribute.
(let ((first-member (car (semantic-tag-type-members tag))))
(when (semantic-python-docstring-p first-member)
(semantic-tag-put-attribute
tag :members
(cdr (semantic-tag-type-members tag)))
(semantic-tag-put-attribute
tag :documentation
(semantic-python-extract-docstring first-member))))
;; Try to find the constructor, determine the name of the instance
;; parameter, find assignments to instance variables and add
;; corresponding variable tags to the list of members.
(dolist (member (semantic-tag-type-members tag))
(when (semantic-tag-function-constructor-p member)
(let ((self (semantic-tag-name
(car (semantic-tag-function-arguments member)))))
(dolist (statement (semantic-tag-get-attribute member :suite))
(when (semantic-python-instance-variable-p statement self)
(let ((variable (semantic-tag-clone
statement
(substring (semantic-tag-name statement) 5)))
(members (semantic-tag-get-attribute tag :members)))
(when (semantic-python-private-p variable)
(semantic-tag-put-attribute variable :protection "private"))
(setcdr (last members) (list variable))))))))
;; TODO remove the :suite attribute
tag)