[Cython] [Fwd: Re: Beginner-friendly tickets]
Kurt Smith
kwmsmith at gmail.com
Tue Mar 17 06:31:36 CET 2009
On Mon, Mar 16, 2009 at 3:40 AM, Dag Sverre Seljebotn
<dagss at student.matnat.uio.no> 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.
(Normally I'd attach this patch to the trac ticket but I thought some
feedback would be good.)
Kurt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ticket-158.patch
Type: text/x-diff
Size: 4789 bytes
Desc: not available
Url : http://codespeak.net/pipermail/cython-dev/attachments/20090317/843f947f/attachment.bin
More information about the Cython-dev
mailing list