summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/runtime/Universe.scala
blob: dca6d6041bd05a8e68962d10656bd970235733eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package scala.reflect
package runtime

import internal.{SomePhase, NoPhase, Phase, TreeGen}

/** The universe for standard runtime reflection from Java.
 *  This type implements all abstract term members in internal.SymbolTable.
 *  It also provides methods to go from Java members to Scala members,
 *  using the code in JavaConversions.
 */
class Universe extends SymbolTable {

  type AbstractFileType = AbstractFile

  def picklerPhase = SomePhase

  val gen = new TreeGen { val global: Universe.this.type = Universe.this }

  lazy val settings = new Settings
  def forInteractive = false
  def forScaladoc = false

  val phaseWithId: Array[Phase] = Array(NoPhase, SomePhase)
  val currentRunId = 1 // fake a run id so that it is different from NoRunId
  phase = SomePhase // set to a phase different from NoPhase

  def log(msg: => AnyRef): Unit = println(" [] "+msg)

  type TreeCopier = TreeCopierOps
  def newStrictTreeCopier: TreeCopier = new StrictTreeCopier
  def newLazyTreeCopier: TreeCopier = new LazyTreeCopier

  def focusPos(pos: Position) = pos
  def isRangePos(pos: Position) = false
  def showPos(pos: Position) = "<unknown position>"

  type Position = String // source file?
  val NoPosition = ""

  definitions.AnyValClass // force it.

  type TreeAnnotation = Position
  def NoTreeAnnotation: TreeAnnotation = NoPosition
  def positionToAnnotation(pos: Position): TreeAnnotation = pos // TODO
  def annotationToPosition(annot: TreeAnnotation): Position = annot //TODO

  // establish root association to avoid cyclic dependency errors later
  classToScala(classOf[java.lang.Object]).initialize

//  println("initializing definitions")
  definitions.init()

}