diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/Predef.scala | 3 | ||||
-rw-r--r-- | src/reflect/scala/reflect/api/Symbols.scala | 42 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 4 |
3 files changed, 49 insertions, 0 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 44025d5358..f3d36473dd 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -115,8 +115,11 @@ object Predef extends LowPriorityImplicits { @deprecated("This notion doesn't have a corresponding concept in 2.10, because scala.reflect.runtime.universe.TypeTag can capture arbitrary types. Use type tags instead of manifests, and there will be no need in opt manifests.", "2.10.0") val NoManifest = scala.reflect.NoManifest + @deprecated("Use scala.reflect.classTag[T] and scala.reflect.runtime.universe.typeTag[T] instead", "2.10.0") def manifest[T](implicit m: Manifest[T]) = m + @deprecated("Use scala.reflect.classTag[T] instead", "2.10.0") def classManifest[T](implicit m: ClassManifest[T]) = m + @deprecated("This notion doesn't have a corresponding concept in 2.10, because scala.reflect.runtime.universe.TypeTag can capture arbitrary types. Use type tags instead of manifests, and there will be no need in opt manifests.", "2.10.0") def optManifest[T](implicit m: OptManifest[T]) = m // Minor variations on identity functions diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala index 13f5f743f1..2fa8ccc044 100644 --- a/src/reflect/scala/reflect/api/Symbols.scala +++ b/src/reflect/scala/reflect/api/Symbols.scala @@ -158,10 +158,22 @@ trait Symbols extends base.Symbols { self: Universe => */ def isOverride: Boolean + /** Is this symbol labelled as "abstract override"? + */ + def isAbstractOverride: Boolean + /** Is this symbol a macro? */ def isMacro: Boolean + /** Is this symbol a parameter (either a method parameter or a type parameter)? + */ + def isParameter: Boolean + + /** Is this symbol a specialized type parameter or a generated specialized member? + */ + def isSpecialized: Boolean + /******************* helpers *******************/ /** ... @@ -240,6 +252,25 @@ trait Symbols extends base.Symbols { self: Universe => /** Setter method for a backing field of a val or a val, NoSymbol for all other term symbols. */ def setter: Symbol + + /** Does this symbol represent a field of a class + * that was generated from a parameter of that class? + */ + def isParamAccessor: Boolean + + /** Does this symbol represent a field of a case class + * that corresponds to a parameter in the first parameter list of the + * primary constructor of that class? + */ + def isCaseAccessor: Boolean + + /** Does this symbol represent a parameter with a default value? + */ + def isParamWithDefault: Boolean + + /** Does this symbol represent a by-name parameter? + */ + def isByNameParam: Boolean } /** The API of type symbols */ @@ -275,6 +306,13 @@ trait Symbols extends base.Symbols { self: Universe => /** The API of method symbols */ trait MethodSymbolApi extends TermSymbolApi with MethodSymbolBase { this: MethodSymbol => + /** Does this method represent a constructor? + * + * If `owner` is a class, then this is a vanilla JVM constructor. + * If `owner` is a trait, then this is a mixin constructor. + */ + def isConstructor: Boolean + /** For a polymorphic method, its type parameters, the empty list for all other methods */ def typeParams: List[Symbol] @@ -286,6 +324,10 @@ trait Symbols extends base.Symbols { self: Universe => */ def params: List[List[Symbol]] + /** Does this method support variable length argument lists? + */ + def isVarargs: Boolean + /** The return type of the method */ def returnType: Type } diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index c356416112..9ae4302734 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -64,6 +64,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => def kind: String = kindString def isExistential: Boolean = this.isExistentiallyBound + def isParamWithDefault: Boolean = this.hasDefault + def isByNameParam: Boolean = this.isValueParameter && (this hasFlag BYNAMEPARAM) def newNestedSymbol(name: Name, pos: Position, newFlags: Long, isClass: Boolean): Symbol = name match { case n: TermName => newTermSymbol(n, pos, newFlags) @@ -2496,6 +2498,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => override def params: List[List[Symbol]] = paramss + override def isVarargs: Boolean = definitions.isVarArgsList(paramss.flatten) + override def returnType: Type = { def loop(tpe: Type): Type = tpe match { |