Utilities/ClassBrowsers/ClbrBaseClasses.py

changeset 1303
6018d7ac3aec
parent 1227
c5db073a124f
child 1509
c0b5e693b0eb
equal deleted inserted replaced
1302:95538c8d07c1 1303:6018d7ac3aec
73 73
74 @param attr Attribute object to be added (Attribute) 74 @param attr Attribute object to be added (Attribute)
75 """ 75 """
76 if attr.name not in self.globals: 76 if attr.name not in self.globals:
77 self.globals[attr.name] = attr 77 self.globals[attr.name] = attr
78 else:
79 self.globals[attr.name].addAssignment(attr.lineno)
78 80
79 def _getglobal(self, name): 81 def _getglobal(self, name):
80 """ 82 """
81 Protected method to retrieve a global variable by name. 83 Protected method to retrieve a global variable by name.
82 84
94 96
95 @param attr Attribute object to be added (Attribute) 97 @param attr Attribute object to be added (Attribute)
96 """ 98 """
97 if attr.name not in self.attributes: 99 if attr.name not in self.attributes:
98 self.attributes[attr.name] = attr 100 self.attributes[attr.name] = attr
101 else:
102 self.attributes[attr.name].addAssignment(attr.lineno)
99 103
100 def _getattribute(self, name): 104 def _getattribute(self, name):
101 """ 105 """
102 Protected method to retrieve an attribute by name. 106 Protected method to retrieve an attribute by name.
103 107
178 @param name name of this class 182 @param name name of this class
179 @param file filename containing this attribute 183 @param file filename containing this attribute
180 @param lineno linenumber of the class definition 184 @param lineno linenumber of the class definition
181 """ 185 """
182 _ClbrBase.__init__(self, module, name, file, lineno) 186 _ClbrBase.__init__(self, module, name, file, lineno)
187
188 self.linenos = [lineno]
189
190 def addAssignment(self, lineno):
191 """
192 Public method to add another assignment line number.
193
194 @param lineno linenumber of the additional attribute assignment (integer)
195 """
196 if lineno not in self.linenos:
197 self.linenos.append(lineno)
183 198
184 199
185 class Class(ClbrBase): 200 class Class(ClbrBase):
186 """ 201 """
187 Class to represent a class. 202 Class to represent a class.

eric ide

mercurial