From 5d6844e9b6f95b0476f26ac7fe2f28d0831f6384 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 10 Nov 2011 16:39:54 +0000 Subject: Removed reflect.{Type, Symbol, Tree, Print} for... Removed reflect.{Type, Symbol, Tree, Print} for good. --- src/library/scala/reflect/Print.scala | 113 --------------------------------- src/library/scala/reflect/Symbol.scala | 85 ------------------------- src/library/scala/reflect/Tree.scala | 52 --------------- src/library/scala/reflect/Type.scala | 69 -------------------- 4 files changed, 319 deletions(-) delete mode 100644 src/library/scala/reflect/Print.scala delete mode 100644 src/library/scala/reflect/Symbol.scala delete mode 100644 src/library/scala/reflect/Tree.scala delete mode 100644 src/library/scala/reflect/Type.scala (limited to 'src/library') 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 should not be used in client code. */ -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 should not be used in client code. */ -abstract class Symbol { - val owner: Symbol - val name: String - val tpe: Type -} - -/** This type is required by the compiler and should not be used in client code. */ -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 should not be used in client code. */ -abstract class LocalSymbol extends Symbol - -/** This type is required by the compiler and should not be used in client code. */ -case class Class(override val fullname: String) extends GlobalSymbol(fullname) { - val tpe = NamedType(fullname) -} - -/** This type is required by the compiler and should not be used in client code. */ -case class Method(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname) - -/** This type is required by the compiler and should not be used in client code. */ -case class Field(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname) - -/** This type is required by the compiler and should not be used in client code. */ -case class TypeField(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname) - -/** This type is required by the compiler and should not be used in client code. */case class LocalValue(owner: Symbol, name: String, tpe: Type) extends LocalSymbol - -/** This type is required by the compiler and should not be used in client code. */ -case class LocalMethod(owner: Symbol, name: String, tpe: Type) extends LocalSymbol - -/** This type is required by the compiler and should not be used in client code. */ -case object NoSymbol extends Symbol { - val owner = null - val name = null - val tpe = NoType -} - -/** This type is required by the compiler and should not be used in client code. */ -case object RootSymbol extends Symbol { - val owner = NoSymbol - val name = "" - val tpe = NoPrefix -} - -/** This type is required by the compiler and should not be used in client code. */ -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 should not be used in client code. */ -abstract class Tree - -/** This type is required by the compiler and should not be used in client code. */ -case class Ident(sym: Symbol) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Select(qual: Tree, sym: Symbol) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Literal(value: Any) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Apply(fun: Tree, args: List[Tree]) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class TypeApply(fun: Tree, args: List[Type]) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Function(params: List[Symbol], body: Tree) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class This(sym: Symbol) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Block(stats: List[Tree], expr: Tree) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class New(sym: Tree) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class If(condition: Tree, trueCase: Tree, falseCase: Tree) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Assign(destination: Tree, source: Tree) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Target(sym: LabelSymbol, body: Tree) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Goto(target: LabelSymbol) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class ValDef(sym: Symbol, rhs: Tree) extends Tree - -//Monomorphic -/** This type is required by the compiler and should not be used in client code. */ -case class ClassDef(sym: Symbol, tpe: Type, impl: Template) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class DefDef(sym: Symbol, vparamss: List[List[Tree]], ret: Type, rhs: Tree) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -case class Super(psym: Symbol) extends Tree -/** This type is required by the compiler and should not be used in client code. */ -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 should not be used in client code. */ -abstract class Type - -/** This type is required by the compiler and should not be used in client code. */ -case object NoPrefix extends Type -/** This type is required by the compiler and should not be used in client code. */ -case object NoType extends Type - -/** This type is required by the compiler and should not be used in client code. - * fullname */ -case class NamedType(fullname: String) extends Type - -/** This type is required by the compiler and should not be used in client code. - * pre # sym */ -case class PrefixedType(pre: Type, sym: Symbol) extends Type - -/** This type is required by the compiler and should not be used in client code. - * pre.type # sym == pre.sym */ -case class SingleType(pre: Type, sym: Symbol) extends Type - -/** This type is required by the compiler and should not be used in client code. - * 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) => -*/ -- cgit v1.2.3