Kurt Smith wrote: > On Mon, Mar 16, 2009 at 3:40 AM, Dag Sverre Seljebotn > <[email protected]> wrote: > [snip] >> Great that you're making progress. >> >> Yes, there is something I'd rather tell you about this :-) The transform >> works by recursive descent, and when a node type is intercepted, one >> needs to actively visit the children as well. >> >> This is done by self.visitchildren(node); see in visit_FuncDefNode for >> an example. Since visitchildren is never called in CVarDefNode, the >> children of CVarDefNode are never visited. >> >> Also, the node will be replaced with whatever it returns. >> visit_CVarDefNode returns None so that the entire declaration is removed >> from the tree, as it is no longer needed (which is why one isn't >> analysing the children as well). >> >> (Depending on what you need this for, you could be able to extract the >> information from the attributes of the enclosing FuncDefNode; I think >> there's a Scope there somewhere which you can inspect the entries of.) > > Thanks again for the guidance. > > I have a patch for review -- it involves adding > self.visitchildren(node) in some methods and adding a > visit_CNameDeclaratorNode() method along with the discussed > visit_NameNode() method. It also adds a declareafteruse_T158.pyx file > to tests/errors. > > Let me know if this along the lines of what you were thinking & how it > can be improved.
Positive review -- I don't think it can be improved :-) Thanks! I've committed it to cython-devel. (I made two small changes to the error message) -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
