316 lineno, value.name, self.scope[value.name].source.lineno) |
316 lineno, value.name, self.scope[value.name].source.lineno) |
317 |
317 |
318 if not isinstance(self.scope, ClassScope): |
318 if not isinstance(self.scope, ClassScope): |
319 for scope in self.scopeStack[::-1]: |
319 for scope in self.scopeStack[::-1]: |
320 existing = scope.get(value.name) |
320 existing = scope.get(value.name) |
321 if (isinstance(existing, Importation) |
321 if isinstance(existing, Importation) and \ |
322 and not existing.used |
322 not existing.used and \ |
323 and (not isinstance(value, Importation) or value.fullName == existing.fullName) |
323 not isinstance(value, UnBinding) and \ |
324 and reportRedef): |
324 (not isinstance(value, Importation) or \ |
325 |
325 value.fullName == existing.fullName) and \ |
|
326 reportRedef: |
326 self.report(messages.RedefinedWhileUnused, |
327 self.report(messages.RedefinedWhileUnused, |
327 lineno, value.name, scope[value.name].source.lineno) |
328 lineno, value.name, scope[value.name].source.lineno) |
328 |
329 |
329 if isinstance(value, UnBinding): |
330 if isinstance(value, UnBinding): |
330 try: |
331 try: |