summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-08 02:36:10 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:32:28 +0200
commit0b2f1bcf75d31c59b25e19eebcb80f39c155365b (patch)
tree8d9dfc50ef01ca48c068b232af7e67a723325388 /src/library
parent13213e3df0384b1fd815c0798758a22284572cdb (diff)
downloadscala-0b2f1bcf75d31c59b25e19eebcb80f39c155365b.tar.gz
scala-0b2f1bcf75d31c59b25e19eebcb80f39c155365b.tar.bz2
scala-0b2f1bcf75d31c59b25e19eebcb80f39c155365b.zip
Introduces scala-reflect.jar
Diffstat (limited to 'src/library')
-rwxr-xr-xsrc/library/scala/reflect/api/AnnotationInfos.scala27
-rwxr-xr-xsrc/library/scala/reflect/api/Constants.scala33
-rw-r--r--src/library/scala/reflect/api/Exprs.scala62
-rw-r--r--src/library/scala/reflect/api/FlagSets.scala112
-rw-r--r--src/library/scala/reflect/api/FrontEnds.scala72
-rw-r--r--src/library/scala/reflect/api/Importers.scala21
-rw-r--r--src/library/scala/reflect/api/Mirrors.scala213
-rwxr-xr-xsrc/library/scala/reflect/api/Names.scala44
-rw-r--r--src/library/scala/reflect/api/Positions.scala196
-rwxr-xr-xsrc/library/scala/reflect/api/StandardDefinitions.scala48
-rw-r--r--src/library/scala/reflect/api/StandardNames.scala163
-rwxr-xr-xsrc/library/scala/reflect/api/Symbols.scala268
-rw-r--r--src/library/scala/reflect/api/TreePrinters.scala87
-rw-r--r--src/library/scala/reflect/api/Trees.scala689
-rwxr-xr-xsrc/library/scala/reflect/api/Types.scala368
-rwxr-xr-xsrc/library/scala/reflect/api/Universe.scala68
-rw-r--r--src/library/scala/reflect/api/package.scala12
-rw-r--r--src/library/scala/reflect/makro/Aliases.scala27
-rw-r--r--src/library/scala/reflect/makro/CapturedVariables.scala21
-rw-r--r--src/library/scala/reflect/makro/Context.scala40
-rw-r--r--src/library/scala/reflect/makro/Enclosures.scala54
-rw-r--r--src/library/scala/reflect/makro/Evals.scala9
-rw-r--r--src/library/scala/reflect/makro/ExprUtils.scala32
-rw-r--r--src/library/scala/reflect/makro/Exprs.scala8
-rw-r--r--src/library/scala/reflect/makro/FrontEnds.scala42
-rw-r--r--src/library/scala/reflect/makro/Infrastructure.scala103
-rw-r--r--src/library/scala/reflect/makro/Names.scala15
-rw-r--r--src/library/scala/reflect/makro/Parsers.scala18
-rw-r--r--src/library/scala/reflect/makro/Reifiers.scala91
-rw-r--r--src/library/scala/reflect/makro/Settings.scala40
-rw-r--r--src/library/scala/reflect/makro/TreeBuilder.scala60
-rw-r--r--src/library/scala/reflect/makro/TypeTags.scala9
-rw-r--r--src/library/scala/reflect/makro/Typers.scala86
-rw-r--r--src/library/scala/reflect/makro/Universe.scala118
-rw-r--r--src/library/scala/reflect/makro/package.scala6
35 files changed, 0 insertions, 3262 deletions
diff --git a/src/library/scala/reflect/api/AnnotationInfos.scala b/src/library/scala/reflect/api/AnnotationInfos.scala
deleted file mode 100755
index d9f35024d9..0000000000
--- a/src/library/scala/reflect/api/AnnotationInfos.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-package scala.reflect
-package api
-
-trait AnnotationInfos extends base.AnnotationInfos { self: Universe =>
-
- override type AnnotationInfo >: Null <: AnyRef with AnnotationInfoApi
- trait AnnotationInfoApi {
- def atp: Type
- def args: List[Tree]
- def assocs: List[(Name, ClassfileAnnotArg)]
- }
-
- override type LiteralAnnotArg >: Null <: ClassfileAnnotArg with LiteralAnnotArgApi
- trait LiteralAnnotArgApi {
- def const: Constant
- }
-
- override type ArrayAnnotArg >: Null <: ClassfileAnnotArg with ArrayAnnotArgApi
- trait ArrayAnnotArgApi {
- def args: Array[ClassfileAnnotArg]
- }
-
- override type NestedAnnotArg >: Null <: ClassfileAnnotArg with NestedAnnotArgApi
- trait NestedAnnotArgApi {
- def annInfo: AnnotationInfo
- }
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/api/Constants.scala b/src/library/scala/reflect/api/Constants.scala
deleted file mode 100755
index 7862ab0d25..0000000000
--- a/src/library/scala/reflect/api/Constants.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Martin Odersky
- */
-
-package scala.reflect
-package api
-
-trait Constants extends base.Constants {
- self: Universe =>
-
- override type Constant >: Null <: AnyRef with ConstantApi
-
- abstract class ConstantApi {
- val value: Any
- def tpe: Type
- def isNaN: Boolean
-
- def booleanValue: Boolean
- def byteValue: Byte
- def shortValue: Short
- def charValue: Char
- def intValue: Int
- def longValue: Long
- def floatValue: Float
- def doubleValue: Double
- def stringValue: String
- def typeValue: Type
- def symbolValue: Symbol
-
- def convertTo(pt: Type): Constant
- }
-}
diff --git a/src/library/scala/reflect/api/Exprs.scala b/src/library/scala/reflect/api/Exprs.scala
deleted file mode 100644
index bda125a1a1..0000000000
--- a/src/library/scala/reflect/api/Exprs.scala
+++ /dev/null
@@ -1,62 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Martin Odersky
- */
-
-package scala.reflect
-package api
-
-import scala.reflect.base.TreeCreator
-
-trait Exprs { self: Universe =>
-
- /** An expression tree tagged with its type */
- trait Expr[+T] extends Equals with Serializable {
- val mirror: Mirror
- def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # Expr[T]
-
- def tree: Tree
- def staticTpe: Type
- def actualTpe: Type
-
- def splice: T
- val value: T
-
- /** case class accessories */
- override def canEqual(x: Any) = x.isInstanceOf[Expr[_]]
- override def equals(x: Any) = x.isInstanceOf[Expr[_]] && this.mirror == x.asInstanceOf[Expr[_]].mirror && this.tree == x.asInstanceOf[Expr[_]].tree
- override def hashCode = mirror.hashCode * 31 + tree.hashCode
- override def toString = "Expr["+staticTpe+"]("+tree+")"
- }
-
- object Expr {
- def apply[T: TypeTag](mirror: MirrorOf[self.type], treec: TreeCreator): Expr[T] = new ExprImpl[T](mirror.asInstanceOf[Mirror], treec)
- def unapply[T](expr: Expr[T]): Option[Tree] = Some(expr.tree)
- }
-
- private class ExprImpl[+T: TypeTag](val mirror: Mirror, val treec: TreeCreator) extends Expr[T] {
- def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # Expr[T] = {
- val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]]
- val tag1 = (implicitly[TypeTag[T]] in otherMirror).asInstanceOf[otherMirror.universe.TypeTag[T]]
- otherMirror.universe.Expr[T](otherMirror1, treec)(tag1)
- }
-
- lazy val tree: Tree = treec[Exprs.this.type](mirror)
- // [Eugene++] this is important
- // !!! remove when we have improved type inference for singletons
- // search for .type] to find other instances
- lazy val staticTpe: Type = implicitly[TypeTag[T]].tpe
- def actualTpe: Type = tree.tpe
-
- def splice: T = throw new UnsupportedOperationException("""
- |the function you're calling has not been spliced by the compiler.
- |this means there is a cross-stage evaluation involved, and it needs to be invoked explicitly.
- |if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
- |import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.""".trim.stripMargin)
- lazy val value: T = throw new UnsupportedOperationException("""
- |the value you're calling is only meant to be used in cross-stage path-dependent types.
- |if you want to splice the underlying expression, use `<your expr>.splice`.
- |if you want to get a value of the underlying expression, add scala-compiler.jar to the classpath,
- |import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.""".trim.stripMargin)
- }
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/api/FlagSets.scala b/src/library/scala/reflect/api/FlagSets.scala
deleted file mode 100644
index 969176d641..0000000000
--- a/src/library/scala/reflect/api/FlagSets.scala
+++ /dev/null
@@ -1,112 +0,0 @@
-package scala.reflect
-package api
-
-import scala.language.implicitConversions
-
-trait FlagSets { self: Universe =>
-
- type FlagSet
-
- trait FlagOps extends Any {
- def | (right: FlagSet): FlagSet
- def & (right: FlagSet): FlagSet
- def containsAll (right: FlagSet): Boolean
- }
-
- implicit def addFlagOps(left: FlagSet): FlagOps
-
- val Flag: FlagValues
-
- type FlagValues >: Null <: FlagValuesApi
-
- // [Eugene++] any other flags we would like to expose?
-
- trait FlagValuesApi {
-
- /** Flag indicating that symbol or tree represents a trait */
- val TRAIT: FlagSet
-
- /** Flag indicating that symbol or tree represents a module or its internal module class */
- val MODULE: FlagSet
-
- /** Flag indicating that symbol or tree represents a mutable variable */
- val MUTABLE: FlagSet
-
- /** Flag indicating that symbol or tree represents a package or its internal package class */
- val PACKAGE: FlagSet
-
- /** Flag indicating that symbol or tree represents a method */
- val METHOD: FlagSet
-
- /** Flag indicating that symbol or tree represents a macro definition. */
- val MACRO: FlagSet
-
- /** Flag indicating that symbol or tree represents an abstract type, method, or value */
- val DEFERRED: FlagSet
-
- /** Flag indicating that symbol or tree represents an abstract class */
- val ABSTRACT: FlagSet
-
- /** Flag indicating that symbol or tree has `final` modifier set */
- val FINAL: FlagSet
-
- /** Flag indicating that symbol or tree has `sealed` modifier set */
- val SEALED: FlagSet
-
- /** Flag indicating that symbol or tree has `implicit` modifier set */
- val IMPLICIT: FlagSet
-
- /** Flag indicating that symbol or tree has `lazy` modifier set */
- val LAZY: FlagSet
-
- /** Flag indicating that symbol or tree has `override` modifier set */
- val OVERRIDE: FlagSet
-
- /** Flag indicating that symbol or tree has `private` modifier set */
- val PRIVATE: FlagSet
-
- /** Flag indicating that symbol or tree has `protected` modifier set */
- val PROTECTED: FlagSet
-
- /** Flag indicating that symbol or tree has `case` modifier set */
- val CASE: FlagSet
-
- /** Flag indicating that symbol or tree has `abstract` and `override` modifiers set */
- val ABSOVERRIDE: FlagSet
-
- /** Flag indicating that symbol or tree represents a by-name parameter */
- val BYNAMEPARAM: FlagSet
-
- /** Flag indicating that symbol or tree represents a class or parameter.
- * Both type and value parameters carry the flag. */
- val PARAM: FlagSet
-
- /** Flag indicating that symbol or tree represents a field of a class
- * that was generated from a parameter of that class */
- val PARAMACCESSOR: FlagSet
-
- /** Flag indicating that symbol or tree represents a field of a case class
- * that corresponds to a parameter in the first parameter list of the
- * primary constructor of that class */
- val CASEACCESSOR: FlagSet
-
- /** Flag indicating that symbol or tree represents a contravariant
- * type parameter (marked with `+`). */
- val COVARIANT: FlagSet
-
- /** Flag indicating that symbol or tree represents a contravariant
- * type parameter (marked with `-`). */
- val CONTRAVARIANT: FlagSet
-
- /** Flag indicating that parameter has a default value */
- val DEFAULTPARAM: FlagSet
-
- /** Flag indicating that trait has neither method implementations nor fields.
- * This means the trait can be represented as a Java interface. */
- val INTERFACE: FlagSet
-
- def union(flags: FlagSet*): FlagSet
- def intersection(flag: FlagSet*): FlagSet
- def containsAll(superset: FlagSet, subset: FlagSet): Boolean
- }
-}
diff --git a/src/library/scala/reflect/api/FrontEnds.scala b/src/library/scala/reflect/api/FrontEnds.scala
deleted file mode 100644
index a201b83444..0000000000
--- a/src/library/scala/reflect/api/FrontEnds.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-package scala.reflect
-package api
-
-// [Martin to Eugene] Todo: Needs to be evicted from API
-// [Eugene++ to Martin] but how? we need them for macros
-trait FrontEnds {
-
- type Position >: Null
-
- trait FrontEnd {
- object severity extends Enumeration
- class Severity(val id: Int) extends severity.Value {
- var count: Int = 0
- override def toString() = this match {
- case INFO => "INFO"
- case WARNING => "WARNING"
- case ERROR => "ERROR"
- case _ => "<unknown>"
- }
- }
- val INFO = new Severity(0)
- val WARNING = new Severity(1)
- val ERROR = new Severity(2)
-
- def hasErrors = ERROR.count > 0
- def hasWarnings = WARNING.count > 0
-
- case class Info(val pos: Position, val msg: String, val severity: Severity)
- val infos = new collection.mutable.LinkedHashSet[Info]
-
- /** Handles incoming info */
- def log(pos: Position, msg: String, severity: Severity) {
- infos += new Info(pos, msg, severity)
- severity.count += 1
- display(infos.last)
- }
-
- /** Displays incoming info */
- def display(info: Info): Unit
-
- /** Services a request to drop into interactive mode */
- def interactive(): Unit
-
- /** Refreshes the UI */
- def flush(): Unit = {}
-
- /** Resets the reporter */
- def reset(): Unit = {
- INFO.count = 0
- WARNING.count = 0
- ERROR.count = 0
- infos.clear()
- }
- }
-
- class SilentFrontEnd extends FrontEnd {
- def display(info: Info) {}
- def interactive() {}
- }
-
- /** Creates a UI-less reporter that simply accumulates all the messages
- */
- def mkSilentFrontEnd(): FrontEnd = new SilentFrontEnd()
-
- /** Creates a reporter that prints messages to the console according to the settings.
- *
- * ``minSeverity'' determines minimum severity of the messages to be printed.
- * 0 stands for INFO, 1 stands for WARNING and 2 stands for ERROR.
- */
- // todo. untangle warningsAsErrors from Reporters. I don't feel like moving this flag here!
- def mkConsoleFrontEnd(minSeverity: Int = 1): FrontEnd
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/api/Importers.scala b/src/library/scala/reflect/api/Importers.scala
deleted file mode 100644
index 69d6414f4f..0000000000
--- a/src/library/scala/reflect/api/Importers.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-package scala.reflect
-package api
-
-// [Martin] Importers need to be made mirror aware.
-// [Eugene++] this is important
-trait Importers { self: Universe =>
-
- def mkImporter(from0: Universe): Importer { val from: from0.type }
-
- trait Importer {
- val from: Universe
-
- val reverse: from.Importer { val from: self.type }
-
- def importSymbol(sym: from.Symbol): Symbol
-
- def importType(tpe: from.Type): Type
-
- def importTree(tree: from.Tree): Tree
- }
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/api/Mirrors.scala b/src/library/scala/reflect/api/Mirrors.scala
deleted file mode 100644
index 2fcee8f227..0000000000
--- a/src/library/scala/reflect/api/Mirrors.scala
+++ /dev/null
@@ -1,213 +0,0 @@
-package scala.reflect
-package api
-
-trait Mirrors { self: Universe =>
-
- type RuntimeClass >: Null
-
- // [Eugene++ to Martin] how do we reflect against inner classes?
- // presumably, we should add `reflectClass` to both InstanceMirror (inner classes) and TemplateMirror (nested classes)
- // in the former case, the resulting ClassMirror should remember the outer instance that spawned it to use it in reflective construction
-
- // [Eugene] also, it might make sense to provide shortcuts for the API
- //
- // for example, right now to invoke the same method for several different instances, you need:
- // 1) get the method symbol
- // 2) get the instance mirror for every instance
- // 3) call reflectMethod on the instance mirrors for every instance
- // 4) call apply for every instance (okay, this can be united with step #3, but still)
- //
- // I have several suggestions that we can discuss later:
- // 1) For every `reflectXXX(sym: Symbol): XXXMirror`, add `reflectXXX(name: String, types: Type*): XXXMirror` and `reflectXXXs(): List[XXXMirror]`
- // 2) Provide a way to skip obtaining InstanceMirror (step #2 in the outline provided above)
-
- // [Eugene] another improvement would be have mirrors reproduce the structure of the reflection domain
- // e.g. a ClassMirror could also have a list of fields, methods, constructors and so on
- // read up more on the proposed design in "Reflecting Scala" by Y. Coppel
-
- /** A mirror that reflects a runtime value */
- trait InstanceMirror {
-
- /** The instance value reflected by this mirror */
- def instance: Any
-
- /** The mirror corresponding to the run-time class of the reflected instance. */
- def reflectClass: ClassMirror
-
- /** Get value of field in reflected instance.
- * @field A field symbol that should represent a field of the instance class.
- * @return The value associated with that field in the reflected instance
- * @throws ???
- */
- def reflectField(field: TermSymbol): FieldMirror
-
- /** Invokes a method on the reflected instance.
- * @param meth A method symbol that should represent a method of the instance class
- * @param args The arguments to pass to the method
- * @return The result of invoking `meth(args)` on the reflected instance.
- * @throws ???
- */
- def reflectMethod(method: MethodSymbol): MethodMirror
- }
-
- /** A mirror that reflects a field */
- trait FieldMirror {
-
- /** The object containing the field */
- def receiver: AnyRef
-
- /** The field symbol representing the field */
- def field: TermSymbol
-
- /** Retrieves the value stored in the field */
- def get: Any
-
- /** Updates the value stored in the field */
- def set(value: Any): Unit
- }
-
- /** A mirror that reflects a method handle */
- trait MethodMirror {
-
- /** The receiver object of the method */
- def receiver: AnyRef
-
- /** The method symbol representing the method */
- def method: MethodSymbol
-
- /** The result of applying the method to the given arguments */
- def apply(args: Any*): Any
- }
-
- /** A mirror that reflects the instance or static parts of a runtime class */
- trait TemplateMirror {
-
- /** The runtime class reflected by this mirror */
- def runtimeClass: RuntimeClass
-
- /** True if the mirror represents the static part
- * if a runtime class or the companion object of a Scala class.
- * One has:
- *
- * this.isStatic == this.isInstanceOf[ModuleMirror]
- * !this.isStatic == this.isInstanceOf[ClassMirror]
- */
- def isStatic: Boolean
-
- /** The Scala symbol corresponding to the reflected runtime class or module. */
- def symbol: Symbol
-
- // [Eugene++ to Martin] I've removed `typeSignature`, because we can obtain it via `symbol.typeSignature`
-
- /** Optionally, the mirror of the companion reflected by this mirror.
- * If this mirror reflects a Scala object, the mirror for the companion class, or None
- * if the mirror represents a Scala object that comes without a class.
- * Otherwise, if the mirror represents the static part of a runtime class, the
- * mirror representing the instance part of the same class.
- * Otherwise, if the mirror represents a Scala instance class, the mirror for the companion
- * object of that class, or None if no such object exists.
- * Otherwise, if the mirror represents a runtime instance class, a mirror representing the static
- * part of the same class.
- */
- def companion: Option[TemplateMirror]
- }
-
- /** A mirror that reflects a Scala object definition or the static parts of a runtime class */
- trait ModuleMirror extends TemplateMirror {
-
- /** The Scala module symbol corresponding to the reflected module. */
- override def symbol: ModuleSymbol
-
- /** If the reflected runtime class corresponds to a Scala object definition,
- * returns the single instance representing that object.
- * If this mirror reflects the static part of a runtime class, returns `null`.
- */
- def instance: Any
-
- /** Optionally, the mirror of the companion class if the object reflected by this mirror.
- * If this mirror reflects a Scala object, the mirror for the companion class, or None
- * if the mirror represents a Scala object that comes without a class.
- * Otherwise, if the mirror represents the static part of a runtime class, the
- * mirror representing the instance part of the same class.
- */
- def companion: Option[ClassMirror]
- }
-
- /** A mirror that reflects the instance parts of a runtime class */
- trait ClassMirror extends TemplateMirror {
-
- /** The Scala class symbol corresponding to the reflected class. */
- override def symbol: ClassSymbol
-
- /** Returns a fresh instance of by invoking that constructor.
- * @throws InstantiationException if the class does not have a public
- * constructor with an empty parameter list.
- * @throws IllegalAccessException if the class or its constructor is not accessible.
- * @throws ExceptionInInitializerError if the initialization of the constructor fails.
- * @throws SecurityException if creating a new instance is not permitted.
- */
- def reflectConstructor(constructor: MethodSymbol): MethodMirror
-
- /** Optionally, the mirror of the companion object of the class reflected by this mirror.
- * If this mirror represents a Scala instance class, the mirror for the companion
- * object of that class, or None if no such object exists.
- * Otherwise, if the mirror represents a runtime instance class, a mirror representing the static
- * part of the same class.
- */
- def companion: Option[ModuleMirror]
- }
-
- /** The API of a mirror for a reflective universe */
- trait RuntimeMirror extends MirrorOf[Mirrors.this.type] { self =>
-
- /** A reflective mirror for the given object
- * @param obj An arbitrary value
- * @return The mirror for `obj`.
- */
- def reflect(obj: Any): InstanceMirror
-
- /** A reflective mirror for the given Runtime class
- * @param runtimeClass A Runtime class object
- * @return The mirror for `runtimeClass`
- */
- def reflectClass(runtimeClass: RuntimeClass): ClassMirror
-
- /** A reflective mirror for the Runtime class with the given name in the
- * current classloader.
- * @param name The fully qualified name of the class
- * @return The mirror for the runtime class with fully qualified name
- * `name` in the current class loader.
- * @throws java.lang.ClassNotFoundException if no class with that name exists
- * to do: throws anything else?
- */
- def reflectClass(fullName: String): ClassMirror
-
- /** A reflective mirror for the given Runtime class
- * @param runtimeClass A Runtime class object
- * @return The mirror for `runtimeClass`
- */
- def reflectModule(runtimeClass: RuntimeClass): ModuleMirror
-
- /** A reflective mirror for the Runtime class with the given name in the
- * current classloader.
- * @param name The fully qualified name of the class
- * @return The mirror for the runtime class with fully qualified name
- * `name` in the current class loader.
- * @throws java.lang.ClassNotFoundException if no class with that name exists
- * to do: throws anything else?
- */
- def reflectModule(fullName: String): ModuleMirror
-
- /** Maps a Scala type to the corresponding Java class object
- */
- def runtimeClass(tpe: Type): RuntimeClass
-
- /** Maps a Scala class symbol to the corresponding Java class object
- * @throws ClassNotFoundException if there is no Java class
- * corresponding to the given Scala class symbol.
- * Note: If the Scala symbol is ArrayClass, a ClassNotFound exception is thrown
- * because there is no unique Java class corresponding to a Scala generic array
- */
- def runtimeClass(cls: ClassSymbol): RuntimeClass
- }
-}
diff --git a/src/library/scala/reflect/api/Names.scala b/src/library/scala/reflect/api/Names.scala
deleted file mode 100755
index 222ee5024b..0000000000
--- a/src/library/scala/reflect/api/Names.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-package scala.reflect
-package api
-
-/** A trait that manages names.
- * A name is a string in one of two name universes: terms and types.
- * The same string can be a name in both universes.
- * Two names are equal if they represent the same string and they are
- * members of the same universe.
- *
- * Names are interned. That is, for two names `name11 and `name2`,
- * `name1 == name2` implies `name1 eq name2`.
- */
-trait Names extends base.Names {
-
- /** The abstract type of names */
- type Name >: Null <: NameApi
-
- /** The extended API of names that's supported on reflect mirror via an
- * implicit conversion in reflect.ops
- */
- abstract class NameApi extends NameBase {
-
- // [Eugene++] this functionality should be in base
- // this is because stuff will be reified in mangled state, and people will need a way to figure it out
-
- /** Replaces all occurrences of \$op_names in this name by corresponding operator symbols.
- * Example: `foo_\$plus\$eq` becomes `foo_+=`
- */
- def decoded: String
-
- /** Replaces all occurrences of operator symbols in this name by corresponding \$op_names.
- * Example: `foo_+=` becomes `foo_\$plus\$eq`.
- */
- def encoded: String
-
- /** The decoded name, still represented as a name.
- */
- def decodedName: Name
-
- /** The encoded name, still represented as a name.
- */
- def encodedName: Name
- }
-}
diff --git a/src/library/scala/reflect/api/Positions.scala b/src/library/scala/reflect/api/Positions.scala
deleted file mode 100644
index 9d3d90d9f8..0000000000
--- a/src/library/scala/reflect/api/Positions.scala
+++ /dev/null
@@ -1,196 +0,0 @@
-package scala.reflect
-package api
-
-trait Positions extends base.Positions {
- self: Universe =>
-
- /** .. */
- type Position >: Null <: PositionApi { type Pos = Position }
-
- /** A position that wraps a set of trees.
- * The point of the wrapping position is the point of the default position.
- * If some of the trees are ranges, returns a range position enclosing all ranges
- * Otherwise returns default position.
- */
- def wrappingPos(default: Position, trees: List[Tree]): Position
-
- /** A position that wraps the non-empty set of trees.
- * The point of the wrapping position is the point of the first trees' position.
- * If all some the trees are non-synthetic, returns a range position enclosing the non-synthetic trees
- * Otherwise returns a synthetic offset position to point.
- */
- def wrappingPos(trees: List[Tree]): Position
-
- /** Ensure that given tree has no positions that overlap with
- * any of the positions of `others`. This is done by
- * shortening the range or assigning TransparentPositions
- * to some of the nodes in `tree`.
- */
- //def ensureNonOverlapping(tree: Tree, others: List[Tree])
- // [Eugene++] can this method be of use for macros?
-}
-
-/** The Position class and its subclasses represent positions of ASTs and symbols.
- * Except for NoPosition and FakePos, every position refers to a SourceFile
- * and to an offset in the sourcefile (its `point`). For batch compilation,
- * that's all. For interactive IDE's there are also RangePositions
- * and TransparentPositions. A RangePosition indicates a start and an end
- * in addition to its point. TransparentPositions are a subclass of RangePositions.
- * Range positions that are not transparent are called opaque.
- * Trees with RangePositions need to satisfy the following invariants.
- *
- * INV1: A tree with an offset position never contains a child
- * with a range position
- * INV2: If the child of a tree with a range position also has a range position,
- * then the child's range is contained in the parent's range.
- * INV3: Opaque range positions of children of the same node are non-overlapping
- * (this means their overlap is at most a single point).
- *
- * The following tests are useful on positions:
- *
- * pos.isDefined true if position is not a NoPosition nor a FakePosition
- * pos.isRange true if position is a range
- * pos.isOpaqueRange true if position is an opaque range
- *
- * The following accessor methods are provided:
- *
- * pos.source The source file of the position, which must be defined
- * pos.point The offset of the position's point, which must be defined
- * pos.start The start of the position, which must be a range
- * pos.end The end of the position, which must be a range
- *
- * There are also convenience methods, such as
- *
- * pos.startOrPoint
- * pos.endOrPoint
- * pos.pointOrElse(default)
- *
- * These are less strict about the kind of position on which they can be applied.
- *
- * The following conversion methods are often used:
- *
- * pos.focus converts a range position to an offset position, keeping its point;
- * returns all other positions unchanged.
- * pos.makeTransparent converts an opaque range position into a transparent one.
- * returns all other positions unchanged.
- */
-trait PositionApi extends Attachments {
-
- type Pos >: Null <: PositionApi
-
- /** Java file corresponding to the source file of this position.
- */
- def fileInfo: java.io.File
-
- /** Content of the source file that contains this position.
- */
- def fileContent: Array[Char]
-
- /** Is this position neither a NoPosition nor a FakePosition?
- * If isDefined is true, offset and source are both defined.
- */
- def isDefined: Boolean
-
- /** Is this position a range position? */
- def isRange: Boolean
-
- /** Is this position a transparent position? */
- def isTransparent: Boolean
-
- /** Is this position a non-transparent range position? */
- def isOpaqueRange: Boolean
-
- /** if opaque range, make this position transparent */
- def makeTransparent: Pos
-
- /** The start of the position's range, error if not a range position */
- def start: Int
-
- /** The start of the position's range, or point if not a range position */
- def startOrPoint: Int
-
- /** The point (where the ^ is) of the position */
- def point: Int
-
- /** The point (where the ^ is) of the position, or else `default` if undefined */
- def pointOrElse(default: Int): Int
-
- /** The end of the position's range, error if not a range position */
- def end: Int
-
- /** The end of the position's range, or point if not a range position */
- def endOrPoint: Int
-
- /** The same position with a different start value (if a range) */
- def withStart(off: Int): Pos
-
- /** The same position with a different end value (if a range) */
- def withEnd(off: Int): Pos
-
- /** The same position with a different point value (if a range or offset) */
- def withPoint(off: Int): Pos
-
- /** If this is a range, the union with the other range, with the point of this position.
- * Otherwise, this position
- */
- def union(pos: Pos): Pos
-
- /** If this is a range position, the offset position of its point.
- * Otherwise the position itself
- */
- def focus: Pos
-
- /** If this is a range position, the offset position of its start.
- * Otherwise the position itself
- */
- def focusStart: Pos
-
- /** If this is a range position, the offset position of its end.
- * Otherwise the position itself
- */
- def focusEnd: Pos
-
- /** Does this position include the given position `pos`.
- * This holds if `this` is a range position and its range [start..end]
- * is the same or covers the range of the given position, which may or may not be a range position.
- */
- def includes(pos: Pos): Boolean
-
- /** Does this position properly include the given position `pos` ("properly" meaning their
- * ranges are not the same)?
- */
- def properlyIncludes(pos: Pos): Boolean
-
- /** Does this position precede that position?
- * This holds if both positions are defined and the end point of this position
- * is not larger than the start point of the given position.
- */
- def precedes(pos: Pos): Boolean
-
- /** Does this position properly precede the given position `pos` ("properly" meaning their ranges
- * do not share a common point).
- */
- def properlyPrecedes(pos: Pos): Boolean
-
- /** Does this position overlap with that position?
- * This holds if both positions are ranges and there is an interval of
- * non-zero length that is shared by both position ranges.
- */
- def overlaps(pos: Pos): Boolean
-
- /** Does this position cover the same range as that position?
- * Holds only if both position are ranges
- */
- def sameRange(pos: Pos): Boolean
-
- def line: Int
-
- def column: Int
-
- /** Convert this to a position around `point` that spans a single source line */
- def toSingleLine: Pos
-
- def lineContent: String
-
- def show: String
-}
diff --git a/src/library/scala/reflect/api/StandardDefinitions.scala b/src/library/scala/reflect/api/StandardDefinitions.scala
deleted file mode 100755
index c2a89f92dd..0000000000
--- a/src/library/scala/reflect/api/StandardDefinitions.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Martin Odersky
- */
-package scala.reflect
-package api
-
-trait StandardDefinitions extends base.StandardDefinitions {
- self: Universe =>
-
- val definitions: DefinitionsApi
-
- trait DefinitionsApi extends DefinitionsBase {
- def JavaLangPackageClass: ClassSymbol
- def JavaLangPackage: ModuleSymbol
- def ArrayModule: ModuleSymbol
- def ArrayModule_overloadedApply: TermSymbol // todo. fix the bug in Definitions.getMemberMethod
- def Array_apply: TermSymbol // todo. fix the bug in Definitions.getMemberMethod
- def Array_clone: TermSymbol // todo. fix the bug in Definitions.getMemberMethod
- def Array_length: TermSymbol // todo. fix the bug in Definitions.getMemberMethod
- def Array_update: TermSymbol // todo. fix the bug in Definitions.getMemberMethod
- def ByNameParamClass: ClassSymbol
- def ConsClass: ClassSymbol
- def FunctionClass : Array[ClassSymbol]
- def IterableClass: ClassSymbol
- def IteratorClass: ClassSymbol
- def IteratorModule: ModuleSymbol
- def Iterator_apply: TermSymbol // todo. fix the bug in Definitions.getMemberMethod
- def JavaRepeatedParamClass: ClassSymbol
- def ListModule: ModuleSymbol
- def List_apply: TermSymbol // todo. fix the bug in Definitions.getMemberMethod
- def NilModule: ModuleSymbol
- def NoneModule: ModuleSymbol
- def OptionClass: ClassSymbol
- def ProductClass : Array[ClassSymbol]
- def RepeatedParamClass: ClassSymbol
- def SeqClass: ClassSymbol
- def SeqModule: ModuleSymbol
- def SomeClass: ClassSymbol
- def SomeModule: ModuleSymbol
- def StringBuilderClass: ClassSymbol
- def SymbolClass : ClassSymbol
- def TraversableClass: ClassSymbol
- def TupleClass: Array[Symbol] // cannot make it Array[ClassSymbol], because TupleClass(0) is supposed to be NoSymbol. weird
- def ScalaPrimitiveValueClasses: List[ClassSymbol]
- def ScalaNumericValueClasses: List[ClassSymbol]
- }
-}
diff --git a/src/library/scala/reflect/api/StandardNames.scala b/src/library/scala/reflect/api/StandardNames.scala
deleted file mode 100644
index 9ec66b8531..0000000000
--- a/src/library/scala/reflect/api/StandardNames.scala
+++ /dev/null
@@ -1,163 +0,0 @@
-/* NSC -- new Scala compiler
-* Copyright 2005-2011 LAMP/EPFL
-* @author Martin Odersky
-*/
-package scala.reflect
-package api
-
-trait StandardNames extends base.StandardNames {
- self: Universe =>
-
- val nme: TermNamesApi
- val tpnme: TypeNamesApi
-
- trait NamesApi extends NamesBase {
- val ANON_CLASS_NAME: NameType
- val ANON_FUN_NAME: NameType
- val EMPTY: NameType
- val ERROR: NameType
- val IMPORT: NameType
- val MODULE_VAR_SUFFIX: NameType
- val PACKAGE: NameType
- val ROOT: NameType
- val SPECIALIZED_SUFFIX: NameType
-
- def flattenedName(segments: Name*): NameType
- }
-
- trait TermNamesApi extends NamesApi with TermNamesBase {
- val EXPAND_SEPARATOR_STRING: String
- val IMPL_CLASS_SUFFIX: String
- val INTERPRETER_IMPORT_WRAPPER: String
- val INTERPRETER_LINE_PREFIX: String
- val INTERPRETER_VAR_PREFIX: String
- val INTERPRETER_WRAPPER_SUFFIX: String
- val LOCALDUMMY_PREFIX: String
- val LOCAL_SUFFIX_STRING: String
- val MODULE_SUFFIX_NAME: TermName
- val NAME_JOIN_NAME: TermName
- val PROTECTED_PREFIX: String
- val PROTECTED_SET_PREFIX: String
- val SETTER_SUFFIX: TermName
- val SINGLETON_SUFFIX: String
- val SUPER_PREFIX_STRING: String
- val TRAIT_SETTER_SEPARATOR_STRING: String
-
- val ANYNAME: TermName
- val FAKE_LOCAL_THIS: TermName
- val INITIALIZER: TermName
- val LAZY_LOCAL: TermName
- val UNIVERSE_BUILD: NameType
- val UNIVERSE_BUILD_PREFIX: NameType
- val UNIVERSE_PREFIX: NameType
- val UNIVERSE_SHORT: NameType
- val MIRROR_PREFIX: NameType
- val MIRROR_SHORT: NameType
- val MIRROR_UNTYPED: NameType
- val REIFY_FREE_PREFIX: NameType
- val REIFY_FREE_THIS_SUFFIX: NameType
- val REIFY_FREE_VALUE_SUFFIX: NameType
- val REIFY_SYMDEF_PREFIX: NameType
- val MIXIN_CONSTRUCTOR: TermName
- val MODULE_INSTANCE_FIELD: TermName
- val OUTER: TermName
- val OUTER_LOCAL: TermName
- val OUTER_SYNTH: TermName
- val SELECTOR_DUMMY: TermName
- val SELF: TermName
- val SPECIALIZED_INSTANCE: TermName
- val STAR: TermName
- val THIS: TermName
-
- val BITMAP_NORMAL: TermName
- val BITMAP_TRANSIENT: TermName
- val BITMAP_CHECKINIT: TermName
- val BITMAP_CHECKINIT_TRANSIENT: TermName
-
- val ROOTPKG: TermName
-
- val ADD: TermName
- val AND: TermName
- val ASR: TermName
- val DIV: TermName
- val EQ: TermName
- val EQL: TermName
- val GE: TermName
- val GT: TermName
- val HASHHASH: TermName
- val LE: TermName
- val LSL: TermName
- val LSR: TermName
- val LT: TermName
- val MINUS: TermName
- val MOD: TermName
- val MUL: TermName
- val NE: TermName
- val OR: TermName
- val PLUS : TermName
- val SUB: TermName
- val XOR: TermName
- val ZAND: TermName
- val ZOR: TermName
-
- val UNARY_~ : TermName
- val UNARY_+ : TermName
- val UNARY_- : TermName
- val UNARY_! : TermName
-
- val ??? : TermName
-
- def isConstructorName(name: Name): Boolean
- def isExceptionResultName(name: Name): Boolean
- def isImplClassName(name: Name): Boolean
- def isLocalDummyName(name: Name): Boolean
- def isLocalName(name: Name): Boolean
- def isLoopHeaderLabel(name: Name): Boolean
- def isModuleName(name: Name): Boolean
- def isOpAssignmentName(name: Name): Boolean
- def isProtectedAccessorName(name: Name): Boolean
- def isReplWrapperName(name: Name): Boolean
- def isSetterName(name: Name): Boolean
- def isSingletonName(name: Name): Boolean
- def isSuperAccessorName(name: Name): Boolean
- def isTraitSetterName(name: Name): Boolean
-
- def defaultGetterName(name: Name, pos: Int): TermName
- def defaultGetterToMethod(name: Name): TermName
- def expandedName(name: TermName, base: Symbol, separator: String): TermName
- def expandedSetterName(name: TermName, base: Symbol): TermName
- def getterName(name: TermName): TermName
- def getterToLocal(name: TermName): TermName
- def getterToSetter(name: TermName): TermName
- def localDummyName(clazz: Symbol): TermName
- def localToGetter(name: TermName): TermName
- def protName(name: Name): TermName
- def protSetterName(name: Name): TermName
- def setterToGetter(name: TermName): TermName
- def superName(name: Name): TermName
-
- def dropLocalSuffix(name: Name): Name
- def originalName(name: Name): Name
- def stripModuleSuffix(name: Name): Name
- def unspecializedName(name: Name): Name
- def segments(name: String, assumeTerm: Boolean): List[Name]
- def splitSpecializedName(name: Name): (Name, String, String)
- }
-
- trait TypeNamesApi extends NamesApi with TypeNamesBase {
- val BYNAME_PARAM_CLASS_NAME: TypeName
- val EQUALS_PATTERN_NAME: TypeName
- val JAVA_REPEATED_PARAM_CLASS_NAME: TypeName
- val LOCAL_CHILD: TypeName
- val REFINE_CLASS_NAME: TypeName
- val REPEATED_PARAM_CLASS_NAME: TypeName
- val WILDCARD_STAR: TypeName
- val REIFY_TYPECREATOR_PREFIX: NameType
- val REIFY_TREECREATOR_PREFIX: NameType
-
- def dropSingletonName(name: Name): TypeName
- def implClassName(name: Name): TypeName
- def interfaceName(implname: Name): TypeName
- def singletonName(name: Name): TypeName
- }
-}
diff --git a/src/library/scala/reflect/api/Symbols.scala b/src/library/scala/reflect/api/Symbols.scala
deleted file mode 100755
index 1d266dc778..0000000000
--- a/src/library/scala/reflect/api/Symbols.scala
+++ /dev/null
@@ -1,268 +0,0 @@
-package scala.reflect
-package api
-
-trait Symbols extends base.Symbols { self: Universe =>
-
- override type Symbol >: Null <: SymbolApi
- override type TypeSymbol >: Null <: Symbol with TypeSymbolApi
- override type TermSymbol >: Null <: Symbol with TermSymbolApi
- override type MethodSymbol >: Null <: TermSymbol with MethodSymbolApi
- override type ModuleSymbol >: Null <: TermSymbol with ModuleSymbolApi
- override type ClassSymbol >: Null <: TypeSymbol with ClassSymbolApi
- override type FreeTermSymbol >: Null <: TermSymbol with FreeTermSymbolApi
- override type FreeTypeSymbol >: Null <: TypeSymbol with FreeTypeSymbolApi
-
- trait HasFlagsApi {
- def flags: FlagSet
- def hasFlag(fs: FlagSet): Boolean
- def hasAllFlags(fs: FlagSet): Boolean
- def flagString: String
- }
-
- /** The API of symbols */
- trait SymbolApi extends SymbolBase with HasFlagsApi { this: Symbol =>
-
- /** The position of this symbol
- */
- def pos: Position
-
- /** A list of annotations attached to this Symbol.
- */
- // [Eugene++] we cannot expose the `annotations` method because it doesn't auto-initialize a symbol (see SI-5423)
- // there was an idea to use the `isCompilerUniverse` flag and auto-initialize symbols in `annotations` whenever this flag is false
- // but it doesn't work, because the unpickler (that is shared between reflective universes and global universes) is very picky about initialization
- // scala.reflect.internal.Types$TypeError: bad reference while unpickling scala.collection.immutable.Nil: type Nothing not found in scala.type not found.
- // at scala.reflect.internal.pickling.UnPickler$Scan.toTypeError(UnPickler.scala:836)
- // at scala.reflect.internal.pickling.UnPickler$Scan$LazyTypeRef.complete(UnPickler.scala:849) // auto-initialize goes boom
- // at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1140)
- // at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1272) // this triggers auto-initialize
- // at scala.reflect.internal.Symbols$Symbol.annotations(Symbols.scala:1438) // unpickler first tries to get pre-existing annotations
- // at scala.reflect.internal.Symbols$Symbol.addAnnotation(Symbols.scala:1458) // unpickler tries to add the annotation being read
- // at scala.reflect.internal.pickling.UnPickler$Scan.readSymbolAnnotation(UnPickler.scala:489) // unpickler detects an annotation
- // at scala.reflect.internal.pickling.UnPickler$Scan.run(UnPickler.scala:88)
- // at scala.reflect.internal.pickling.UnPickler.unpickle(UnPickler.scala:37)
- // at scala.reflect.runtime.JavaMirrors$JavaMirror.unpickleClass(JavaMirrors.scala:253) // unpickle from within a reflexive mirror
- // def annotations: List[AnnotationInfo]
- def getAnnotations: List[AnnotationInfo]
-
- /** Whether this symbol carries an annotation for which the given
- * symbol is its typeSymbol.
- */
- def hasAnnotation(sym: Symbol): Boolean
-
- /** ...
- */
- def orElse(alt: => Symbol): Symbol
-
- /** ...
- */
- def filter(cond: Symbol => Boolean): Symbol
-
- /** If this is a NoSymbol, returns NoSymbol, otherwise
- * returns the result of applying `f` to this symbol.
- */
- def map(f: Symbol => Symbol): Symbol
-
- /** ...
- */
- def suchThat(cond: Symbol => Boolean): Symbol
-
- /**
- * Set when symbol has a modifier of the form private[X], NoSymbol otherwise.
- *
- * Access level encoding: there are three scala flags (PRIVATE, PROTECTED,
- * and LOCAL) which combine with value privateWithin (the "foo" in private[foo])
- * to define from where an entity can be accessed. The meanings are as follows:
- *
- * PRIVATE access restricted to class only.
- * PROTECTED access restricted to class and subclasses only.
- * LOCAL can only be set in conjunction with PRIVATE or PROTECTED.
- * Further restricts access to the same object instance.
- *
- * In addition, privateWithin can be used to set a visibility barrier.
- * When set, everything contained in the named enclosing package or class
- * has access. It is incompatible with PRIVATE or LOCAL, but is additive
- * with PROTECTED (i.e. if either the flags or privateWithin allow access,
- * then it is allowed.)
- *
- * The java access levels translate as follows:
- *
- * java private: hasFlag(PRIVATE) && (privateWithin == NoSymbol)
- * java package: !hasFlag(PRIVATE | PROTECTED) && (privateWithin == enclosingPackage)
- * java protected: hasFlag(PROTECTED) && (privateWithin == enclosingPackage)
- * java public: !hasFlag(PRIVATE | PROTECTED) && (privateWithin == NoSymbol)
- */
- def privateWithin: Symbol
-
- /** For a class: the module or case class factory with the same name in the same package.
- * For a module: the class with the same name in the same package.
- * For all others: NoSymbol
- */
- def companionSymbol: Symbol
-
- /** If this symbol is a package class, this symbol; otherwise the next enclosing
- * package class, or `NoSymbol` if none exists.
- */
- def enclosingPackageClass: Symbol
-
- /** If this symbol is a top-level class, this symbol; otherwise the next enclosing
- * top-level class, or `NoSymbol` if none exists.
- */
- def enclosingTopLevelClass: Symbol
-
- /** Does this symbol represent a value, i.e. not a module and not a method?
- * If yes, `isTerm` is also guaranteed to be true.
- * [Eugene++] I need a review of the implementation
- */
- def isValue: Boolean
-
- /** Does this symbol represent a mutable value?
- * If yes, `isTerm` and `isValue` are also guaranteed to be true.
- */
- def isVariable: Boolean
-
- /** Does this symbol represent the definition of a package?
- * If yes, `isTerm` is also guaranteed to be true.
- */
- def isPackage: Boolean
-
- /** Does this symbol represent a package class?
- * If yes, `isClass` is also guaranteed to be true.
- */
- def isPackageClass: Boolean
-
- /** Is this symbol an overloaded method?
- */
- def isOverloaded : Boolean
-
- /** Does this symbol represent the definition of a primitive class?
- * Namely, is it one of [[scala.Double]], [[scala.Float]], [[scala.Long]], [[scala.Int]], [[scala.Char]],
- * [[scala.Short]], [[scala.Byte]], [[scala.Unit]] or [[scala.Boolean]]?
- */
- def isPrimitiveValueClass: Boolean
-
- /** Does this symbol represent the definition of a numeric value class?
- * Namely, is it one of [[scala.Double]], [[scala.Float]], [[scala.Long]], [[scala.Int]], [[scala.Char]],
- * [[scala.Short]], [[scala.Byte]], [[scala.Unit]] or [[scala.Boolean]]?
- */
- def isNumericValueClass: Boolean
-
- /** Does this symbol represent the definition of a custom value class?
- * Namely, is AnyVal among its parent classes?
- * TODO: Why not just have in reflect.internal?
- * [Eugene++] because it's useful for macros
- */
- def isDerivedValueClass: Boolean
-
- /** Does this symbol represent the definition of a type alias?
- * If yes, `isType` is also guaranteed to be true.
- */
- def isAliasType : Boolean
-
- /** Does this symbol represent the definition of an abstract type?
- * If yes, `isType` is also guaranteed to be true.
- */
- def isAbstractType : Boolean
-
- /** Does this symbol represent an existentially bound type?
- * If yes, `isType` is also guaranteed to be true.
- */
- def isExistential : Boolean
-
- /** Does this symbol represent a free type captured by reification?
- */
- def isFreeType : Boolean
-
- /** Does this symbol or its underlying type represent a typechecking error?
- */
- def isErroneous : Boolean
-
- /** The type signature of this symbol seen as a member of given type `site`.
- */
- def typeSignatureIn(site: Type): Type
-
- /** The type signature of this symbol.
- * Note if the symbol is a member of a class, one almost always is interested
- * in `typeSignatureIn` with a site type instead.
- */
- def typeSignature: Type
-
- /** The string discriminator of this symbol; useful for debugging */
- def kind: String
- }
-
- /** The API of term symbols */
- trait TermSymbolApi extends SymbolApi with HasFlagsApi with TermSymbolBase { this: TermSymbol =>
- /** The overloaded alternatives of this symbol */
- def alternatives: List[Symbol]
-
- def resolveOverloaded(pre: Type = NoPrefix, targs: Seq[Type] = List(), actuals: Seq[Type]): Symbol
- }
-
- /** The API of type symbols */
- trait TypeSymbolApi extends SymbolApi with HasFlagsApi with TypeSymbolBase { this: TypeSymbol =>
- /** Is the type parameter represented by this symbol contravariant?
- */
- def isContravariant : Boolean
-
- /** Is the type parameter represented by this symbol contravariant?
- */
- def isCovariant : Boolean
-
- /** Does this symbol represent the definition of a skolem?
- * Skolems are used during typechecking to represent type parameters viewed from inside their scopes.
- * If yes, `isType` is also guaranteed to be true.
- */
- def isSkolem : Boolean
-
- /** A type reference that refers to this type symbol seen
- * as a member of given type `site`.
- */
- def asTypeIn(site: Type): Type
-
- /** A type reference that refers to this type symbol
- * Note if symbol is a member of a class, one almost always is interested
- * in `asTypeIn` with a site type instead.
- *
- * Example: Given a class declaration `class C[T] { ... } `, that generates a symbol
- * `C`. Then `C.asType` is the type `C[T]`.
- *
- * By contrast, `C.typeSignature` would be a type signature of form
- * `PolyType(ClassInfoType(...))` that describes type parameters, value
- * parameters, parent types, and members of `C`.
- */
- def asType: Type // !!! Same as typeSignature.
- }
-
- /** The API of method symbols */
- type MethodSymbolApi = MethodSymbolBase
-
- /** The API of module symbols */
- type ModuleSymbolApi = ModuleSymbolBase
-
- /** The API of class symbols */
- trait ClassSymbolApi extends TypeSymbolApi with ClassSymbolBase { this: ClassSymbol =>
- /** If this symbol is a class or trait, its self type, otherwise the type
- * of the symbol itself.
- */
- def selfType: Type
-
- /** The type `C.this`, where `C` is the current class */
- def thisPrefix: Type
- }
-
- /** The API of free term symbols */
- trait FreeTermSymbolApi extends TermSymbolApi with FreeTermSymbolBase { this: FreeTermSymbol =>
- /** The place where this symbol has been spawned */
- def origin: String
-
- /** The valus this symbol refers to */
- def value: Any
- }
-
- /** The API of free term symbols */
- trait FreeTypeSymbolApi extends TypeSymbolApi with FreeTypeSymbolBase { this: FreeTypeSymbol =>
- /** The place where this symbol has been spawned */
- def origin: String
- }
-}
diff --git a/src/library/scala/reflect/api/TreePrinters.scala b/src/library/scala/reflect/api/TreePrinters.scala
deleted file mode 100644
index 08a08e7b90..0000000000
--- a/src/library/scala/reflect/api/TreePrinters.scala
+++ /dev/null
@@ -1,87 +0,0 @@
-package scala.reflect
-package api
-
-import java.io.{ PrintWriter, StringWriter }
-
-trait TreePrinters { self: Universe =>
-
- trait TreePrinter {
- def print(args: Any*)
- protected var typesPrinted = false
- protected var uniqueIds = false
- def withTypesPrinted: this.type = { typesPrinted = true; this }
- def withUniqueIds: this.type = { uniqueIds = true; this }
- }
-
- def show(tree: Tree): String = show(tree, newTreePrinter)
-
- def show(tree: Tree, mkPrinter: PrintWriter => TreePrinter): String = {
- val buffer = new StringWriter()
- val writer = new PrintWriter(buffer)
- val printer = mkPrinter(writer)
- printer.print(tree)
- writer.flush()
- buffer.toString
- }
-
- def showRaw(tree: Tree): String = show(tree, new RawTreePrinter(_))
-
- /** Hook to define what `show(tree)` means.
- */
- def newTreePrinter(out: PrintWriter): TreePrinter
-
- // emits more or less verbatim representation of the provided tree
- // [Eugene] todo. needs to be refined
- // http://groups.google.com/group/scala-user/browse_thread/thread/de5a5be2e083cf8e
- class RawTreePrinter(out: PrintWriter) extends TreePrinter {
- def print(args: Any*): Unit = args foreach {
- case EmptyTree =>
- print("EmptyTree")
- case tree @ TypeTree() =>
- print("TypeTree()")
- if (tree.tpe != null)
- print(".setType(", tree.tpe, ")")
- else if (tree.original != null)
- print(".setOriginal(", tree.original, ")")
- case Literal(Constant(s: String)) =>
- print("Literal(Constant(\"" + s + "\"))")
- case tree: Tree =>
- print(tree.productPrefix+"(")
- val it = tree.productIterator
- while (it.hasNext) {
- it.next() match {
- case name: Name if uniqueIds && tree.hasSymbol && tree.symbol != NoSymbol =>
- print(tree.symbol.name, "#", tree.symbol.id)
- case arg =>
- print(arg)
- }
- print(if (it.hasNext) ", " else "")
- }
- print(")")
- if (typesPrinted)
- print(".setType(", tree.tpe, ")")
- case list: List[_] =>
- print("List(")
- val it = list.iterator
- while (it.hasNext) {
- print(it.next())
- print(if (it.hasNext) ", " else "")
- }
- print(")")
- case mods: Modifiers =>
- val parts = collection.mutable.ListBuffer[String]()
- parts += mods.flagString
- if (mods.privateWithin.toString.nonEmpty)
- parts += "newTypeName(\"" + mods.privateWithin.toString + "\")"
- if (mods.annotations.nonEmpty)
- parts += mods.annotations map showRaw mkString ("List(", ", ", ")")
- print(parts mkString ("Modifiers(", ", ", ")"))
- case name: Name =>
- if (name.isTermName) print("newTermName(\"") else print("newTypeName(\"")
- print(name.toString)
- print("\")")
- case arg =>
- out.print(arg)
- }
- }
-}
diff --git a/src/library/scala/reflect/api/Trees.scala b/src/library/scala/reflect/api/Trees.scala
deleted file mode 100644
index 2d130daa4e..0000000000
--- a/src/library/scala/reflect/api/Trees.scala
+++ /dev/null
@@ -1,689 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Martin Odersky
- */
-package scala.reflect
-package api
-
-// Syncnote: Trees are currently not thread-safe.
-trait Trees extends base.Trees { self: Universe =>
-
- override type Tree >: Null <: TreeApi
-
- /** ... */
- trait TreeApi extends TreeBase { this: Tree =>
-
- /** ... */
- def pos: Position
-
- /** ... */
- def tpe: Type
-
- /** Note that symbol is fixed as null at this level. In SymTrees,
- * it is overridden and implemented with a var, initialized to NoSymbol.
- *
- * Trees which are not SymTrees but which carry symbols do so by
- * overriding `def symbol` to forward it elsewhere. Examples:
- *
- * Super(qual, _) // has qual's symbol
- * Apply(fun, args) // has fun's symbol
- * TypeApply(fun, args) // has fun's symbol
- * AppliedTypeTree(tpt, args) // has tpt's symbol
- * TypeTree(tpe) // has tpe's typeSymbol, if tpe != null
- *
- * Attempting to set the symbol of a Tree which does not support
- * it will induce an exception.
- */
- def symbol: Symbol
-
- /** ... */
- def hasSymbol: Boolean
-
- /** Provides an alternate if tree is empty
- * @param alt The alternate tree
- * @return If this tree is non empty, this tree, otherwise `alt`.
- */
- def orElse(alt: => Tree): Tree
-
- /** Apply `f` to each subtree */
- def foreach(f: Tree => Unit): Unit
-
- /** Find all subtrees matching predicate `p`. Same as `filter` */
- def withFilter(f: Tree => Boolean): List[Tree]
-
- /** Find all subtrees matching predicate `p`. Same as `withFilter` */
- def filter(f: Tree => Boolean): List[Tree]
-
- /** Apply `pf' to each subtree on which the function is defined and collect the results.
- */
- def collect[T](pf: PartialFunction[Tree, T]): List[T]
-
- /** Returns optionally first tree (in a preorder traversal) which satisfies predicate `p`,
- * or None if none exists.
- */
- def find(p: Tree => Boolean): Option[Tree]
-
- /** Is there exists a part of this tree which satisfies predicate `p`? */
- def exists(p: Tree => Boolean): Boolean
-
- /** Do all parts of this tree satisfy predicate `p`? */
- def forAll(p: Tree => Boolean): Boolean
-
- /** Tests whether two trees are structurall equal.
- * Note that `==` on trees is reference equality.
- */
- def equalsStructure(that : Tree): Boolean
-
- /** The direct child trees of this tree.
- * EmptyTrees are always omitted. Lists are flattened.
- */
- def children: List[Tree]
-
- /** Extracts free term symbols from a tree that is reified or contains reified subtrees.
- */
- def freeTerms: List[FreeTermSymbol]
-
- /** Extracts free type symbols from a tree that is reified or contains reified subtrees.
- */
- def freeTypes: List[FreeTypeSymbol]
-
- /** Substitute symbols in `to` for corresponding occurrences of references to
- * symbols `from` in this type.
- */
- def substituteSymbols(from: List[Symbol], to: List[Symbol]): Tree
-
- /** Substitute types in `to` for corresponding occurrences of references to
- * symbols `from` in this tree.
- */
- def substituteTypes(from: List[Symbol], to: List[Type]): Tree
-
- /** Substitute given tree `to` for occurrences of nodes that represent
- * `C.this`, where `C` referes to the given class `clazz`.
- */
- def substituteThis(clazz: Symbol, to: Tree): Tree
-
- /** Make a copy of this tree, keeping all attributes,
- * except that all positions are focused (so nothing
- * in this tree will be found when searching by position).
- */
- def duplicate: this.type
- }
-
- override type TermTree >: Null <: Tree with TermTreeApi
-
- /** The API that all term trees support */
- trait TermTreeApi extends TreeApi { this: TermTree =>
- }
-
- override type TypTree >: Null <: Tree with TypTreeApi
-
- /** The API that all typ trees support */
- trait TypTreeApi extends TreeApi { this: TypTree =>
- }
-
- override type SymTree >: Null <: Tree with SymTreeApi
-
- /** The API that all sym trees support */
- trait SymTreeApi extends TreeApi { this: SymTree =>
- def symbol: Symbol
- }
-
- override type NameTree >: Null <: Tree with NameTreeApi
-
- /** The API that all name trees support */
- trait NameTreeApi extends TreeApi { this: NameTree =>
- def name: Name
- }
-
- override type RefTree >: Null <: SymTree with NameTree with RefTreeApi
-
- /** The API that all ref trees support */
- trait RefTreeApi extends SymTreeApi with NameTreeApi { this: RefTree =>
- def qualifier: Tree // empty for Idents
- def name: Name
- }
-
- override type DefTree >: Null <: SymTree with NameTree with DefTreeApi
-
- /** The API that all def trees support */
- trait DefTreeApi extends SymTreeApi with NameTreeApi { this: DefTree =>
- def name: Name
- }
-
- override type MemberDef >: Null <: DefTree with MemberDefApi
-
- /** The API that all member defs support */
- trait MemberDefApi extends DefTreeApi { this: MemberDef =>
- def mods: Modifiers
- }
-
- override type PackageDef >: Null <: MemberDef with PackageDefApi
-
- /** The API that all package defs support */
- trait PackageDefApi extends MemberDefApi { this: PackageDef =>
- val pid: RefTree
- val stats: List[Tree]
- }
-
- override type ImplDef >: Null <: MemberDef with ImplDefApi
-
- /** The API that all impl defs support */
- trait ImplDefApi extends MemberDefApi { this: ImplDef =>
- val impl: Template
- }
-
- override type ClassDef >: Null <: ImplDef with ClassDefApi
-
- /** The API that all class defs support */
- trait ClassDefApi extends ImplDefApi { this: ClassDef =>
- val mods: Modifiers
- val name: TypeName
- val tparams: List[TypeDef]
- val impl: Template
- }
-
- override type ModuleDef >: Null <: ImplDef with ModuleDefApi
-
- /** The API that all module defs support */
- trait ModuleDefApi extends ImplDefApi { this: ModuleDef =>
- val mods: Modifiers
- val name: TermName
- val impl: Template
- }
-
- override type ValOrDefDef >: Null <: MemberDef with ValOrDefDefApi
-
- /** The API that all val defs and def defs support */
- trait ValOrDefDefApi extends MemberDefApi { this: ValOrDefDef =>
- def name: Name // can't be a TermName because macros can be type names.
- def tpt: Tree
- def rhs: Tree
- }
-
- override type ValDef >: Null <: ValOrDefDef with ValDefApi
-
- /** The API that all val defs support */
- trait ValDefApi extends ValOrDefDefApi { this: ValDef =>
- val mods: Modifiers
- val name: TermName
- val tpt: Tree
- val rhs: Tree
- }
-
- override type DefDef >: Null <: ValOrDefDef with DefDefApi
-
- /** The API that all def defs support */
- trait DefDefApi extends ValOrDefDefApi { this: DefDef =>
- val mods: Modifiers
- val name: Name
- val tparams: List[TypeDef]
- val vparamss: List[List[ValDef]]
- val tpt: Tree
- val rhs: Tree
- }
-
- override type TypeDef >: Null <: MemberDef with TypeDefApi
-
- /** The API that all type defs support */
- trait TypeDefApi extends MemberDefApi { this: TypeDef =>
- val mods: Modifiers
- val name: TypeName
- val tparams: List[TypeDef]
- val rhs: Tree
- }
-
- override type LabelDef >: Null <: DefTree with TermTree with LabelDefApi
-
- /** The API that all label defs support */
- trait LabelDefApi extends DefTreeApi with TermTreeApi { this: LabelDef =>
- val name: TermName
- val params: List[Ident]
- val rhs: Tree
- }
-
- override type ImportSelector >: Null <: ImportSelectorApi
-
- /** The API that all import selectors support */
- trait ImportSelectorApi { this: ImportSelector =>
- val name: Name
- val namePos: Int
- val rename: Name
- val renamePos: Int
- }
-
- override type Import >: Null <: SymTree with ImportApi
-
- /** The API that all imports support */
- trait ImportApi extends SymTreeApi { this: Import =>
- val expr: Tree
- val selectors: List[ImportSelector]
- }
-
- override type Template >: Null <: SymTree with TemplateApi
-
- /** The API that all templates support */
- trait TemplateApi extends SymTreeApi { this: Template =>
- val parents: List[Tree]
- val self: ValDef
- val body: List[Tree]
- }
-
- override type Block >: Null <: TermTree with BlockApi
-
- /** The API that all blocks support */
- trait BlockApi extends TermTreeApi { this: Block =>
- val stats: List[Tree]
- val expr: Tree
- }
-
- override type CaseDef >: Null <: Tree with CaseDefApi
-
- /** The API that all case defs support */
- trait CaseDefApi extends TreeApi { this: CaseDef =>
- val pat: Tree
- val guard: Tree
- val body: Tree
- }
-
- override type Alternative >: Null <: TermTree with AlternativeApi
-
- /** The API that all alternatives support */
- trait AlternativeApi extends TermTreeApi { this: Alternative =>
- val trees: List[Tree]
- }
-
- override type Star >: Null <: TermTree with StarApi
-
- /** The API that all stars support */
- trait StarApi extends TermTreeApi { this: Star =>
- val elem: Tree
- }
-
- override type Bind >: Null <: DefTree with BindApi
-
- /** The API that all binds support */
- trait BindApi extends DefTreeApi { this: Bind =>
- val name: Name
- val body: Tree
- }
-
- override type UnApply >: Null <: TermTree with UnApplyApi
-
- /** The API that all unapplies support */
- trait UnApplyApi extends TermTreeApi { this: UnApply =>
- val fun: Tree
- val args: List[Tree]
- }
-
- override type ArrayValue >: Null <: TermTree with ArrayValueApi
-
- /** The API that all array values support */
- trait ArrayValueApi extends TermTreeApi { this: ArrayValue =>
- val elemtpt: Tree
- val elems: List[Tree]
- }
-
- override type Function >: Null <: TermTree with SymTree with FunctionApi
-
- /** The API that all functions support */
- trait FunctionApi extends TermTreeApi with SymTreeApi { this: Function =>
- val vparams: List[ValDef]
- val body: Tree
- }
-
- override type Assign >: Null <: TermTree with AssignApi
-
- /** The API that all assigns support */
- trait AssignApi extends TermTreeApi { this: Assign =>
- val lhs: Tree
- val rhs: Tree
- }
-
- override type AssignOrNamedArg >: Null <: TermTree with AssignOrNamedArgApi
-
- /** The API that all assigns support */
- trait AssignOrNamedArgApi extends TermTreeApi { this: AssignOrNamedArg =>
- val lhs: Tree
- val rhs: Tree
- }
-
- override type If >: Null <: TermTree with IfApi
-
- /** The API that all ifs support */
- trait IfApi extends TermTreeApi { this: If =>
- val cond: Tree
- val thenp: Tree
- val elsep: Tree
- }
-
- override type Match >: Null <: TermTree with MatchApi
-
- /** The API that all matches support */
- trait MatchApi extends TermTreeApi { this: Match =>
- val selector: Tree
- val cases: List[CaseDef]
- }
-
- override type Return >: Null <: TermTree with SymTree with ReturnApi
-
- /** The API that all returns support */
- trait ReturnApi extends TermTreeApi { this: Return =>
- val expr: Tree
- }
-
- override type Try >: Null <: TermTree with TryApi
-
- /** The API that all tries support */
- trait TryApi extends TermTreeApi { this: Try =>
- val block: Tree
- val catches: List[CaseDef]
- val finalizer: Tree
- }
-
- override type Throw >: Null <: TermTree with ThrowApi
-
- /** The API that all tries support */
- trait ThrowApi extends TermTreeApi { this: Throw =>
- val expr: Tree
- }
-
- override type New >: Null <: TermTree with NewApi
-
- /** The API that all news support */
- trait NewApi extends TermTreeApi { this: New =>
- val tpt: Tree
- }
-
- override type Typed >: Null <: TermTree with TypedApi
-
- /** The API that all typeds support */
- trait TypedApi extends TermTreeApi { this: Typed =>
- val expr: Tree
- val tpt: Tree
- }
-
- override type GenericApply >: Null <: TermTree with GenericApplyApi
-
- /** The API that all applies support */
- trait GenericApplyApi extends TermTreeApi { this: GenericApply =>
- val fun: Tree
- val args: List[Tree]
- }
-
- override type TypeApply >: Null <: GenericApply with TypeApplyApi
-
- /** The API that all type applies support */
- trait TypeApplyApi extends GenericApplyApi { this: TypeApply =>
- }
-
- override type Apply >: Null <: GenericApply with ApplyApi
-
- /** The API that all applies support */
- trait ApplyApi extends GenericApplyApi { this: Apply =>
- }
-
- override type ApplyDynamic >: Null <: TermTree with SymTree with ApplyDynamicApi
-
- /** The API that all apply dynamics support */
- trait ApplyDynamicApi extends TermTreeApi with SymTreeApi { this: ApplyDynamic =>
- val qual: Tree
- val args: List[Tree]
- }
-
- override type Super >: Null <: TermTree with SuperApi
-
- /** The API that all supers support */
- trait SuperApi extends TermTreeApi { this: Super =>
- val qual: Tree
- val mix: TypeName
- }
-
- override type This >: Null <: TermTree with SymTree with ThisApi
-
- /** The API that all thises support */
- trait ThisApi extends TermTreeApi with SymTreeApi { this: This =>
- val qual: TypeName
- }
-
- override type Select >: Null <: RefTree with SelectApi
-
- /** The API that all selects support */
- trait SelectApi extends RefTreeApi { this: Select =>
- val qualifier: Tree
- val name: Name
- }
-
- override type Ident >: Null <: RefTree with IdentApi
-
- /** The API that all idents support */
- trait IdentApi extends RefTreeApi { this: Ident =>
- val name: Name
- }
-
- override type ReferenceToBoxed >: Null <: TermTree with ReferenceToBoxedApi
-
- /** The API that all references support */
- trait ReferenceToBoxedApi extends TermTreeApi { this: ReferenceToBoxed =>
- val ident: Tree
- }
-
- override type Literal >: Null <: TermTree with LiteralApi
-
- /** The API that all literals support */
- trait LiteralApi extends TermTreeApi { this: Literal =>
- val value: Constant
- }
-
- override type Annotated >: Null <: Tree with AnnotatedApi
-
- /** The API that all annotateds support */
- trait AnnotatedApi extends TreeApi { this: Annotated =>
- val annot: Tree
- val arg: Tree
- }
-
- override type SingletonTypeTree >: Null <: TypTree with SingletonTypeTreeApi
-
- /** The API that all singleton type trees support */
- trait SingletonTypeTreeApi extends TypTreeApi { this: SingletonTypeTree =>
- val ref: Tree
- }
-
- override type SelectFromTypeTree >: Null <: TypTree with RefTree with SelectFromTypeTreeApi
-
- /** The API that all selects from type trees support */
- trait SelectFromTypeTreeApi extends TypTreeApi with RefTreeApi { this: SelectFromTypeTree =>
- val qualifier: Tree
- val name: TypeName
- }
-
- override type CompoundTypeTree >: Null <: TypTree with CompoundTypeTreeApi
-
- /** The API that all compound type trees support */
- trait CompoundTypeTreeApi extends TypTreeApi { this: CompoundTypeTree =>
- val templ: Template
- }
-
- override type AppliedTypeTree >: Null <: TypTree with AppliedTypeTreeApi
-
- /** The API that all applied type trees support */
- trait AppliedTypeTreeApi extends TypTreeApi { this: AppliedTypeTree =>
- val tpt: Tree
- val args: List[Tree]
- }
-
- override type TypeBoundsTree >: Null <: TypTree with TypeBoundsTreeApi
-
- /** The API that all type bound trees support */
- trait TypeBoundsTreeApi extends TypTreeApi { this: TypeBoundsTree =>
- val lo: Tree
- val hi: Tree
- }
-
- override type ExistentialTypeTree >: Null <: TypTree with ExistentialTypeTreeApi
-
- /** The API that all existential type trees support */
- trait ExistentialTypeTreeApi extends TypTreeApi { this: ExistentialTypeTree =>
- val tpt: Tree
- val whereClauses: List[Tree]
- }
-
- override type TypeTree >: Null <: TypTree with TypeTreeApi
-
- /** The API that all type trees support */
- trait TypeTreeApi extends TypTreeApi { this: TypeTree =>
- def original: Tree
- }
-
- /** An empty deferred value definition corresponding to:
- * val _: _
- * This is used as a placeholder in the `self` parameter Template if there is
- * no definition of a self value of self type.
- */
- val emptyValDef: ValDef
-
-// ---------------------- copying ------------------------------------------------
-
- /** The standard (lazy) tree copier
- */
- type TreeCopier <: TreeCopierOps
- val treeCopy: TreeCopier = newLazyTreeCopier
-
- def newStrictTreeCopier: TreeCopier
- def newLazyTreeCopier: TreeCopier
-
- /** The API of a tree copier
- * tree copiers are made available by an implicit conversion in reflect.ops
- */
- abstract class TreeCopierOps {
- def ClassDef(tree: Tree, mods: Modifiers, name: Name, tparams: List[TypeDef], impl: Template): ClassDef
- def PackageDef(tree: Tree, pid: RefTree, stats: List[Tree]): PackageDef
- def ModuleDef(tree: Tree, mods: Modifiers, name: Name, impl: Template): ModuleDef
- def ValDef(tree: Tree, mods: Modifiers, name: Name, tpt: Tree, rhs: Tree): ValDef
- def DefDef(tree: Tree, mods: Modifiers, name: Name, tparams: List[TypeDef], vparamss: List[List[ValDef]], tpt: Tree, rhs: Tree): DefDef
- def TypeDef(tree: Tree, mods: Modifiers, name: Name, tparams: List[TypeDef], rhs: Tree): TypeDef
- def LabelDef(tree: Tree, name: Name, params: List[Ident], rhs: Tree): LabelDef
- def Import(tree: Tree, expr: Tree, selectors: List[ImportSelector]): Import
- def Template(tree: Tree, parents: List[Tree], self: ValDef, body: List[Tree]): Template
- def Block(tree: Tree, stats: List[Tree], expr: Tree): Block
- def CaseDef(tree: Tree, pat: Tree, guard: Tree, body: Tree): CaseDef
- def Alternative(tree: Tree, trees: List[Tree]): Alternative
- def Star(tree: Tree, elem: Tree): Star
- def Bind(tree: Tree, name: Name, body: Tree): Bind
- def UnApply(tree: Tree, fun: Tree, args: List[Tree]): UnApply
- def ArrayValue(tree: Tree, elemtpt: Tree, trees: List[Tree]): ArrayValue
- def Function(tree: Tree, vparams: List[ValDef], body: Tree): Function
- def Assign(tree: Tree, lhs: Tree, rhs: Tree): Assign
- def AssignOrNamedArg(tree: Tree, lhs: Tree, rhs: Tree): AssignOrNamedArg
- def If(tree: Tree, cond: Tree, thenp: Tree, elsep: Tree): If
- def Match(tree: Tree, selector: Tree, cases: List[CaseDef]): Match
- def Return(tree: Tree, expr: Tree): Return
- def Try(tree: Tree, block: Tree, catches: List[CaseDef], finalizer: Tree): Try
- def Throw(tree: Tree, expr: Tree): Throw
- def New(tree: Tree, tpt: Tree): New
- def Typed(tree: Tree, expr: Tree, tpt: Tree): Typed
- def TypeApply(tree: Tree, fun: Tree, args: List[Tree]): TypeApply
- def Apply(tree: Tree, fun: Tree, args: List[Tree]): Apply
- def ApplyDynamic(tree: Tree, qual: Tree, args: List[Tree]): ApplyDynamic
- def Super(tree: Tree, qual: Tree, mix: TypeName): Super
- def This(tree: Tree, qual: Name): This
- def Select(tree: Tree, qualifier: Tree, selector: Name): Select
- def Ident(tree: Tree, name: Name): Ident
- def ReferenceToBoxed(tree: Tree, idt: Ident): ReferenceToBoxed
- def Literal(tree: Tree, value: Constant): Literal
- def TypeTree(tree: Tree): TypeTree
- def Annotated(tree: Tree, annot: Tree, arg: Tree): Annotated
- def SingletonTypeTree(tree: Tree, ref: Tree): SingletonTypeTree
- def SelectFromTypeTree(tree: Tree, qualifier: Tree, selector: Name): SelectFromTypeTree
- def CompoundTypeTree(tree: Tree, templ: Template): CompoundTypeTree
- def AppliedTypeTree(tree: Tree, tpt: Tree, args: List[Tree]): AppliedTypeTree
- def TypeBoundsTree(tree: Tree, lo: Tree, hi: Tree): TypeBoundsTree
- def ExistentialTypeTree(tree: Tree, tpt: Tree, whereClauses: List[Tree]): ExistentialTypeTree
- }
-
-// ---------------------- traversing and transforming ------------------------------
-
- class Traverser {
- protected[scala] var currentOwner: Symbol = rootMirror.RootClass
-
- def traverse(tree: Tree): Unit = itraverse(this, tree)
-
- def traverseTrees(trees: List[Tree]) {
- trees foreach traverse
- }
- def traverseTreess(treess: List[List[Tree]]) {
- treess foreach traverseTrees
- }
- def traverseStats(stats: List[Tree], exprOwner: Symbol) {
- stats foreach (stat =>
- if (exprOwner != currentOwner) atOwner(exprOwner)(traverse(stat))
- else traverse(stat)
- )
- }
-
- def atOwner(owner: Symbol)(traverse: => Unit) {
- val prevOwner = currentOwner
- currentOwner = owner
- traverse
- currentOwner = prevOwner
- }
-
- /** Leave apply available in the generic traverser to do something else.
- */
- def apply[T <: Tree](tree: T): T = { traverse(tree); tree }
- }
-
- protected def itraverse(traverser: Traverser, tree: Tree): Unit = throw new MatchError(tree)
-
- protected def xtraverse(traverser: Traverser, tree: Tree): Unit = throw new MatchError(tree)
-
- abstract class Transformer {
- val treeCopy: TreeCopier = newLazyTreeCopier
- protected[scala] var currentOwner: Symbol = rootMirror.RootClass
- protected def currentMethod = currentOwner.enclosingMethod
- protected def currentClass = currentOwner.enclosingClass
-// protected def currentPackage = currentOwner.enclosingTopLevelClass.owner
- def transform(tree: Tree): Tree = itransform(this, tree)
-
- def transformTrees(trees: List[Tree]): List[Tree] =
- trees mapConserve (transform(_))
- def transformTemplate(tree: Template): Template =
- transform(tree: Tree).asInstanceOf[Template]
- def transformTypeDefs(trees: List[TypeDef]): List[TypeDef] =
- trees mapConserve (tree => transform(tree).asInstanceOf[TypeDef])
- def transformValDef(tree: ValDef): ValDef =
- if (tree.isEmpty) tree else transform(tree).asInstanceOf[ValDef]
- def transformValDefs(trees: List[ValDef]): List[ValDef] =
- trees mapConserve (transformValDef(_))
- def transformValDefss(treess: List[List[ValDef]]): List[List[ValDef]] =
- treess mapConserve (transformValDefs(_))
- def transformCaseDefs(trees: List[CaseDef]): List[CaseDef] =
- trees mapConserve (tree => transform(tree).asInstanceOf[CaseDef])
- def transformIdents(trees: List[Ident]): List[Ident] =
- trees mapConserve (tree => transform(tree).asInstanceOf[Ident])
- def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] =
- stats mapConserve (stat =>
- if (exprOwner != currentOwner && stat.isTerm) atOwner(exprOwner)(transform(stat))
- else transform(stat)) filter (EmptyTree != _)
- def transformModifiers(mods: Modifiers): Modifiers =
- mods.mapAnnotations(transformTrees)
-
- def atOwner[A](owner: Symbol)(trans: => A): A = {
- val prevOwner = currentOwner
- currentOwner = owner
- val result = trans
- currentOwner = prevOwner
- result
- }
- }
-
- protected def itransform(transformer: Transformer, tree: Tree): Tree = throw new MatchError(tree)
-
- protected def xtransform(transformer: Transformer, tree: Tree): Tree = throw new MatchError(tree)
-
- type Modifiers >: Null <: ModifiersApi
-
- abstract class ModifiersApi extends ModifiersBase with HasFlagsApi
-
-}
-
diff --git a/src/library/scala/reflect/api/Types.scala b/src/library/scala/reflect/api/Types.scala
deleted file mode 100755
index b62a92cbd7..0000000000
--- a/src/library/scala/reflect/api/Types.scala
+++ /dev/null
@@ -1,368 +0,0 @@
-package scala.reflect
-package api
-
-trait Types extends base.Types { self: Universe =>
-
- override type Type >: Null <: TypeApi
-
- /** The extended API of types
- */
- abstract class TypeApi extends TypeBase {
-
- /** The defined or declared members with name `name` in this type;
- * an OverloadedSymbol if several exist, NoSymbol if none exist.
- * Alternatives of overloaded symbol appear in the order they are declared.
- */
- def declaration(name: Name): Symbol
-
- /** The collection of declarations in this type
- * [Eugene++] why not List?
- */
- def declarations: Iterable[Symbol]
-
- /** The member with given name, either directly declared or inherited,
- * an OverloadedSymbol if several exist, NoSymbol if none exist.
- */
- def member(name: Name): Symbol
-
- /** The non-private member with given name, either directly declared or inherited,
- * an OverloadedSymbol if several exist, NoSymbol if none exist.
- */
- def nonPrivateMember(name: Name): Symbol
-
- /** An iterable containing all members of this type (directly declared or inherited)
- * Members appear in the linearization order of their owners.
- * Members with the same owner appear in reverse order of their declarations.
- * [Eugene++] the order needs to be reversed back, at least in the public API
- */
- def members: Iterable[Symbol]
-
- /** An iterable containing all non-private members of this type (directly declared or inherited)
- * Members appear in the linearization order of their owners.
- * Members with the same owner appear in reverse order of their declarations.
- */
- def nonPrivateMembers: Iterable[Symbol]
-
- /** Substitute symbols in `to` for corresponding occurrences of references to
- * symbols `from` in this type.
- */
- def substituteSymbols(from: List[Symbol], to: List[Symbol]): Type
-
- /** Substitute types in `to` for corresponding occurrences of references to
- * symbols `from` in this type.
- */
- def substituteTypes(from: List[Symbol], to: List[Type]): Type
-
- /** If this is a parameterized types, the type arguments.
- * Otherwise the empty list
- */
- def typeArguments: List[Type]
-
- /** For a (potentially wrapped) poly type, its type parameters,
- * the empty list for all other types */
- def typeParams: List[Symbol]
-
- /** Is this type a type constructor that is missing its type arguments?
- */
- def isHigherKinded: Boolean // !!! This should be called "isTypeConstructor", no?
-
- /** Returns the corresponding type constructor (e.g. List for List[T] or List[String])
- */
- def typeConstructor: Type
-
- /** Does this type refer to spliceable types or is a spliceable type?
- */
- def isConcrete: Boolean
-
- /** Is this type an abstract type that needs to be resolved?
- */
- def isSpliceable: Boolean
-
- /**
- * Expands type aliases and converts higher-kinded TypeRefs to PolyTypes.
- * Functions on types are also implemented as PolyTypes.
- *
- * Example: (in the below, <List> is the type constructor of List)
- * TypeRef(pre, <List>, List()) is replaced by
- * PolyType(X, TypeRef(pre, <List>, List(X)))
- */
- def normalize: Type // !!! Alternative name? "normalize" is used to mean too many things.
-
- /** Does this type conform to given type argument `that`? */
- def <:< (that: Type): Boolean
-
- /** Is this type equivalent to given type argument `that`? */
- def =:= (that: Type): Boolean
-
- /** The list of all base classes of this type (including its own typeSymbol)
- * in reverse linearization order, starting with the class itself and ending
- * in class Any.
- */
- def baseClasses: List[Symbol] // !!! Alternative name, perhaps linearization?
-
- /** The least type instance of given class which is a supertype
- * of this type. Example:
- * {{{
- * class D[T]
- * class C extends p.D[Int]
- * ThisType(C).baseType(D) = p.D[Int]
- * }}}
- */
- def baseType(clazz: Symbol): Type
-
- /** This type as seen from prefix `pre` and class `clazz`. This means:
- * Replace all thistypes of `clazz` or one of its subclasses
- * by `pre` and instantiate all parameters by arguments of `pre`.
- * Proceed analogously for thistypes referring to outer classes.
- *
- * Example:
- * {{{
- * class D[T] { def m: T }
- * class C extends p.D[Int]
- * T.asSeenFrom(ThisType(C), D) (where D is owner of m)
- * = Int
- * }}}
- */
- def asSeenFrom(pre: Type, clazz: Symbol): Type
-
- /** The erased type corresponding to this type after
- * all transformations from Scala to Java have been performed.
- */
- def erasure: Type // !!! "erasedType", compare with "widen" (so "erase") or "underlying" (so "erased")
- // why not name it "erasure"?
-
- /** Apply `f` to each part of this type, returning
- * a new type. children get mapped before their parents */
- def map(f: Type => Type): Type
-
- /** Apply `f` to each part of this type, for side effects only */
- def foreach(f: Type => Unit)
-
- /** Returns optionally first type (in a preorder traversal) which satisfies predicate `p`,
- * or None if none exists.
- */
- def find(p: Type => Boolean): Option[Type]
-
- /** Is there part of this type which satisfies predicate `p`? */
- def exists(p: Type => Boolean): Boolean
-
- /** Does this type contain a reference to given symbol? */
- def contains(sym: Symbol): Boolean
-
- /** If this is a compound type, the list of its parent types;
- * otherwise the empty list
- */
- def parents: List[Type]
-
- /** If this is a singleton type, returns the type underlying it;
- * otherwise returns this type itself.
- */
- def underlying: Type
-
- /** If this is a singleton type, widen it to its nearest underlying non-singleton
- * base type by applying one or more `underlying` dereferences.
- * If this is not a singleton type, returns this type itself.
- *
- * Example:
- *
- * class Outer { class C ; val x: C }
- * val o: Outer
- * <o.x.type>.widen = o.C
- */
- def widen: Type
-
- /** The string discriminator of this type; useful for debugging */
- def kind: String
- }
-
- /** .. */
- override type ThisType >: Null <: SingletonType with ThisTypeApi
-
- /** The API that all this types support */
- trait ThisTypeApi extends TypeApi { this: ThisType =>
- val sym: Symbol
- }
-
- /** .. */
- override type SingleType >: Null <: SingletonType with SingleTypeApi
-
- /** The API that all single types support */
- trait SingleTypeApi extends TypeApi { this: SingleType =>
- val pre: Type
- val sym: Symbol
- }
-
- /** .. */
- override type SuperType >: Null <: SingletonType with SuperTypeApi
-
- /** The API that all super types support */
- trait SuperTypeApi extends TypeApi { this: SuperType =>
- val thistpe: Type
- val supertpe: Type
- }
-
- /** .. */
- override type ConstantType >: Null <: SingletonType with ConstantTypeApi
-
- /** The API that all constant types support */
- trait ConstantTypeApi extends TypeApi { this: ConstantType =>
- val value: Constant
- }
-
- /** .. */
- override type TypeRef >: Null <: Type with TypeRefApi
-
- /** The API that all type refs support */
- trait TypeRefApi extends TypeApi { this: TypeRef =>
- val pre: Type
- val sym: Symbol
- val args: List[Type]
- }
-
- /** .. */
- override type RefinedType >: Null <: CompoundType with RefinedTypeApi
-
- /** The API that all refined types support */
- trait RefinedTypeApi extends TypeApi { this: RefinedType =>
- val parents: List[Type]
- val decls: Scope
- }
-
- /** .. */
- override type ClassInfoType >: Null <: CompoundType with ClassInfoTypeApi
-
- /** The API that all class info types support */
- trait ClassInfoTypeApi extends TypeApi { this: ClassInfoType =>
- val parents: List[Type]
- val decls: Scope
- val typeSymbol: Symbol
- }
-
- /** .. */
- override type MethodType >: Null <: Type with MethodTypeApi
-
- /** The API that all method types support */
- trait MethodTypeApi extends TypeApi { this: MethodType =>
- val params: List[Symbol]
- val resultType: Type
- }
-
- /** .. */
- override type NullaryMethodType >: Null <: Type with NullaryMethodTypeApi
-
- /** The API that all nullary method types support */
- trait NullaryMethodTypeApi extends TypeApi { this: NullaryMethodType =>
- val resultType: Type
- }
-
- /** .. */
- override type PolyType >: Null <: Type with PolyTypeApi
-
- /** The API that all polymorphic types support */
- trait PolyTypeApi extends TypeApi { this: PolyType =>
- val typeParams: List[Symbol]
- val resultType: Type
- }
-
- /** .. */
- override type ExistentialType >: Null <: Type with ExistentialTypeApi
-
- /** The API that all existential types support */
- trait ExistentialTypeApi extends TypeApi { this: ExistentialType =>
- val quantified: List[Symbol]
- val underlying: Type
- }
-
- /** .. */
- override type AnnotatedType >: Null <: Type with AnnotatedTypeApi
-
- /** The API that all annotated types support */
- trait AnnotatedTypeApi extends TypeApi { this: AnnotatedType =>
- val annotations: List[AnnotationInfo]
- val underlying: Type
- val selfsym: Symbol
- }
-
- /** .. */
- override type TypeBounds >: Null <: Type with TypeBoundsApi
-
- /** The API that all type bounds support */
- trait TypeBoundsApi extends TypeApi { this: TypeBounds =>
- val lo: Type
- val hi: Type
- }
-
- /** .. */
- override type BoundedWildcardType >: Null <: Type with BoundedWildcardTypeApi
-
- /** The API that all this types support */
- trait BoundedWildcardTypeApi extends TypeApi { this: BoundedWildcardType =>
- val bounds: TypeBounds
- }
-
- /** The least upper bound of a list of types, as determined by `<:<`. */
- def lub(xs: List[Type]): Type
-
- /** The greatest lower bound of a list of types, as determined by `<:<`. */
- def glb(ts: List[Type]): Type
-
- // Creators ---------------------------------------------------------------
- // too useful and too non-trivial to be left out of public API
- // [Eugene to Paul] needs review!
-
- /** The canonical creator for single-types */
- def singleType(pre: Type, sym: Symbol): Type
-
- /** the canonical creator for a refined type with a given scope */
- def refinedType(parents: List[Type], owner: Symbol, decls: Scope, pos: Position): Type
-
- /** The canonical creator for a refined type with an initially empty scope.
- */
- def refinedType(parents: List[Type], owner: Symbol): Type
-
- /** The canonical creator for typerefs
- */
- def typeRef(pre: Type, sym: Symbol, args: List[Type]): Type
-
- /** A creator for intersection type where intersections of a single type are
- * replaced by the type itself. */
- def intersectionType(tps: List[Type]): Type
-
- /** A creator for intersection type where intersections of a single type are
- * replaced by the type itself, and repeated parent classes are merged.
- *
- * !!! Repeated parent classes are not merged - is this a bug in the
- * comment or in the code?
- */
- def intersectionType(tps: List[Type], owner: Symbol): Type
-
- /** A creator for type applications */
- def appliedType(tycon: Type, args: List[Type]): Type
-
- /** A creator for type parameterizations that strips empty type parameter lists.
- * Use this factory method to indicate the type has kind * (it's a polymorphic value)
- * until we start tracking explicit kinds equivalent to typeFun (except that the latter requires tparams nonEmpty).
- */
- def polyType(tparams: List[Symbol], tpe: Type): Type
-
- /** A creator for existential types. This generates:
- *
- * {{{
- * tpe1 where { tparams }
- * }}}
- *
- * where `tpe1` is the result of extrapolating `tpe` with regard to `tparams`.
- * Extrapolating means that type variables in `tparams` occurring
- * in covariant positions are replaced by upper bounds, (minus any
- * SingletonClass markers), type variables in `tparams` occurring in
- * contravariant positions are replaced by upper bounds, provided the
- * resulting type is legal with regard to stability, and does not contain
- * any type variable in `tparams`.
- *
- * The abstraction drops all type parameters that are not directly or
- * indirectly referenced by type `tpe1`. If there are no remaining type
- * parameters, simply returns result type `tpe`.
- */
- def existentialAbstraction(tparams: List[Symbol], tpe0: Type): Type
-}
-
diff --git a/src/library/scala/reflect/api/Universe.scala b/src/library/scala/reflect/api/Universe.scala
deleted file mode 100755
index 002cd2e673..0000000000
--- a/src/library/scala/reflect/api/Universe.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-package scala.reflect
-package api
-
-import language.experimental.macros
-
-abstract class Universe extends base.Universe
- with Symbols
- with Types
- with FlagSets
- with Names
- with Trees
- with TreePrinters
- with Constants
- with Positions
- with Mirrors
- with StandardDefinitions
- with StandardNames
- with Importers
- with Exprs
- with AnnotationInfos
-{
-
- /** Given an expression, generate a tree that when compiled and executed produces the original tree.
- * The produced tree will be bound to the Universe it was called from.
- *
- * For instance, given the abstract syntax tree representation of the <[ x + 1 ]> expression:
- *
- * {{{
- * Apply(Select(Ident("x"), "+"), List(Literal(Constant(1))))
- * }}}
- *
- * The reifier transforms it to the following expression:
- *
- * {{{
- * <[
- * val $u: u.type = u // where u is a reference to the Universe that calls the reify
- * $u.Expr[Int]($u.Apply($u.Select($u.Ident($u.newFreeVar("x", <Int>, x), "+"), List($u.Literal($u.Constant(1))))))
- * ]>
- * }}}
- *
- * Reification performs expression splicing (when processing Expr.splice)
- * and type splicing (for every type T that has a TypeTag[T] implicit in scope):
- *
- * {{{
- * val two = mirror.reify(2) // Literal(Constant(2))
- * val four = mirror.reify(two.splice + two.splice) // Apply(Select(two.tree, newTermName("$plus")), List(two.tree))
- *
- * def macroImpl[T](c: Context) = {
- * ...
- * // T here is just a type parameter, so the tree produced by reify won't be of much use in a macro expansion
- * // however, if T were annotated with c.TypeTag (which would declare an implicit parameter for macroImpl)
- * // then reification would subtitute T with the TypeTree that was used in a TypeApply of this particular macro invocation
- * val factory = c.reify{ new Queryable[T] }
- * ...
- * }
- * }}}
- *
- * The transformation looks mostly straightforward, but it has its tricky parts:
- * * Reifier retains symbols and types defined outside the reified tree, however
- * locally defined entities get erased and replaced with their original trees
- * * Free variables are detected and wrapped in symbols of the type FreeVar
- * * Mutable variables that are accessed from a local function are wrapped in refs
- * * Since reified trees can be compiled outside of the scope they've been created in,
- * special measures are taken to ensure that all members accessed in the reifee remain visible
- */
- // implementation is magically hardwired to `scala.reflect.reify.Taggers`
- def reify[T](expr: T): Expr[T] = macro ???
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/api/package.scala b/src/library/scala/reflect/api/package.scala
deleted file mode 100644
index d2fce7cf1d..0000000000
--- a/src/library/scala/reflect/api/package.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-package scala.reflect
-
-package object api {
-
- // type and value aliases for slices of the base Universe cake that are not
- // repeated in api.Universe
- type Scopes = base.Scopes
- type BuildUtils = base.BuildUtils
- type Attachments = base.Attachments
-
- type MirrorOf[U <: base.Universe with Singleton] = base.MirrorOf[U]
-}
diff --git a/src/library/scala/reflect/makro/Aliases.scala b/src/library/scala/reflect/makro/Aliases.scala
deleted file mode 100644
index c78c9a6a04..0000000000
--- a/src/library/scala/reflect/makro/Aliases.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-package scala.reflect
-package makro
-
-trait Aliases {
- self: Context =>
-
- type Symbol = universe.Symbol
- type Type = universe.Type
- type Name = universe.Name
- type TermName = universe.TermName
- type TypeName = universe.TypeName
- type Tree = universe.Tree
- // type Position = universe.Position
- type Scope = universe.Scope
- type Modifiers = universe.Modifiers
-
- type Expr[+T] = universe.Expr[T]
- val Expr = universe.Expr
-
- type TypeTag[T] = universe.TypeTag[T]
- type ConcreteTypeTag[T] = universe.ConcreteTypeTag[T]
- val TypeTag = universe.TypeTag
- val ConcreteTypeTag = universe.ConcreteTypeTag
- def typeTag[T](implicit ttag: TypeTag[T]) = ttag
- def concreteTypeTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag
- def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe
-}
diff --git a/src/library/scala/reflect/makro/CapturedVariables.scala b/src/library/scala/reflect/makro/CapturedVariables.scala
deleted file mode 100644
index 592e28b3b2..0000000000
--- a/src/library/scala/reflect/makro/CapturedVariables.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-package scala.reflect
-package makro
-
-trait CapturedVariables {
- self: Context =>
-
- import mirror._
-
- /** Mark a variable as captured; i.e. force boxing in a *Ref type.
- */
- def captureVariable(vble: Symbol): Unit
-
- /** Mark given identifier as a reference to a captured variable itself
- * suppressing dereferencing with the `elem` field.
- */
- def referenceCapturedVariable(vble: Symbol): Tree
-
- /** Convert type of a captured variable to *Ref type.
- */
- def capturedVariableType(vble: Symbol): Type
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/Context.scala b/src/library/scala/reflect/makro/Context.scala
deleted file mode 100644
index f9858a063c..0000000000
--- a/src/library/scala/reflect/makro/Context.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-package scala.reflect
-package makro
-
-import language.experimental.macros
-
-// todo. introduce context hierarchy
-// the most lightweight context should just expose the stuff from the SIP
-// the full context should include all traits from scala.reflect.makro (and probably reside in scala-compiler.jar)
-
-trait Context extends Aliases
- with CapturedVariables
- with Enclosures
- with Infrastructure
- with Names
- with Reifiers
- with FrontEnds
- with Settings
- with Typers
- with Parsers
- with Exprs
- with TypeTags
- with Evals
- with ExprUtils {
-
- /** The compile-time universe */
- val universe: Universe
-
- /** The mirror of the compile-time universe */
- val mirror: MirrorOf[universe.type]
-
- /** The type of the prefix tree from which the macro is selected */
- type PrefixType
-
- /** The prefix tree from which the macro is selected */
- val prefix: Expr[PrefixType]
-
- /** Alias to the underlying mirror's reify */
- // implementation is magically hardwired to `scala.reflect.makro.runtime.ContextReifiers`
- def reify[T](expr: T): Expr[T] = macro ???
-}
diff --git a/src/library/scala/reflect/makro/Enclosures.scala b/src/library/scala/reflect/makro/Enclosures.scala
deleted file mode 100644
index 69bd8d09c7..0000000000
--- a/src/library/scala/reflect/makro/Enclosures.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-package scala.reflect
-package makro
-
-trait Enclosures {
- self: Context =>
-
- /** The tree that undergoes macro expansion.
- * Can be useful to get an offset or a range position of the entire tree being processed.
- */
- val macroApplication: Tree
-
- /** Contexts that represent macros in-flight, including the current one. Very much like a stack trace, but for macros only.
- * Can be useful for interoperating with other macros and for imposing compiler-friendly limits on macro expansion.
- *
- * Is also priceless for emitting sane error messages for macros that are called by other macros on synthetic (i.e. position-less) trees.
- * In that dire case navigate the ``enclosingMacros'' stack, and it will most likely contain at least one macro with a position-ful macro application.
- * See ``enclosingPosition'' for a default implementation of this logic.
- *
- * Unlike `openMacros`, this is a val, which means that it gets initialized when the context is created
- * and always stays the same regardless of whatever happens during macro expansion.
- */
- val enclosingMacros: List[Context]
-
- /** Types along with corresponding trees for which implicit arguments are currently searched.
- * Can be useful to get information about an application with an implicit parameter that is materialized during current macro expansion.
- *
- * Unlike `openImplicits`, this is a val, which means that it gets initialized when the context is created
- * and always stays the same regardless of whatever happens during macro expansion.
- */
- val enclosingImplicits: List[(Type, Tree)]
-
- /** Tries to guess a position for the enclosing application.
- * But that is simple, right? Just dereference ``pos'' of ``macroApplication''? Not really.
- * If we're in a synthetic macro expansion (no positions), we must do our best to infer the position of something that triggerd this expansion.
- * Surprisingly, quite often we can do this by navigation the ``enclosingMacros'' stack.
- */
- val enclosingPosition: Position
-
- /** Tree that corresponds to the enclosing application, or EmptyTree if not applicable.
- */
- val enclosingApplication: Tree
-
- /** Tree that corresponds to the enclosing method, or EmptyTree if not applicable.
- */
- val enclosingMethod: Tree
-
- /** Tree that corresponds to the enclosing class, or EmptyTree if not applicable.
- */
- val enclosingClass: Tree
-
- /** Compilation unit that contains this macro application.
- */
- val enclosingUnit: CompilationUnit
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/Evals.scala b/src/library/scala/reflect/makro/Evals.scala
deleted file mode 100644
index 4e5fc2f97f..0000000000
--- a/src/library/scala/reflect/makro/Evals.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-package scala.reflect
-package makro
-
-trait Evals {
- self: Context =>
-
- /** .. */
- def eval[T](expr: Expr[T]): T
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/ExprUtils.scala b/src/library/scala/reflect/makro/ExprUtils.scala
deleted file mode 100644
index c3e5cc6bc1..0000000000
--- a/src/library/scala/reflect/makro/ExprUtils.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package scala.reflect
-package makro
-
-trait ExprUtils {
- self: Context =>
-
- def literalNull: Expr[Null]
-
- def literalUnit: Expr[Unit]
-
- def literalTrue: Expr[Boolean]
-
- def literalFalse: Expr[Boolean]
-
- def literal(x: Boolean): Expr[Boolean]
-
- def literal(x: Byte): Expr[Byte]
-
- def literal(x: Short): Expr[Short]
-
- def literal(x: Int): Expr[Int]
-
- def literal(x: Long): Expr[Long]
-
- def literal(x: Float): Expr[Float]
-
- def literal(x: Double): Expr[Double]
-
- def literal(x: String): Expr[String]
-
- def literal(x: Char): Expr[Char]
-}
diff --git a/src/library/scala/reflect/makro/Exprs.scala b/src/library/scala/reflect/makro/Exprs.scala
deleted file mode 100644
index b4f8e7ac4e..0000000000
--- a/src/library/scala/reflect/makro/Exprs.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-package scala.reflect
-package makro
-
-trait Exprs {
- self: Context =>
-
- def Expr[T: TypeTag](tree: Tree): Expr[T]
-}
diff --git a/src/library/scala/reflect/makro/FrontEnds.scala b/src/library/scala/reflect/makro/FrontEnds.scala
deleted file mode 100644
index 5087f90174..0000000000
--- a/src/library/scala/reflect/makro/FrontEnds.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-package scala.reflect
-package makro
-
-trait FrontEnds extends scala.reflect.api.FrontEnds {
- self: Context =>
-
- import mirror._
-
- type Position = universe.Position
-
- /** Exposes means to control the compiler UI */
- def frontEnd: FrontEnd
- def setFrontEnd(frontEnd: FrontEnd): this.type
- def withFrontEnd[T](frontEnd: FrontEnd)(op: => T): T
-
- /** For sending a message which should not be labeled as a warning/error,
- * but also shouldn't require -verbose to be visible.
- * Use ``enclosingPosition'' if you're in doubt what position to pass to ``pos''.
- */
- def echo(pos: Position, msg: String): Unit
-
- /** Informational messages, suppressed unless -verbose or force=true.
- * Use ``enclosingPosition'' if you're in doubt what position to pass to ``pos''.
- */
- def info(pos: Position, msg: String, force: Boolean): Unit
-
- /** Warnings and errors.
- * Use ``enclosingPosition'' if you're in doubt what position to pass to ``pos''.
- */
- def hasWarnings: Boolean
- def hasErrors: Boolean
- def warning(pos: Position, msg: String): Unit
- def error(pos: Position, msg: String): Unit
-
- /** Abruptly terminates current macro expansion leaving a note about what happened.
- * Use ``enclosingPosition'' if you're in doubt what position to pass to ``pos''.
- */
- def abort(pos: Position, msg: String): Nothing
-
- /** Drops into interactive mode if supported by the compiler UI */
- def interactive(): Unit
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/Infrastructure.scala b/src/library/scala/reflect/makro/Infrastructure.scala
deleted file mode 100644
index e6bfe33366..0000000000
--- a/src/library/scala/reflect/makro/Infrastructure.scala
+++ /dev/null
@@ -1,103 +0,0 @@
-package scala.reflect
-package makro
-
-trait Infrastructure {
- self: Context =>
-
- /** Determines whether the compiler expanding a macro targets JVM.
- */
- val forJVM: Boolean
-
- /** Determines whether the compiler expanding a macro targets CLR.
- */
- val forMSIL: Boolean
-
- /** Determines whether the compiler expanding a macro is a presentation compiler.
- */
- val forInteractive: Boolean
-
- /** Determines whether the compiler expanding a macro is a Scaladoc compiler.
- */
- val forScaladoc: Boolean
-
- /** Exposes current compilation run.
- */
- val currentRun: Run
-
- /** Exposes library classpath.
- */
- val libraryClassPath: List[java.net.URL]
-
- /** Exposes a classloader that corresponds to the library classpath.
- *
- * With this classloader you can perform on-the-fly evaluation of macro arguments.
- * For example, consider this code snippet:
- *
- * def staticEval[T](x: T) = macro staticEval[T]
- *
- * def staticEval[T: c.TypeTag](c: Context)(x: c.Expr[T]) = {
- * import scala.reflect.runtime.{universe => ru}
- * val mirror = ru.runtimeMirror(c.libraryClassLoader)
- * import scala.tools.reflect.ToolBox
- * val toolBox = mirror.mkToolBox()
- * val importer = ru.mkImporter(c.universe).asInstanceOf[ru.Importer { val from: c.universe.type }]
- * val tree = c.resetAllAttrs(x.tree.duplicate)
- * val imported = importer.importTree(tree)
- * val valueOfX = toolBox.runExpr(imported).asInstanceOf[T]
- * ...
- * }
- *
- * // [Eugene++] using this guy will tremendously slow down the compilation
- * // https://twitter.com/xeno_by/status/201248317831774208
- * // todo. we need to address this somehow
- */
- def libraryClassLoader: ClassLoader
-
- /** As seen by macro API, compilation run is an opaque type that can be deconstructed into:
- * 1) Current compilation unit
- * 2) List of all compilation units that comprise the run
- */
- type Run
-
- val Run: RunExtractor
-
- abstract class RunExtractor {
- def unapply(run: Run): Option[(CompilationUnit, List[CompilationUnit])]
- }
-
- /** As seen by macro API, compilation unit is an opaque type that can be deconstructed into:
- * 1) File that corresponds to the unit (if not applicable, null)
- * 2) Content of the file (if not applicable, empty array)
- * 3) Body, i.e. the AST that represents the compilation unit
- */
- type CompilationUnit
-
- val CompilationUnit: CompilationUnitExtractor
-
- abstract class CompilationUnitExtractor {
- def unapply(compilationUnit: CompilationUnit): Option[(java.io.File, Array[Char], Tree)]
- }
-
- /** Returns a macro definition which triggered this macro expansion.
- */
- val currentMacro: Symbol
-
- // todo. redo caches as discussed on Reflecting Meeting 2012/03/29
- // https://docs.google.com/document/d/1oUZGQpdt2qwioTlJcSt8ZFQwVLTvpxn8xa67P8OGVpU/edit
-
- /** A cache shared by all invocations of all macros across all compilation runs.
- *
- * Needs to be used with extreme care, since memory leaks here will swiftly crash the presentation compiler.
- * For example, Scala IDE typically launches a compiler run on every edit action so there might be hundreds of runs per minute.
- */
- val globalCache: collection.mutable.Map[Any, Any]
-
- /** A cache shared by all invocations of the same macro within a single compilation run.
- *
- * This cache is cleared automatically after a compilation run is completed or abandoned.
- * It is also specific to a particular macro definition.
- *
- * To share data between different macros and/or different compilation runs, use ``globalCache''.
- */
- val cache: collection.mutable.Map[Any, Any]
-}
diff --git a/src/library/scala/reflect/makro/Names.scala b/src/library/scala/reflect/makro/Names.scala
deleted file mode 100644
index 909976d83c..0000000000
--- a/src/library/scala/reflect/makro/Names.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-package scala.reflect
-package makro
-
-trait Names {
- self: Context =>
-
- /** Creates a fresh string */
- def fresh(): String
-
- /** Creates a fresh string from the provided string */
- def fresh(name: String): String
-
- /** Creates a fresh name from the provided name */
- def fresh[NameType <: Name](name: NameType): NameType
-}
diff --git a/src/library/scala/reflect/makro/Parsers.scala b/src/library/scala/reflect/makro/Parsers.scala
deleted file mode 100644
index 9866b7e491..0000000000
--- a/src/library/scala/reflect/makro/Parsers.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-package scala.reflect
-package makro
-
-trait Parsers {
- self: Context =>
-
- /** .. */
- // todo. distinguish between `parseExpr` and `parse`
- def parse(code: String): Tree
-
- /** Represents an error during parsing
- */
- type ParseError <: Throwable
- val ParseError: ParseErrorExtractor
- abstract class ParseErrorExtractor {
- def unapply(error: ParseError): Option[(Position, String)]
- }
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/Reifiers.scala b/src/library/scala/reflect/makro/Reifiers.scala
deleted file mode 100644
index f39f56f935..0000000000
--- a/src/library/scala/reflect/makro/Reifiers.scala
+++ /dev/null
@@ -1,91 +0,0 @@
-package scala.reflect
-package makro
-
-trait Reifiers {
- self: Context =>
-
- /** Reification prefix that refers to the base reflexive universe, ``scala.reflect.basis''.
- * Providing it for the ``prefix'' parameter of ``reifyTree'' or ``reifyType'' will create a tree that can be inspected at runtime.
- */
- val basisUniverse: Tree
-
- /** Reification prefix that refers to the runtime reflexive universe, ``scala.reflect.runtime.universe''.
- * Providing it for the ``prefix'' parameter of ``reifyTree'' or ``reifyType'' will create a full-fledged tree that can be inspected at runtime.
- */
- val runtimeUniverse: Tree
-
- /** Given a tree, generate a tree that when compiled and executed produces the original tree.
- * For more information and examples see the documentation for ``Universe.reify''.
- *
- * The produced tree will be bound to the specified ``universe'' and ``mirror''.
- * Possible values for ``universe'' include ``basisUniverse'' and ``runtimeUniverse''.
- * Possible values for ``mirror'' include ``EmptyTree'' (in that case the reifier will automatically pick an appropriate mirror).
- *
- * This function is deeply connected to ``Universe.reify'', a macro that reifies arbitrary expressions into runtime trees.
- * They do very similar things (``Universe.reify'' calls ``Context.reifyTree'' to implement itself), but they operate on different metalevels (see below).
- *
- * Let's study the differences between ``Context.reifyTree'' and ``Universe.reify'' on an example of using them inside a ``fooMacro'' macro:
- *
- * * Since reify itself is a macro, it will be executed when fooMacro is being compiled (metalevel -1)
- * and will produce a tree that when evaluated during macro expansion of fooMacro (metalevel 0) will recreate the input tree.
- *
- * This provides a facility analogous to quasi-quoting. Writing "reify{ expr }" will generate an AST that represents expr.
- * Afterwards this AST (or its parts) can be used to construct the return value of fooMacro.
- *
- * * reifyTree is evaluated during macro expansion (metalevel 0)
- * and will produce a tree that when evaluated during the runtime of the program (metalevel 1) will recreate the input tree.
- *
- * This provides a way to retain certain trees from macro expansion time to be inspected later, in the runtime.
- * For example, DSL authors may find it useful to capture DSL snippets into ASTs that are then processed at runtime in a domain-specific way.
- *
- * Also note the difference between universes of the runtime trees produced by two reifies:
- *
- * * The result of compiling and running the result of reify will be bound to the Universe that called reify.
- * This is possible because it's a macro, so it can generate whatever code it wishes.
- *
- * * The result of compiling and running the result of reifyTree will be the ``prefix'' that needs to be passed explicitly.
- * This happens because the Universe of the evaluated result is from a different metalevel than the Context the called reify.
- *
- * Typical usage of this function is to retain some of the trees received/created by a macro
- * into the form that can be inspected (via pattern matching) or compiled/run (by a reflective ToolBox) during the runtime.
- */
- def reifyTree(universe: Tree, mirror: Tree, tree: Tree): Tree
-
- /** Given a type, generate a tree that when compiled and executed produces the original type.
- * The produced tree will be bound to the specified ``universe'' and ``mirror''.
- * For more information and examples see the documentation for ``Context.reifyTree'' and ``Universe.reify''.
- */
- def reifyType(universe: Tree, mirror: Tree, tpe: Type, concrete: Boolean = false): Tree
-
- /** Given a type, generate a tree that when compiled and executed produces the runtime class of the original type.
- * If ``concrete'' is true, then this function will bail on types, who refer to abstract types (like `ClassTag` does).
- */
- def reifyRuntimeClass(tpe: Type, concrete: Boolean = true): Tree
-
- /** Given a type, generate a tree that when compiled and executed produces the runtime class of the enclosing class or module.
- * Returns `EmptyTree` if there does not exist an enclosing class or module.
- */
- def reifyEnclosingRuntimeClass: Tree
-
- /** Undoes reification of a tree.
- *
- * This reversion doesn't simply restore the original tree (that would lose the context of reification),
- * but does something more involved that conforms to the following laws:
- *
- * 1) unreifyTree(reifyTree(tree)) != tree // unreified tree is tree + saved context
- * // in current implementation, the result of unreify is opaque
- * // i.e. there's no possibility to inspect underlying tree/context
- *
- * 2) reifyTree(unreifyTree(reifyTree(tree))) == reifyTree(tree) // the result of reifying a tree in its original context equals to
- * // the result of reifying a tree along with its saved context
- *
- * 3) compileAndEval(unreifyTree(reifyTree(tree))) ~ compileAndEval(tree) // at runtime original and unreified trees are behaviorally equivalent
- */
- def unreifyTree(tree: Tree): Tree
-}
-
-// made these guys non path-dependent, otherwise exception handling quickly becomes a mess
-
-case class ReificationError(val pos: reflect.api.PositionApi, val msg: String) extends Throwable(msg)
-
-case class UnexpectedReificationError(val pos: reflect.api.PositionApi, val msg: String, val cause: Throwable = null) extends Throwable(msg, cause)
diff --git a/src/library/scala/reflect/makro/Settings.scala b/src/library/scala/reflect/makro/Settings.scala
deleted file mode 100644
index c6c7e5870b..0000000000
--- a/src/library/scala/reflect/makro/Settings.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-package scala.reflect
-package makro
-
-trait Settings {
- self: Context =>
-
- /** Exposes macro-specific settings as a list of strings.
- * These settings are passed to the compiler via the "-Xmacro-settings:setting1,setting2...,settingN" command-line option.
- */
- def settings: List[String]
-
- /** Exposes current compiler settings as a list of options.
- * Use `scalac -help`, `scalac -X` and `scalac -Y` to learn about currently supported options.
- */
- // [Eugene] ugly? yes, but I don't really fancy copy/pasting all our settings here and keep it synchronized at all times
- // why all settings? because macros need to be in full control of the stuff going on
- // maybe later we can implement a gettable/settable list of important settings, but for now let's leave it like that
- def compilerSettings: List[String]
-
- /** Updates current compiler settings with an option string.
- * Use `scalac -help`, `scalac -X` and `scalac -Y` to learn about currently supported options.
- * todo. http://groups.google.com/group/scala-internals/browse_thread/thread/07c18cff41f59203
- */
- def setCompilerSettings(options: String): this.type
-
- /** Updates current compiler settings with a list of options.
- * Use `scalac -help`, `scalac -X` and `scalac -Y` to learn about currently supported options.
- */
- def setCompilerSettings(options: List[String]): this.type
-
- /** Temporary sets compiler settings to a given option string and executes a given closure.
- * Use `scalac -help`, `scalac -X` and `scalac -Y` to learn about currently supported options.
- */
- def withCompilerSettings[T](options: String)(op: => T): T
-
- /** Temporary sets compiler settings to a given list of options and executes a given closure.
- * Use `scalac -help`, `scalac -X` and `scalac -Y` to learn about currently supported options.
- */
- def withCompilerSettings[T](options: List[String])(op: => T): T
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/TreeBuilder.scala b/src/library/scala/reflect/makro/TreeBuilder.scala
deleted file mode 100644
index c4179b9c80..0000000000
--- a/src/library/scala/reflect/makro/TreeBuilder.scala
+++ /dev/null
@@ -1,60 +0,0 @@
-package scala.reflect
-package makro
-
-// [Eugene] I added some stuff that was necessary for typetag materialization macros
-// but we should think it over and pick other generally useful stuff
-// same goes for tree traversers/transformers, type maps, etc
-// and once we expose all that, there's another question: how do we stay in sync?
-abstract class TreeBuilder {
- val global: Universe
-
- import global._
- import definitions._
-
- /** Builds a reference to value whose type is given stable prefix.
- * The type must be suitable for this. For example, it
- * must not be a TypeRef pointing to an abstract type variable.
- */
- def mkAttributedQualifier(tpe: Type): Tree
-
- /** Builds a reference to value whose type is given stable prefix.
- * If the type is unsuitable, e.g. it is a TypeRef for an
- * abstract type variable, then an Ident will be made using
- * termSym as the Ident's symbol. In that case, termSym must
- * not be NoSymbol.
- */
- def mkAttributedQualifier(tpe: Type, termSym: Symbol): Tree
-
- /** Builds a typed reference to given symbol with given stable prefix. */
- def mkAttributedRef(pre: Type, sym: Symbol): Tree
-
- /** Builds a typed reference to given symbol. */
- def mkAttributedRef(sym: Symbol): Tree
-
- /** Builds a typed This reference to given symbol. */
- def mkAttributedThis(sym: Symbol): Tree
-
- /** Builds a typed Ident with an underlying symbol. */
- def mkAttributedIdent(sym: Symbol): Tree
-
- /** Builds a typed Select with an underlying symbol. */
- def mkAttributedSelect(qual: Tree, sym: Symbol): Tree
-
- /** A creator for method calls, e.g. fn[T1, T2, ...](v1, v2, ...)
- * There are a number of variations.
- *
- * @param receiver symbol of the method receiver
- * @param methodName name of the method to call
- * @param targs type arguments (if Nil, no TypeApply node will be generated)
- * @param args value arguments
- * @return the newly created trees.
- */
- def mkMethodCall(receiver: Symbol, methodName: Name, targs: List[Type], args: List[Tree]): Tree
- def mkMethodCall(method: Symbol, targs: List[Type], args: List[Tree]): Tree
- def mkMethodCall(method: Symbol, args: List[Tree]): Tree
- def mkMethodCall(target: Tree, args: List[Tree]): Tree
- def mkMethodCall(receiver: Symbol, methodName: Name, args: List[Tree]): Tree
- def mkMethodCall(receiver: Tree, method: Symbol, targs: List[Type], args: List[Tree]): Tree
- def mkMethodCall(target: Tree, targs: List[Type], args: List[Tree]): Tree
- def mkNullaryCall(method: Symbol, targs: List[Type]): Tree
-}
diff --git a/src/library/scala/reflect/makro/TypeTags.scala b/src/library/scala/reflect/makro/TypeTags.scala
deleted file mode 100644
index 3251c27908..0000000000
--- a/src/library/scala/reflect/makro/TypeTags.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-package scala.reflect
-package makro
-
-trait TypeTags {
- self: Context =>
-
- def TypeTag[T](tpe: Type): TypeTag[T]
- def ConcreteTypeTag[T](tpe: Type): ConcreteTypeTag[T]
-}
diff --git a/src/library/scala/reflect/makro/Typers.scala b/src/library/scala/reflect/makro/Typers.scala
deleted file mode 100644
index 2610d7dd50..0000000000
--- a/src/library/scala/reflect/makro/Typers.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-package scala.reflect
-package makro
-
-trait Typers {
- self: Context =>
-
- import universe._
-
- /** Contexts that represent macros in-flight, including the current one. Very much like a stack trace, but for macros only.
- * Can be useful for interoperating with other macros and for imposing compiler-friendly limits on macro expansion.
- *
- * Is also priceless for emitting sane error messages for macros that are called by other macros on synthetic (i.e. position-less) trees.
- * In that dire case navigate the ``openMacros'' stack, and it will most likely contain at least one macro with a position-ful macro application.
- * See ``enclosingPosition'' for a default implementation of this logic.
- *
- * Unlike `enclosingMacros`, this is a def, which means that it gets recalculated on every invocation,
- * so it might change depending on what is going on during macro expansion.
- */
- def openMacros: List[Context]
-
- /** Types along with corresponding trees for which implicit arguments are currently searched.
- * Can be useful to get information about an application with an implicit parameter that is materialized during current macro expansion.
- *
- * Unlike `enclosingImplicits`, this is a def, which means that it gets recalculated on every invocation,
- * so it might change depending on what is going on during macro expansion.
- */
- def openImplicits: List[(Type, Tree)]
-
- /** Typechecks the provided tree against the expected type ``pt'' in the macro callsite context.
- *
- * If ``silent'' is false, ``TypeError'' will be thrown in case of a typecheck error.
- * If ``silent'' is true, the typecheck is silent and will return ``EmptyTree'' if an error occurs.
- * Such errors don't vanish and can be inspected by turning on -Ymacro-debug-verbose.
- * Unlike in ``inferImplicitValue'' and ``inferImplicitView'', ``silent'' is false by default.
- *
- * Typechecking can be steered with the following optional parameters:
- * ``withImplicitViewsDisabled'' recursively prohibits implicit views (though, implicit vals will still be looked up and filled in), default value is false
- * ``withMacrosDisabled'' recursively prohibits macro expansions and macro-based implicits, default value is false
- */
- def typeCheck(tree: Tree, pt: Type = WildcardType, silent: Boolean = false, withImplicitViewsDisabled: Boolean = false, withMacrosDisabled: Boolean = false): Tree
-
- /** Infers an implicit value of the expected type ``pt'' in the macro callsite context.
- * Optional ``pos'' parameter provides a position that will be associated with the implicit search.
- *
- * If ``silent'' is false, ``TypeError'' will be thrown in case of an inference error.
- * If ``silent'' is true, the typecheck is silent and will return ``EmptyTree'' if an error occurs.
- * Such errors don't vanish and can be inspected by turning on -Xlog-implicits.
- * Unlike in ``typeCheck'', ``silent'' is true by default.
- */
- def inferImplicitValue(pt: Type, silent: Boolean = true, withMacrosDisabled: Boolean = false, pos: Position = enclosingPosition): Tree
-
- /** Infers an implicit view from the provided tree ``tree'' from the type ``from'' to the type ``to'' in the macro callsite context.
- *
- * Optional ``pos'' parameter provides a position that will be associated with the implicit search.
- * Another optional parameter, ``reportAmbiguous`` controls whether ambiguous implicit errors should be reported.
- * If we search for a view simply to find out whether one type is coercible to another, it might be desirable to set this flag to ``false''.
- *
- * If ``silent'' is false, ``TypeError'' will be thrown in case of an inference error.
- * If ``silent'' is true, the typecheck is silent and will return ``EmptyTree'' if an error occurs.
- * Such errors don't vanish and can be inspected by turning on -Xlog-implicits.
- * Unlike in ``typeCheck'', ``silent'' is true by default.
- */
- def inferImplicitView(tree: Tree, from: Type, to: Type, silent: Boolean = true, withMacrosDisabled: Boolean = false, reportAmbiguous: Boolean = true, pos: Position = enclosingPosition): Tree
-
- /** Recursively resets symbols and types in a given tree.
- *
- * Note that this does not revert the tree to its pre-typer shape.
- * For more info, read up https://issues.scala-lang.org/browse/SI-5464.
- */
- def resetAllAttrs(tree: Tree): Tree
-
- /** Recursively resets locally defined symbols and types in a given tree.
- *
- * Note that this does not revert the tree to its pre-typer shape.
- * For more info, read up https://issues.scala-lang.org/browse/SI-5464.
- */
- def resetLocalAttrs(tree: Tree): Tree
-
- /** Represents an error during typechecking
- */
- type TypeError <: Throwable
- val TypeError: TypeErrorExtractor
- abstract class TypeErrorExtractor {
- def unapply(error: TypeError): Option[(Position, String)]
- }
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/Universe.scala b/src/library/scala/reflect/makro/Universe.scala
deleted file mode 100644
index ffc4042a0a..0000000000
--- a/src/library/scala/reflect/makro/Universe.scala
+++ /dev/null
@@ -1,118 +0,0 @@
-package scala.reflect
-package makro
-
-abstract class Universe extends scala.reflect.api.Universe {
-
- val treeBuild: TreeBuilder { val global: Universe.this.type }
-
- // Symbol extensions ---------------------------------------------------------------
-
- override type Symbol >: Null <: SymbolContextApi
-
- /** The extended API of symbols that's supported in macro context universes
- */
- trait SymbolContextApi extends SymbolApi { this: Symbol =>
-
- // [Eugene++ to Martin] should we also add mutability methods here (similarly to what's done below for trees)?
- // I'm talking about `setAnnotations` and friends
-
- /** Can this symbol be loaded by a reflective mirror?
- *
- * Scalac relies on `ScalaSignature' annotation to retain symbols across compilation runs.
- * Such annotations (also called "pickles") are applied on top-level classes and include information
- * about all symbols reachable from the annotee. However, local symbols (e.g. classes or definitions local to a block)
- * are typically unreachable and information about them gets lost.
- *
- * This method is useful for macro writers who wish to save certain ASTs to be used at runtime.
- * With `isLocatable' it's possible to check whether a tree can be retained as is, or it needs special treatment.
- */
- def isLocatable: Boolean
-
- /** Is this symbol static (i.e. with no outer instance)?
- * Q: When exactly is a sym marked as STATIC?
- * A: If it's a member of a toplevel object, or of an object contained in a toplevel object, or any number of levels deep.
- * http://groups.google.com/group/scala-internals/browse_thread/thread/d385bcd60b08faf6
- */
- def isStatic: Boolean
- }
-
- // Tree extensions ---------------------------------------------------------------
-
- override type Tree >: Null <: TreeContextApi
-
- /** The extended API of trees that's supported in macro context universes
- */
- trait TreeContextApi extends TreeApi { this: Tree =>
-
- /** ... */
- def pos_=(pos: Position): Unit
-
- /** ... */
- def setPos(newpos: Position): this.type
-
- /** ... */
- def tpe_=(t: Type): Unit
-
- /** Set tpe to give `tp` and return this.
- */
- def setType(tp: Type): this.type
-
- /** Like `setType`, but if this is a previously empty TypeTree that
- * fact is remembered so that resetAllAttrs will snap back.
- *
- * @PP: Attempting to elaborate on the above, I find: If defineType
- * is called on a TypeTree whose type field is null or NoType,
- * this is recorded as "wasEmpty = true". That value is used in
- * ResetAttrsTraverser, which nulls out the type field of TypeTrees
- * for which wasEmpty is true, leaving the others alone.
- *
- * resetAllAttrs is used in situations where some speculative
- * typing of a tree takes place, fails, and the tree needs to be
- * returned to its former state to try again. So according to me:
- * using `defineType` instead of `setType` is how you communicate
- * that the type being set does not depend on any previous state,
- * and therefore should be abandoned if the current line of type
- * inquiry doesn't work out.
- */
- def defineType(tp: Type): this.type
-
- /** ... */
- def symbol_=(sym: Symbol): Unit
-
- /** ... */
- def setSymbol(sym: Symbol): this.type
-
- /** ... */
- def attachments: base.Attachments { type Pos = Position }
-
- /** ... */
- def addAttachment(attachment: Any): this.type
-
- /** ... */
- def removeAttachment[T: ClassTag]: this.type
- }
-
- override type SymTree >: Null <: Tree with SymTreeContextApi
-
- /** The extended API of sym trees that's supported in macro context universes
- */
- trait SymTreeContextApi extends SymTreeApi { this: SymTree =>
- var symbol: Symbol
- }
-
- override type TypeTree >: Null <: TypTree with TypeTreeContextApi
-
- /** The extended API of sym trees that's supported in macro context universes
- */
- trait TypeTreeContextApi extends TypeTreeApi { this: TypeTree =>
- def setOriginal(tree: Tree): this.type
- }
-
- override type Ident >: Null <: RefTree with IdentContextApi
-
- /** The extended API of idents that's supported in macro context universes
- */
- trait IdentContextApi extends IdentApi { this: Ident =>
- def isBackquoted: Boolean
- }
-} \ No newline at end of file
diff --git a/src/library/scala/reflect/makro/package.scala b/src/library/scala/reflect/makro/package.scala
deleted file mode 100644
index 3c0e51030e..0000000000
--- a/src/library/scala/reflect/makro/package.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package scala.reflect
-
-package object makro {
-
- type MirrorOf[U <: base.Universe with Singleton] = base.MirrorOf[U]
-}