Kurt Smith wrote:
> Thanks for the guidance -- I'm making progress but I can't figure out one 
> issue:
> 
> when I add the following method to AnalyzeDeclarationsTransform
> everything works as expected:
> 
> def visit_NameNode(self, node):
>     print node.dump()
>     return node
> 
> It is called for every name node in the parse tree.
> 
> but this one is not called for every matching node:
> 
> def visit_CNameDeclaratorNode(self, node):
>     print node.dump()
>     return node
> 
> Specifically, it is only called when the CNameDeclaratorNode is part
> of (a descendant of) a CArgDeclNode.  When it's part of (a descendant
> of) a CVarDefNode it is not called.
> 
> I'm happy to give an example if it would help.
> 
> In general, if I add a visit_<NodeType>(self, node) method in one of
> the Transform classes that forms the pipeline, should I expect that
> node type to be visited provided it exists in the tree at that point
> in the pipeline?

There are two issues that might hit here. One is that (IIRC) declarators
are removed from the tree at some point in the pipeline as they have done
their duty after type analysis and would just increase the overall runtime
of the remaining tree operations. Note the IIRC. At least, I'm sure about
the fact that there is a transformation base class that ignores them
explicitly. So watch out for the class hierarchy of your transformation.

The second thing is that a method "visit_SomeNode()" only matches if there
is not a more specific method match. E.g., "visit_Node()" will not get
called for an expression node if there is a "visit_ExprNode()" sitting in
the same class.

Does that help?

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to