From e6f3a8f6d3d4607d60e74ab8658a40fb55915d69 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Tue, 24 Jul 2012 15:47:58 +0200 Subject: SI-6112 exposes symbol mutators in macro universe In makro.Universe we expose the most hardcore fragments of the compiler API that don't make sense / can't be made use of in runtime reflection API. makro.Universe is already refining Tree to include setters for symbols, types and positions. Now we bring Symbol up to speed. --- src/reflect/scala/reflect/internal/Symbols.scala | 1 + src/reflect/scala/reflect/makro/Universe.scala | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 10d02376b1..6054af0ac2 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -78,6 +78,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => def asType: Type = tpe def asTypeIn(site: Type): Type = site.memberType(this) def asTypeConstructor: Type = typeConstructor + def setFlags(flags: FlagSet): this.type = setInternalFlags(flags) def setInternalFlags(flag: Long): this.type = { setFlag(flag); this } def setTypeSignature(tpe: Type): this.type = { setInfo(tpe); this } def getAnnotations: List[AnnotationInfo] = { initialize; annotations } diff --git a/src/reflect/scala/reflect/makro/Universe.scala b/src/reflect/scala/reflect/makro/Universe.scala index a676f7f1de..d88e7e0bb8 100644 --- a/src/reflect/scala/reflect/makro/Universe.scala +++ b/src/reflect/scala/reflect/makro/Universe.scala @@ -24,8 +24,15 @@ abstract class Universe extends scala.reflect.api.Universe { */ trait SymbolContextApi extends SymbolApi with AttachableApi { this: Symbol => - // [Eugene++ to Martin] should we also add mutability methods here (similarly to what's done below for trees)? - // I'm talking about `setAnnotations` and friends + def setFlags(flags: FlagSet): this.type + + def setTypeSignature(tpe: Type): this.type + + def setAnnotations(annots: AnnotationInfo*): this.type + + def setName(name: Name): this.type + + def setPrivateWithin(sym: Symbol): this.type } // Tree extensions --------------------------------------------------------------- -- cgit v1.2.3