diff options
author | Martin Odersky <odersky@gmail.com> | 2011-11-10 16:39:54 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-11-10 16:39:54 +0000 |
commit | 5d6844e9b6f95b0476f26ac7fe2f28d0831f6384 (patch) | |
tree | f446c67299dd17c68dfe1fa2f98b81b0a6a34133 | |
parent | 7121c6a8db65b20667bcb75e77b72c997afe2fde (diff) | |
download | scala-5d6844e9b6f95b0476f26ac7fe2f28d0831f6384.tar.gz scala-5d6844e9b6f95b0476f26ac7fe2f28d0831f6384.tar.bz2 scala-5d6844e9b6f95b0476f26ac7fe2f28d0831f6384.zip |
Removed reflect.{Type, Symbol, Tree, Print} for...
Removed reflect.{Type, Symbol, Tree, Print} for good.
-rw-r--r-- | src/library/scala/reflect/Print.scala | 113 | ||||
-rw-r--r-- | src/library/scala/reflect/Symbol.scala | 85 | ||||
-rw-r--r-- | src/library/scala/reflect/Tree.scala | 52 | ||||
-rw-r--r-- | src/library/scala/reflect/Type.scala | 69 |
4 files changed, 0 insertions, 319 deletions
diff --git a/src/library/scala/reflect/Print.scala b/src/library/scala/reflect/Print.scala deleted file mode 100644 index 2efc7917fe..0000000000 --- a/src/library/scala/reflect/Print.scala +++ /dev/null @@ -1,113 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - - -package scala.reflect - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -object Print extends Function1[Any, String] { - - def apply(any: Any): String = any match { - case x: Code[_] => - apply(x.tree) - case x: Tree => - apply(x) - case x: Symbol => - apply(x) - case x: Type => - apply(x) - case _ => - "UnknownAny" - } - - def apply(tree: Tree): String = tree match { - case reflect.Ident(sym) => - Print(sym) - case reflect.Select(qual, sym) => - Print(qual) + "." + Print(sym) - case reflect.Literal(value) => value match { - case s:String => "\"" + s + "\"" - case _ => value.toString - } - case reflect.Apply(fun, args) => - Print(fun) + args.map(Print).mkString("(", ", ", ")") - case reflect.TypeApply(fun, args) => - Print(fun) + args.map(Print).mkString("[", ", ", "]") - case reflect.Function(params, body) => - params.map(Print).mkString("(", ", ", ")") + " => " + Print(body) - case reflect.This(sym) => - Print(sym)+".this" - case reflect.Block(stats, expr) => - (stats ::: List(expr)).map(Print).mkString("{\n", ";\n", "\n}") - case reflect.New(tpt) => - "new " + Print(tpt) - case reflect.If(condition, trueCase, falseCase) => - "if (" + Print(condition) + ") " + Print(trueCase) + " else " + Print(falseCase) - case reflect.Assign(destination: Tree, source: Tree) => - Print(destination) + " = " + Print(source) - case reflect.Target(sym, body) => - "target " + Print(sym) + " {\n" + Print(body) + "\n}" - case reflect.Goto(target) => - "goto " + Print(target) - case _ => - "???" - } - - def apply(symbol: Symbol): String = symbol match { - case reflect.Class(name) => - name.substring(name.lastIndexOf('.') + 1) - case reflect.Method(name, datatype) => - name.substring(name.lastIndexOf('.') +1) - case reflect.Field(name, datatype) => - name.substring(name.lastIndexOf('.') + 1) - case reflect.TypeField(name, datatype) => - name.substring(name.lastIndexOf('.') + 1) - case reflect.LocalValue(owner, name, datatype) => - name.substring(name.lastIndexOf('.') + 1) - case reflect.LocalMethod(owner, name, datatype) => - name.substring(name.lastIndexOf('.') + 1) - case reflect.NoSymbol => - "NoSymbol" - case reflect.RootSymbol => - "RootSymbol" - case reflect.LabelSymbol(name) => - name - case _ => - "???" - } - - def apply(datatype: Type): String = datatype match { - case reflect.NoPrefix => - "NoPrefix" - case reflect.NoType => - "NoType" - case reflect.NamedType(name) => - "(named: " + name + ")" - case reflect.PrefixedType(prefix, symbol) => - "(" + Print(prefix) + "." + Print(symbol) + ")" - case reflect.SingleType(prefix, symbol) => - "(" + Print(prefix) + "." + Print(symbol) + ")" - case reflect.ThisType(clazz) => - "(" + Print(clazz) + ".this.type)" - case reflect.AppliedType(datatype, args) => - Print(datatype) + args.map(Print).mkString("[", ", ", "]") - case reflect.TypeBounds(lo, hi) => - "[" + Print(lo) + " ... " + Print(hi) + "]" - case reflect.MethodType(formals, resultType) => - formals.map(Print).mkString("(", ", ", ")") + " => " + Print(resultType) - case reflect.NullaryMethodType(resultType) => - " => " + Print(resultType) - case reflect.PolyType(typeParams, typeBounds, resultType) => - val z = (typeParams, typeBounds).zipped map ((tp, tb) => "[" + Print(tb._1) + " :> " + Print(tp) + " :> " + Print(tb._2) + "]") - z.mkString("[", ", ", "]") + " -> " + Print(resultType) - case _ => - "???" - } - -} diff --git a/src/library/scala/reflect/Symbol.scala b/src/library/scala/reflect/Symbol.scala deleted file mode 100644 index b2f8cd9ec4..0000000000 --- a/src/library/scala/reflect/Symbol.scala +++ /dev/null @@ -1,85 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - - -package scala.reflect - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -abstract class Symbol { - val owner: Symbol - val name: String - val tpe: Type -} - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -abstract class GlobalSymbol(val fullname: String) extends Symbol { - private val pointIndex = fullname.lastIndexOf(".") - val owner: Symbol = - if (pointIndex < 0) RootSymbol - else Class(fullname.substring(0, pointIndex)) - val name: String = - if (pointIndex < 0) fullname - else fullname.substring(pointIndex+1, fullname.length()) -} - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -abstract class LocalSymbol extends Symbol - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Class(override val fullname: String) extends GlobalSymbol(fullname) { - val tpe = NamedType(fullname) -} - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Method(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname) - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Field(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname) - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class TypeField(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname) - -/** This type is required by the compiler and <b>should not be used in client code</b>. */case class LocalValue(owner: Symbol, name: String, tpe: Type) extends LocalSymbol - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class LocalMethod(owner: Symbol, name: String, tpe: Type) extends LocalSymbol - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case object NoSymbol extends Symbol { - val owner = null - val name = null - val tpe = NoType -} - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case object RootSymbol extends Symbol { - val owner = NoSymbol - val name = "<root>" - val tpe = NoPrefix -} - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class LabelSymbol(val name: String) extends Symbol { - val owner = NoSymbol - val tpe = NamedType("scala.Unit") -} - - -/* Standard pattern match: - - case reflect.Class(fullname) => - case reflect.Method(fullname, tpe) => - case reflect.Field(fullname, tpe) => - case reflect.TypeField(fullname, tpe) => - case reflect.LocalValue(owner, name, tpe) => - case reflect.LocalMethod(owner, name, tpe) => - case reflect.NoSymbol => - case reflect.RootSymbol => - case reflect.LabelSymbol(name) => -*/ diff --git a/src/library/scala/reflect/Tree.scala b/src/library/scala/reflect/Tree.scala deleted file mode 100644 index 4f44211471..0000000000 --- a/src/library/scala/reflect/Tree.scala +++ /dev/null @@ -1,52 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - -package scala.reflect - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -abstract class Tree - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Ident(sym: Symbol) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Select(qual: Tree, sym: Symbol) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Literal(value: Any) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Apply(fun: Tree, args: List[Tree]) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class TypeApply(fun: Tree, args: List[Type]) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Function(params: List[Symbol], body: Tree) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class This(sym: Symbol) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Block(stats: List[Tree], expr: Tree) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class New(sym: Tree) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class If(condition: Tree, trueCase: Tree, falseCase: Tree) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Assign(destination: Tree, source: Tree) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Target(sym: LabelSymbol, body: Tree) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Goto(target: LabelSymbol) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class ValDef(sym: Symbol, rhs: Tree) extends Tree - -//Monomorphic -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class ClassDef(sym: Symbol, tpe: Type, impl: Template) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class DefDef(sym: Symbol, vparamss: List[List[Tree]], ret: Type, rhs: Tree) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Super(psym: Symbol) extends Tree -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case class Template(parents: List[Type], body: List[Tree]) extends Tree diff --git a/src/library/scala/reflect/Type.scala b/src/library/scala/reflect/Type.scala deleted file mode 100644 index ddf44d1048..0000000000 --- a/src/library/scala/reflect/Type.scala +++ /dev/null @@ -1,69 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.reflect - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -abstract class Type - -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case object NoPrefix extends Type -/** This type is required by the compiler and <b>should not be used in client code</b>. */ -case object NoType extends Type - -/** This type is required by the compiler and <b>should not be used in client code</b>. - * fullname */ -case class NamedType(fullname: String) extends Type - -/** This type is required by the compiler and <b>should not be used in client code</b>. - * pre # sym */ -case class PrefixedType(pre: Type, sym: Symbol) extends Type - -/** This type is required by the compiler and <b>should not be used in client code</b>. - * pre.type # sym == pre.sym */ -case class SingleType(pre: Type, sym: Symbol) extends Type - -/** This type is required by the compiler and <b>should not be used in client code</b>. - * clazz.this */ -case class ThisType(clazz: Symbol) extends Type - -/** This type is required by the compiler and '''should not be used in client code'''. - * clazz.super[superClazz] - * `tpe[args,,1,,, ..., args,,n,,]` - */ -case class AppliedType(tpe: Type, args: List[Type]) extends Type - -/** This type is required by the compiler and '''should not be used in client code'''. - * [a <: lo >: hi] */ -case class TypeBounds(lo: Type, hi: Type) extends Type - -/** This type is required by the compiler and '''should not be used in client code'''. - * `(formals,,1,, ... formals,,n,,) restpe` - */ -case class MethodType(formals: List[Symbol], restpe: Type) extends Type - -/** This type is required by the compiler and '''should not be used in client code'''. */ -case class NullaryMethodType(resultType: Type) extends Type - -/** This type is required by the compiler and '''should not be used in client code'''. */ -case class PolyType(typeParams: List[Symbol], typeBounds: List[(Type, Type)], resultType: Type) extends Type - -/* Standard pattern match: - - case reflect.NoPrefix => - case reflect.NoType => - case reflect.NamedType(fullname) => - case reflect.PrefixedType(pre, sym) => - case reflect.SingleType(pre, sym) => - case reflect.ThisType(clazz) => - case reflect.AppliedType(tpe, args) => - case reflect.TypeBounds(lo, hi) => - case reflect.MethodType(formals, restpe) => - case reflect.NullaryMethodType(restpe) => - case reflect.PolyType(typeParams, typeBounds, resultType) => -*/ |