Skip to content

Cannot traverse nodes using NodeVisitor, FuncDeclExt is not iterable #45

@julianneswinoga

Description

@julianneswinoga

Using GnuCParser() and subclassing c_ast.NodeVisitor, I cannot traverse the nodes as in the FuncDefs example in https://github.com/eliben/pycparser/blob/master/examples/func_defs.py

It results in the following error:

Traceback (most recent call last):
  [...]
  File "main_script.py", line 77, in verify
    FuncDefVisitor().visit(self.ast)
  File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 158, in visit
    return visitor(node)
  File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 165, in generic_visit
    self.visit(c)
  File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 158, in visit
    return visitor(node)
  File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 165, in generic_visit
    self.visit(c)
  File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 158, in visit
    return visitor(node)
  File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 164, in generic_visit
    for c in node:
TypeError: 'FuncDeclExt' object is not iterable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions