[IronPython] Getting hold of a ClassDefinition within IronPython.Compiler.Ast.Statement.Transform()

Dino Viehland dinov at microsoft.com
Thu Feb 5 10:15:38 PST 2009


Sorry, there's no additional documentation other than the comments.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Eyvind Axelsen
Sent: Thursday, February 05, 2009 9:42 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Getting hold of a ClassDefinition within IronPython.Compiler.Ast.Statement.Transform()

Dino,

Thank you for responding! Getting hold of an arbitrary ClassDefinition (and then modifying it slightly) is what I'm trying to do, so I will try your suggestions. I suppose you don't have any (informal) documentation for the parser/compiler?

Eyvind.

-----Opprinnelig melding-----
Fra: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] På vegne av Dino Viehland
Sendt: 4. februar 2009 18:04
Til: Discussion of IronPython
Emne: Re: [IronPython] Getting hold of a ClassDefinitionwithin IronPython.Compiler.Ast.Statement.Transform()

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-bounces at lists.ironpython.com [mailto:users-bounces at 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 at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the Users mailing list