From 50855467525c92f9fb87bcc5aab50831608b88f7 Mon Sep 17 00:00:00 2001 From: Den Shabalin Date: Wed, 28 Aug 2013 13:12:54 +0200 Subject: add missing copyTypeDef utility function --- src/reflect/scala/reflect/internal/Trees.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index fab1f45358..84818a6f42 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -1657,6 +1657,22 @@ trait Trees extends api.Trees { self: SymbolTable => case t => sys.error("Not a ValDef: " + t + "/" + t.getClass) } + def copyTypeDef(tree: Tree)( + mods: Modifiers = null, + name: Name = null, + tparams: List[TypeDef] = null, + rhs: Tree = null + ): TypeDef = tree match { + case TypeDef(mods0, name0, tparams0, rhs0) => + treeCopy.TypeDef(tree, + if (mods eq null) mods0 else mods, + if (name eq null) name0 else name, + if (tparams eq null) tparams0 else tparams, + if (rhs eq null) rhs0 else rhs + ) + case t => + sys.error("Not a TypeDef: " + t + "/" + t.getClass) + } def copyClassDef(tree: Tree)( mods: Modifiers = null, name: Name = null, -- cgit v1.2.3