diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-01-31 15:22:59 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-02-14 23:51:23 +0100 |
commit | d7dd68faa4cd279714c32965ebf83e118c915e0a (patch) | |
tree | 18d04115d11fde40dc838528be73ea8c07dadb54 /src | |
parent | 9582eb583db09f3e079fff2a9a6f9d9761e700f4 (diff) | |
download | scala-d7dd68faa4cd279714c32965ebf83e118c915e0a.tar.gz scala-d7dd68faa4cd279714c32965ebf83e118c915e0a.tar.bz2 scala-d7dd68faa4cd279714c32965ebf83e118c915e0a.zip |
adds initialize and fullyInitialize
As per Paul’s request, this commit introduces facilities to force initialization
of reflection artifacts.
Sure, initialize (actually, even fullyInitialize) is silently performed
by Symbol.typeSignature for runtime reflection, but people don’t have to
know about that.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/api/Internals.scala | 17 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Internals.scala | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/api/Internals.scala b/src/reflect/scala/reflect/api/Internals.scala index 31d47b1cdf..2957113ba5 100644 --- a/src/reflect/scala/reflect/api/Internals.scala +++ b/src/reflect/scala/reflect/api/Internals.scala @@ -233,6 +233,23 @@ trait Internals { self: Universe => */ def deSkolemize(symbol: Symbol): Symbol + /** Forces all outstanding completers associated with this symbol. + * After this call returns, the symbol becomes immutable and thread-safe. + */ + def initialize(symbol: Symbol): symbol.type + + /** Calls [[initialize]] on the owner and all the value and type parameters of the symbol. + */ + def fullyInitialize(symbol: Symbol): symbol.type + + /** Calls [[initialize]] on all the value and type parameters of the type. + */ + def fullyInitialize(tp: Type): tp.type + + /** Calls [[initialize]] on all the symbols that the scope consists of. + */ + def fullyInitialize(scope: Scope): scope.type + /** A creator for `ThisType` types. */ def thisType(sym: Symbol): Type diff --git a/src/reflect/scala/reflect/internal/Internals.scala b/src/reflect/scala/reflect/internal/Internals.scala index cdb9b7638c..9f503f66c3 100644 --- a/src/reflect/scala/reflect/internal/Internals.scala +++ b/src/reflect/scala/reflect/internal/Internals.scala @@ -74,6 +74,10 @@ trait Internals extends api.Internals { def isErroneous(symbol: Symbol): Boolean = symbol.isErroneous def isSkolem(symbol: Symbol): Boolean = symbol.isSkolem def deSkolemize(symbol: Symbol): Symbol = symbol.deSkolemize + def initialize(symbol: Symbol): symbol.type = symbol.initialize + 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 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] |