fhdl/visit: add missing self

This commit is contained in:
Sebastien Bourdeauducq 2012-11-09 17:37:24 +01:00
parent 13af0ce556
commit 7744655ef2
1 changed files with 28 additions and 28 deletions

View File

@ -32,59 +32,59 @@ class NodeVisitor:
elif node is not None: elif node is not None:
self.visit_unknown(node) self.visit_unknown(node)
def visit_Constant(node): def visit_Constant(self, node):
pass pass
def visit_Signal(node): def visit_Signal(self, node):
pass pass
def visit_Operator(node): def visit_Operator(self, node):
for o in node.operands: for o in node.operands:
self.visit(o) self.visit(o)
def visit_Slice(node): def visit_Slice(self, node):
self.visit(node.value) self.visit(node.value)
def visit_Cat(node): def visit_Cat(self, node):
for e in node.l: for e in node.l:
self.visit(e) self.visit(e)
def visit_Replicate(node): def visit_Replicate(self, node):
self.visit(node.v) self.visit(node.v)
def visit_Assign(node): def visit_Assign(self, node):
self.visit(node.l) self.visit(node.l)
self.visit(node.r) self.visit(node.r)
def visit_If(node): def visit_If(self, node):
self.visit(node.cond) self.visit(node.cond)
self.visit(node.t) self.visit(node.t)
self.visit(node.f) self.visit(node.f)
def visit_Case(node): def visit_Case(self, node):
self.visit(node.test) self.visit(node.test)
for v, statements in node.cases: for v, statements in node.cases:
self.visit(statements) self.visit(statements)
self.visit(node.default) self.visit(node.default)
def visit_Fragment(node): def visit_Fragment(self, node):
self.visit(node.comb) self.visit(node.comb)
self.visit(node.sync) self.visit(node.sync)
def visit_statements(node): def visit_statements(self, node):
for statement in node: for statement in node:
self.visit(statement) self.visit(statement)
def visit_clock_domains(node): def visit_clock_domains(self, node):
for clockname, statements in node.items(): for clockname, statements in node.items():
self.visit(statements) self.visit(statements)
def visit_ArrayProxy(node): def visit_ArrayProxy(self, node):
for choice in node.choices: for choice in node.choices:
self.visit(choice) self.visit(choice)
self.visit(node.key) self.visit(node.key)
def visit_unknown(node): def visit_unknown(self, node):
pass pass
class NodeTransformer: class NodeTransformer:
@ -120,60 +120,60 @@ class NodeTransformer:
else: else:
return None return None
def visit_Constant(node): def visit_Constant(self, node):
return node return node
def visit_Signal(node): def visit_Signal(self, node):
return node return node
def visit_Operator(node): def visit_Operator(self, node):
node.operands = [self.visit(o) for o in node.operands] node.operands = [self.visit(o) for o in node.operands]
return node return node
def visit_Slice(node): def visit_Slice(self, node):
node.value = self.visit(node.value) node.value = self.visit(node.value)
return node return node
def visit_Cat(node): def visit_Cat(self, node):
node.l = [self.visit(e) for e in node.l] node.l = [self.visit(e) for e in node.l]
return node return node
def visit_Replicate(node): def visit_Replicate(self, node):
node.v = self.visit(node.v) node.v = self.visit(node.v)
return node return node
def visit_Assign(node): def visit_Assign(self, node):
node.l = self.visit(node.l) node.l = self.visit(node.l)
node.r = self.visit(node.r) node.r = self.visit(node.r)
return node return node
def visit_If(node): def visit_If(self, node):
node.cond = self.visit(node.cond) node.cond = self.visit(node.cond)
node.t = self.visit(node.t) node.t = self.visit(node.t)
node.f = self.visit(node.f) node.f = self.visit(node.f)
return node return node
def visit_Case(node): def visit_Case(self, node):
node.test = self.visit(node.test) node.test = self.visit(node.test)
node.cases = [(v, self.visit(statements)) for v, statements in node.cases] node.cases = [(v, self.visit(statements)) for v, statements in node.cases]
node.default = self.visit(node.default) node.default = self.visit(node.default)
return node return node
def visit_Fragment(node): def visit_Fragment(self, node):
node.comb = self.visit(node.comb) node.comb = self.visit(node.comb)
node.sync = self.visit(node.sync) node.sync = self.visit(node.sync)
return node return node
def visit_statements(node): def visit_statements(self, node):
return [self.visit(statement) for statement in node] return [self.visit(statement) for statement in node]
def visit_clock_domains(node): def visit_clock_domains(self, node):
return dict((clockname, self.visit(statements)) for clockname, statements in node.items()) return dict((clockname, self.visit(statements)) for clockname, statements in node.items())
def visit_ArrayProxy(node): def visit_ArrayProxy(self, node):
node.choices = [self.visit(choice) for choice in node.choices] node.choices = [self.visit(choice) for choice in node.choices]
node.key = self.visit(node.key) node.key = self.visit(node.key)
return node return node
def visit_unknown(node): def visit_unknown(self, node):
return node return node