Use -Xprint:typer (to dump trees after typer) along with -Yshow-trees-compact (to dump trees in raw AST format). If you also use -Yshow-trees-stringified , AST will be further reset as a Scala pseudo-code (note: the last two options require 2.10.0).
C:\Projects\Kepler\sandbox @ ticket/6356>cat Test.scala class C { def x = 2 } C:\Projects\Kepler\sandbox @ ticket/6356>scalac -Xprint:typer -Yshow-trees-compact -Yshow-trees-stringified Test.scala [[syntax trees at end of typer]]// Scala source: Test.scala package <empty> { class C extends scala.AnyRef { def <init>(): C = { C.super.<init>(); () }; def x: Int = 2 } } PackageDef( Ident(<empty>), List( ClassDef(Modifiers(), newTypeName("C"), List(), Template(List(Select(Ident(scala), newTypeName("AnyRef"))), emptyValDef, List( DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(newTypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(Modifiers(), newTermName("x"), List(), List(), TypeTree(), Literal(Constant(2))))))))
Eugene burmako
source share