summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/api/StandardNames.scala
blob: 36ba840c84661d7e7077dba5cf69280028ff0d98 (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
/* NSC -- new Scala compiler
* Copyright 2005-2012 LAMP/EPFL
* @author  Martin Odersky
*/
package scala.reflect
package api

// Q: I have a pretty name. Can I put it here?
// A: Is it necessary to construct trees (like EMPTY or WILDCARD_STAR)? If yes, then sure.
//    Is it necessary to perform reflection (like ERROR or LOCAL_SUFFIX_STRING)? If yes, then sure.
//    Otherwise you'd better not - reflection API should stay minimalistic.

// TODO: document better
/**
 * Names necessary to create Scala trees.
 */
trait StandardNames {
  self: Universe =>

  val nme: TermNamesApi
  val tpnme: TypeNamesApi

  trait NamesApi {
    type NameType >: Null <: Name
    val WILDCARD: NameType
    val EMPTY: NameType
    val ERROR: NameType
    val PACKAGE: NameType
  }

  trait TermNamesApi extends NamesApi {
    type NameType = TermName
    val CONSTRUCTOR: NameType
    val ROOTPKG: NameType
    val LOCAL_SUFFIX_STRING: String
  }

  trait TypeNamesApi extends NamesApi {
    type NameType = TypeName
    val WILDCARD_STAR: NameType
  }
}