This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Creating a case class AST

1 reply
Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.

hi,

using tools.nsc.asc.Trees ... how can i create the AST (ClassDef) for a case class including all the sugar? is there something like mkCaseClass out there?

thanks, -sciss-

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: Creating a case class AST


On Tue, Dec 7, 2010 at 5:53 PM, Sciss <contact@sciss.de> wrote:
hi,

using tools.nsc.asc.Trees ... how can i create the AST (ClassDef) for a case class including all the sugar? is there something like mkCaseClass out there?

Have a look at SyntheticMethods.scala, specifically its addSyntheticMethods method. That one contains the logic for adding operations to case classes.

Cheers

 -- Martin
 
thanks, -sciss-


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland