From 027b00171c0d92ec669deaa471966e6468c6b8cf Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Tue, 31 Jul 2012 11:33:16 +0200 Subject: 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]]. --- src/library/scala/reflect/base/Symbols.scala | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'src/library') diff --git a/src/library/scala/reflect/base/Symbols.scala b/src/library/scala/reflect/base/Symbols.scala index 052571dbcb..45f7c0c1bd 100644 --- a/src/library/scala/reflect/base/Symbols.scala +++ b/src/library/scala/reflect/base/Symbols.scala @@ -80,10 +80,6 @@ trait Symbols { self: Universe => /** The base API that all symbols support */ trait SymbolBase { this: Symbol => - /** An id number which is unique for all symbols in this universe */ - // [Eugene++ to Martin] do we leave this here? - def id: Int - /** The owner of this symbol. This is the symbol * that directly contains the current symbol's definition. * The `NoSymbol` symbol does not have an owner, and calling this method @@ -112,18 +108,6 @@ trait Symbols { self: Universe => */ def fullName: String - /** If this symbol is a class, this symbol; otherwise the next enclosing - * class, or `NoSymbol` if none exists. - */ - def enclosingClass: Symbol = - if (isClass || this == NoSymbol) this else owner.enclosingClass - - /** If this symbol is a method, this symbol; otherwise the next enclosing - * method, or `NoSymbol` if none exists. - */ - def enclosingMethod: Symbol = - if (isMethod || this == NoSymbol) this else owner.enclosingMethod - /** Does this symbol represent the definition of a type? * Note that every symbol is either a term or a type. * So for every symbol `sym`, either `sym.isTerm` is true -- cgit v1.2.3