diff options
-rw-r--r-- | src/reflect/scala/reflect/api/Internals.scala | 7 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Internals.scala | 3 | ||||
-rw-r--r-- | src/reflect/scala/reflect/macros/Universe.scala | 12 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/api/Internals.scala b/src/reflect/scala/reflect/api/Internals.scala index 913177040c..4614a79c26 100644 --- a/src/reflect/scala/reflect/api/Internals.scala +++ b/src/reflect/scala/reflect/api/Internals.scala @@ -251,6 +251,10 @@ trait Internals { self: Universe => */ def fullyInitialize(scope: Scope): scope.type + /** Returns internal flags associated with the symbol. + */ + def flags(symbol: Symbol): FlagSet + /** A creator for `ThisType` types. */ def thisType(sym: Symbol): Type @@ -436,6 +440,9 @@ trait Internals { self: Universe => /** @see [[internal.fullyInitialize]] */ def fullyInitialize: T = internal.fullyInitialize(symbol) + + /** @see [[internal.flags]] */ + def flags: FlagSet = internal.flags(symbol) } /** Extension methods for types */ diff --git a/src/reflect/scala/reflect/internal/Internals.scala b/src/reflect/scala/reflect/internal/Internals.scala index 994b907042..a283dd819a 100644 --- a/src/reflect/scala/reflect/internal/Internals.scala +++ b/src/reflect/scala/reflect/internal/Internals.scala @@ -93,6 +93,7 @@ trait Internals extends api.Internals { def fullyInitialize(symbol: Symbol): symbol.type = definitions.fullyInitializeSymbol(symbol).asInstanceOf[symbol.type] def fullyInitialize(tp: Type): tp.type = definitions.fullyInitializeType(tp).asInstanceOf[tp.type] def fullyInitialize(scope: Scope): scope.type = definitions.fullyInitializeScope(scope).asInstanceOf[scope.type] + def flags(symbol: Symbol): FlagSet = symbol.flags def attachments(symbol: Symbol): Attachments { type Pos = Position } = symbol.attachments def updateAttachment[T: ClassTag](symbol: Symbol, attachment: T): symbol.type = symbol.updateAttachment(attachment) def removeAttachment[T: ClassTag](symbol: Symbol): symbol.type = symbol.removeAttachment[T] @@ -101,6 +102,8 @@ trait Internals extends api.Internals { def setAnnotations(symbol: Symbol, annots: Annotation*): symbol.type = symbol.setAnnotations(annots: _*) def setName(symbol: Symbol, name: Name): symbol.type = symbol.setName(name) def setPrivateWithin(symbol: Symbol, sym: Symbol): symbol.type = symbol.setPrivateWithin(sym) + def setFlag(symbol: Symbol, flags: FlagSet): symbol.type = symbol.setFlag(flags) + def resetFlag(symbol: Symbol, flags: FlagSet): symbol.type = symbol.resetFlag(flags) def thisType(sym: Symbol): Type = self.ThisType(sym) def singleType(pre: Type, sym: Symbol): Type = self.SingleType(pre, sym) diff --git a/src/reflect/scala/reflect/macros/Universe.scala b/src/reflect/scala/reflect/macros/Universe.scala index 08436df5a7..039dcc7331 100644 --- a/src/reflect/scala/reflect/macros/Universe.scala +++ b/src/reflect/scala/reflect/macros/Universe.scala @@ -74,6 +74,12 @@ abstract class Universe extends scala.reflect.api.Universe { /** Sets the `privateWithin` of the symbol. */ def setPrivateWithin(symbol: Symbol, sym: Symbol): symbol.type + /** Enables `flags` on the symbol. */ + def setFlag(symbol: Symbol, flags: FlagSet): symbol.type + + /** Disables `flags` on the symbol. */ + def resetFlag(symbol: Symbol, flags: FlagSet): symbol.type + /** The attachment of the tree. */ def attachments(tree: Tree): Attachments { type Pos = Position } @@ -204,6 +210,12 @@ abstract class Universe extends scala.reflect.api.Universe { /** @see [[internal.setPrivateWithin]] */ def setPrivateWithin(sym: Symbol): T = internal.setPrivateWithin(symbol, sym) + + /** @see [[internal.setFlag]] */ + def setFlag(flags: FlagSet): T = internal.setFlag(symbol, flags) + + /** @see [[internal.setFlag]] */ + def resetFlag(flags: FlagSet): T = internal.resetFlag(symbol, flags) } } } |