summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/Symbols.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-07-31 11:33:16 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-08-02 15:50:52 +0200
commit027b00171c0d92ec669deaa471966e6468c6b8cf (patch)
tree63808014ea752c49ae39e0b731f0d15bc6edeb28 /src/reflect/scala/reflect/internal/Symbols.scala
parentb578059b43a4caaadee2cb20f74cd9a7c876c8ef (diff)
downloadscala-027b00171c0d92ec669deaa471966e6468c6b8cf.tar.gz
scala-027b00171c0d92ec669deaa471966e6468c6b8cf.tar.bz2
scala-027b00171c0d92ec669deaa471966e6468c6b8cf.zip
more refinements of reflection API
Added a bunch of test methods to symbols to cover public flags: (e.g. isPrivate, isFinal, isOverride, isImplicit, etc). I'd argue that the API duplication w.r.t flag sets is trumped by unified interface to tests and better encapsulation. Also updated the API to be easier to understand after prior exposure to Java or .NET reflection APIs: 1) Added typeParams to TypeSymbol and ClassSymbol. 2) Renamed MethodSymbol.resultType to returnType. 3) Removed the distinction between MethodSymbol.params vs MethodSymbol.allParams now we just have MethodSymbol.params: List[List[Symbol]].
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 372520e48f..304caa74d4 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -456,6 +456,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
def isAliasType = false
def isAbstractType = false
def isSkolem = false
+ def isMacro = this hasFlag MACRO
/** A Type, but not a Class. */
def isNonClassType = false
@@ -2487,19 +2488,9 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
res
}
- override def allParams: List[List[Symbol]] = paramss
+ override def params: List[List[Symbol]] = paramss
- override def params: List[Symbol] = {
- def loop(tpe: Type): List[Symbol] =
- tpe match {
- case NullaryMethodType(_) => Nil
- case MethodType(params, _) => params
- case PolyType(_, tpe) => loop(tpe)
- }
- loop(info)
- }
-
- override def resultType: Type = {
+ override def returnType: Type = {
def loop(tpe: Type): Type =
tpe match {
case NullaryMethodType(ret) => loop(ret)
@@ -2772,8 +2763,10 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
override def isJavaInterface = hasAllFlags(JAVA | TRAIT)
override def isNestedClass = !owner.isPackageClass
override def isNumericValueClass = definitions.isNumericValueClass(this)
+ override def isNumeric = isNumericValueClass
override def isPackageObjectClass = isModuleClass && (name == tpnme.PACKAGE)
override def isPrimitiveValueClass = definitions.isPrimitiveValueClass(this)
+ override def isPrimitive = isPrimitiveValueClass
// The corresponding interface is the last parent by convention.
private def lastParent = if (tpe.parents.isEmpty) NoSymbol else tpe.parents.last.typeSymbol