summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/internal/StdNames.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-01-20 01:52:40 +0100
committerEugene Burmako <xeno.by@gmail.com>2012-01-20 06:54:20 +0100
commit35e676ded0f9bfd006a5f090841abdea3ff1759c (patch)
treeade8247e0ebc66964189875194f78b85c6596d27 /src/compiler/scala/reflect/internal/StdNames.scala
parent58cb15c40dc431e45eaa0a5278874d9996e42104 (diff)
downloadscala-35e676ded0f9bfd006a5f090841abdea3ff1759c.tar.gz
scala-35e676ded0f9bfd006a5f090841abdea3ff1759c.tar.bz2
scala-35e676ded0f9bfd006a5f090841abdea3ff1759c.zip
Progress with macros
A short recap: * Macro expansion now works finely for instance macro invocations * Macros are now hidden behind -Xmacros * Bodies of macros now have "import _context._" in their preamble * Macros are now loaded from classpath, much like regular libraries * Macros can now override methods (in that case macro expansion does not crash if macro is not found, it just falls back to super) Review by @odersky.
Diffstat (limited to 'src/compiler/scala/reflect/internal/StdNames.scala')
-rw-r--r--src/compiler/scala/reflect/internal/StdNames.scala29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/compiler/scala/reflect/internal/StdNames.scala b/src/compiler/scala/reflect/internal/StdNames.scala
index 507621ea42..aba00088f9 100644
--- a/src/compiler/scala/reflect/internal/StdNames.scala
+++ b/src/compiler/scala/reflect/internal/StdNames.scala
@@ -13,7 +13,7 @@ import annotation.switch
trait StdNames extends NameManglers { self: SymbolTable =>
def encode(str: String): TermName = newTermNameCached(NameTransformer.encode(str))
-
+
implicit def lowerTermNames(n: TermName): String = "" + n
// implicit def stringToTermName(s: String): TermName = newTermName(s)
@@ -182,7 +182,7 @@ trait StdNames extends NameManglers { self: SymbolTable =>
trait TermNames extends Keywords with CommonNames {
// Compiler internal names
val EXPAND_SEPARATOR_STRING = "$$"
-
+
val ANYNAME: NameType = "<anyname>"
val CONSTRUCTOR: NameType = "<init>"
val FAKE_LOCAL_THIS: NameType = "this$"
@@ -207,7 +207,7 @@ trait StdNames extends NameManglers { self: SymbolTable =>
final val Predef: NameType = "Predef"
final val ScalaRunTime: NameType = "ScalaRunTime"
final val Some: NameType = "Some"
-
+
val _1 : NameType = "_1"
val _2 : NameType = "_2"
val _3 : NameType = "_3"
@@ -301,6 +301,8 @@ trait StdNames extends NameManglers { self: SymbolTable =>
val classOf: NameType = "classOf"
val clone_ : NameType = if (forMSIL) "MemberwiseClone" else "clone" // sn.OClone causes checkinit failure
val conforms: NameType = "conforms"
+ val context : NameType = "_context"
+ val contextImplicit : NameType = "$context"
val copy: NameType = "copy"
val delayedInit: NameType = "delayedInit"
val delayedInitArg: NameType = "delayedInit$body"
@@ -324,7 +326,6 @@ trait StdNames extends NameManglers { self: SymbolTable =>
val freeValue : NameType = "freeValue"
val genericArrayOps: NameType = "genericArrayOps"
val get: NameType = "get"
- val glob : NameType = "glob"
val hasNext: NameType = "hasNext"
val hashCode_ : NameType = if (forMSIL) "GetHashCode" else "hashCode"
val hash_ : NameType = "hash"
@@ -430,7 +431,7 @@ trait StdNames extends NameManglers { self: SymbolTable =>
val REFINE_CLASS_NAME: NameType = "<refinement>"
val ANON_CLASS_NAME: NameType = "$anon"
}
-
+
/** For fully qualified type names.
*/
object fulltpnme extends TypeNames {
@@ -450,11 +451,11 @@ trait StdNames extends NameManglers { self: SymbolTable =>
val RuntimeNothing = toBinary(fulltpnme.RuntimeNothing).toTypeName
val RuntimeNull = toBinary(fulltpnme.RuntimeNull).toTypeName
}
-
+
object fullnme extends TermNames {
type NameType = TermName
protected implicit def createNameType(name: String): TermName = newTermNameCached(name)
-
+
val MirrorPackage: NameType = "scala.reflect.mirror"
}
@@ -516,7 +517,7 @@ trait StdNames extends NameManglers { self: SymbolTable =>
def moduleVarName(name: TermName): TermName =
newTermNameCached("" + name + MODULE_VAR_SUFFIX)
-
+
val ROOTPKG: TermName = "_root_"
/** Base strings from which synthetic names are derived. */
@@ -531,7 +532,7 @@ trait StdNames extends NameManglers { self: SymbolTable =>
val INTERPRETER_VAR_PREFIX = "res"
val INTERPRETER_WRAPPER_SUFFIX = "$object"
val WHILE_PREFIX = "while$"
-
+
val EQEQ_LOCAL_VAR: TermName = newTermName(EQEQ_LOCAL_VAR_STRING)
def getCause = sn.GetCause
@@ -568,18 +569,18 @@ trait StdNames extends NameManglers { self: SymbolTable =>
val UNARY_+ = encode("unary_+")
val UNARY_- = encode("unary_-")
val UNARY_! = encode("unary_!")
-
+
// Grouped here so Cleanup knows what tests to perform.
val CommonOpNames = Set[Name](OR, XOR, AND, EQ, NE)
val ConversionNames = Set[Name](toByte, toChar, toDouble, toFloat, toInt, toLong, toShort)
val BooleanOpNames = Set[Name](ZOR, ZAND, UNARY_!) ++ CommonOpNames
val NumberOpNames = (
- Set[Name](ADD, SUB, MUL, DIV, MOD, LSL, LSR, ASR, LT, LE, GE, GT)
- ++ Set(UNARY_+, UNARY_-, UNARY_!)
+ Set[Name](ADD, SUB, MUL, DIV, MOD, LSL, LSR, ASR, LT, LE, GE, GT)
+ ++ Set(UNARY_+, UNARY_-, UNARY_!)
++ ConversionNames
++ CommonOpNames
)
-
+
val add: NameType = "add"
val complement: NameType = "complement"
val divide: NameType = "divide"
@@ -670,7 +671,7 @@ trait StdNames extends NameManglers { self: SymbolTable =>
reflMethodName
)
def isReflectionCacheName(name: Name) = reflectionCacheNames exists (name startsWith _)
-
+
@switch def productAccessorName(j: Int): TermName = j match {
case 1 => nme._1
case 2 => nme._2