You can refactor the compiler to delegate to this code in scala-reflect.jar.