What do you mean by 'existing'? Do you want the class definitions which the current statement is nested in? Do you want to get to an arbitrary class definition somewhere in the AST?
Currently we don't maintain any of this but there's no reason you couldn't modify PythonAst.TransformToAst so that the AstGenerator held onto _body (along w/ the other places where we construct AstGenerators). From there you could make AstGenerator(AstGenerator parent, ...) hold onto the parent AstGenerator so you can walk up from an inner ast gen and get to the outer most one. If you want a parent class def you'll hit it as you're walking up the AstGenerator chtain. Or with the bodies in place you could find any ClassDefinition you want by walking down from the top ast gen. -----Original Message----- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Eyvind Axelsen Sent: Wednesday, February 04, 2009 1:59 AM To: Discussion of IronPython Subject: [IronPython] Getting hold of a ClassDefinition within IronPython.Compiler.Ast.Statement.Transform() Hi everyone, I am playing around and experimenting with new language features within IronPython (mainly out of academic interest), and I have been extending the IronPython compiler/interpreter for this purpose. However, please keep in mind that I am very new to this, and still don't quite know my way around the source. What I am wondering is, if there is a way to get hold of existing class definitions (IronPython.Compiler.Ast.ClassDefintion) (or something similar) from within the Transform method of a statement. Thanks in advance, Eyvind W. Axelsen. _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com