From d288fe9b91d1a4c0fae731801313a43af063a9fe Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 5 Jan 2019 15:12:56 +1100 Subject: [PATCH] tools/spec: avoid shadowing variable 'type' --- tools/spec.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tools/spec.py b/tools/spec.py index e101a4d..b930908 100644 --- a/tools/spec.py +++ b/tools/spec.py @@ -178,12 +178,12 @@ class Bitmask(Type): assert node.tag == 'type' assert node.attrib['category'] == 'bitmask' - name = node.find('name').text - type = node.find('type').text + n = node.find('name').text + t = node.find('type').text - super().__init__(name,depends=[type]) + super().__init__(n, depends=[t]) - self.type = type + self.type = t self.requires = node.attrib.get('requires') if self.requires: self.depends.append(self.requires) @@ -207,17 +207,16 @@ class Handle(Type): assert node.tag == 'type' assert node.attrib['category'] == 'handle' - name = node.find('name').text - type = node.find('type').text + n = node.find('name').text + t = node.find('type').text + assert t - super().__init__(name, depends=[type]) - self.type = type + super().__init__(n, depends=[t]) + self.type = t parents = node.attrib.get('parent', None) self.parents = parents.split(',') if parents else [] - assert type - def declare(self): return "struct %(name)s_t; using %(name)s = %(name)s_t*;" % { "name": self.name, @@ -323,8 +322,8 @@ class POD(Type): self._members = [] for member in node.findall('./member'): - type = member.find('type').text - name = member.find('name').text + t = member.find('type').text + n = member.find('name').text comment = member.find('comment') if not comment is None: @@ -337,7 +336,7 @@ class POD(Type): #code = map(lambda x: "".join(x), code) #code = "".join(code) - self._members.append({'code': code, 'type': type, 'name': name}) + self._members.append({'code': code, 'type': t, 'name': n}) def declare(self): return "%(category)s %(name)s;" % {