@@ -2090,36 +2090,37 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
20902090 internal.Symbol_noSymbol
20912091 }
20922092
2093- extension symbolOps on (self : Symbol ) {
2093+ /** Members of `Symbol` */
2094+ extension SymbolOps on (sym : Symbol ) {
20942095
20952096 /** Owner of this symbol. The owner is the symbol in which this symbol is defined. Throws if this symbol does not have an owner. */
2096- def owner (given ctx : Context ): Symbol = internal.Symbol_owner (self )
2097+ def owner (given ctx : Context ): Symbol = internal.Symbol_owner (sym )
20972098
20982099 /** Owner of this symbol. The owner is the symbol in which this symbol is defined. Returns `NoSymbol` if this symbol does not have an owner. */
2099- def maybeOwner (given ctx : Context ): Symbol = internal.Symbol_maybeOwner (self )
2100+ def maybeOwner (given ctx : Context ): Symbol = internal.Symbol_maybeOwner (sym )
21002101
21012102 /** Flags of this symbol */
2102- def flags (given ctx : Context ): Flags = internal.Symbol_flags (self )
2103+ def flags (given ctx : Context ): Flags = internal.Symbol_flags (sym )
21032104
21042105 /** This symbol is private within the resulting type */
2105- def privateWithin (given ctx : Context ): Option [Type ] = internal.Symbol_privateWithin (self )
2106+ def privateWithin (given ctx : Context ): Option [Type ] = internal.Symbol_privateWithin (sym )
21062107
21072108 /** This symbol is protected within the resulting type */
2108- def protectedWithin (given ctx : Context ): Option [Type ] = internal.Symbol_protectedWithin (self )
2109+ def protectedWithin (given ctx : Context ): Option [Type ] = internal.Symbol_protectedWithin (sym )
21092110
21102111 /** The name of this symbol */
2111- def name (given ctx : Context ): String = internal.Symbol_name (self )
2112+ def name (given ctx : Context ): String = internal.Symbol_name (sym )
21122113
21132114 /** The full name of this symbol up to the root package */
2114- def fullName (given ctx : Context ): String = internal.Symbol_fullName (self )
2115+ def fullName (given ctx : Context ): String = internal.Symbol_fullName (sym )
21152116
21162117 /** The position of this symbol */
2117- def pos (given ctx : Context ): Position = internal.Symbol_pos (self )
2118+ def pos (given ctx : Context ): Position = internal.Symbol_pos (sym )
21182119
2119- def localContext (given ctx : Context ): Context = internal.Symbol_localContext (self )
2120+ def localContext (given ctx : Context ): Context = internal.Symbol_localContext (sym )
21202121
21212122 /** The comment for this symbol, if any */
2122- def comment (given ctx : Context ): Option [Comment ] = internal.Symbol_comment (self )
2123+ def comment (given ctx : Context ): Option [Comment ] = internal.Symbol_comment (sym )
21232124
21242125 /** Tree of this definition
21252126 *
@@ -2131,97 +2132,109 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
21312132 * if this symbol `isBind` it will return a `Bind`
21322133 */
21332134 def tree (given ctx : Context ): Tree =
2134- internal.Symbol_tree (self )
2135+ internal.Symbol_tree (sym )
21352136
21362137 /** Annotations attached to this symbol */
2137- def annots (given ctx : Context ): List [Term ] = internal.Symbol_annots (self )
2138+ def annots (given ctx : Context ): List [Term ] = internal.Symbol_annots (sym )
21382139
2139- def isDefinedInCurrentRun (given ctx : Context ): Boolean = internal.Symbol_isDefinedInCurrentRun (self )
2140+ def isDefinedInCurrentRun (given ctx : Context ): Boolean = internal.Symbol_isDefinedInCurrentRun (sym )
21402141
2141- def isLocalDummy (given ctx : Context ): Boolean = internal.Symbol_isLocalDummy (self )
2142- def isRefinementClass (given ctx : Context ): Boolean = internal.Symbol_isRefinementClass (self )
2143- def isAliasType (given ctx : Context ): Boolean = internal.Symbol_isAliasType (self )
2144- def isAnonymousClass (given ctx : Context ): Boolean = internal.Symbol_isAnonymousClass (self )
2145- def isAnonymousFunction (given ctx : Context ): Boolean = internal.Symbol_isAnonymousFunction (self )
2146- def isAbstractType (given ctx : Context ): Boolean = internal.Symbol_isAbstractType (self )
2147- def isClassConstructor (given ctx : Context ): Boolean = internal.Symbol_isClassConstructor (self )
2142+ def isLocalDummy (given ctx : Context ): Boolean = internal.Symbol_isLocalDummy (sym )
2143+ def isRefinementClass (given ctx : Context ): Boolean = internal.Symbol_isRefinementClass (sym )
2144+ def isAliasType (given ctx : Context ): Boolean = internal.Symbol_isAliasType (sym )
2145+ def isAnonymousClass (given ctx : Context ): Boolean = internal.Symbol_isAnonymousClass (sym )
2146+ def isAnonymousFunction (given ctx : Context ): Boolean = internal.Symbol_isAnonymousFunction (sym )
2147+ def isAbstractType (given ctx : Context ): Boolean = internal.Symbol_isAbstractType (sym )
2148+ def isClassConstructor (given ctx : Context ): Boolean = internal.Symbol_isClassConstructor (sym )
21482149
21492150 /** Is this the definition of a type? */
2150- def isType (given ctx : Context ): Boolean = internal.Symbol_isType (self )
2151+ def isType (given ctx : Context ): Boolean = internal.Symbol_isType (sym )
21512152
21522153 /** Is this the definition of a term? */
2153- def isTerm (given ctx : Context ): Boolean = internal.Symbol_isTerm (self )
2154+ def isTerm (given ctx : Context ): Boolean = internal.Symbol_isTerm (sym )
21542155
21552156 /** Is this the definition of a PackageDef tree? */
2156- def isPackageDef (given ctx : Context ): Boolean = internal.Symbol_isPackageDef (self )
2157+ def isPackageDef (given ctx : Context ): Boolean = internal.Symbol_isPackageDef (sym )
21572158
21582159 /** Is this the definition of a ClassDef tree? */
2159- def isClassDef (given ctx : Context ): Boolean = internal.Symbol_isClassDef (self )
2160+ def isClassDef (given ctx : Context ): Boolean = internal.Symbol_isClassDef (sym )
21602161
21612162 /** Is this the definition of a TypeDef tree */
2162- def isTypeDef (given ctx : Context ): Boolean = internal.Symbol_isTypeDef (self )
2163+ def isTypeDef (given ctx : Context ): Boolean = internal.Symbol_isTypeDef (sym )
21632164
21642165 /** Is this the definition of a ValDef tree? */
2165- def isValDef (given ctx : Context ): Boolean = internal.Symbol_isValDef (self )
2166+ def isValDef (given ctx : Context ): Boolean = internal.Symbol_isValDef (sym )
21662167
21672168 /** Is this the definition of a DefDef tree? */
2168- def isDefDef (given ctx : Context ): Boolean = internal.Symbol_isDefDef (self )
2169+ def isDefDef (given ctx : Context ): Boolean = internal.Symbol_isDefDef (sym )
21692170
21702171 /** Is this the definition of a Bind pattern? */
2171- def isBind (given ctx : Context ): Boolean = internal.Symbol_isBind (self )
2172+ def isBind (given ctx : Context ): Boolean = internal.Symbol_isBind (sym )
21722173
21732174 /** Does this symbol represent a no definition? */
2174- def isNoSymbol (given ctx : Context ): Boolean = self == Symbol .noSymbol
2175+ def isNoSymbol (given ctx : Context ): Boolean = sym == Symbol .noSymbol
21752176
21762177 /** Does this symbol represent a definition? */
2177- def exists (given ctx : Context ): Boolean = self != Symbol .noSymbol
2178+ def exists (given ctx : Context ): Boolean = sym != Symbol .noSymbol
21782179
21792180 /** Fields directly declared in the class */
21802181 def fields (given ctx : Context ): List [Symbol ] =
2181- internal.Symbol_fields (self )
2182+ internal.Symbol_fields (sym )
21822183
21832184 /** Field with the given name directly declared in the class */
21842185 def field (name : String )(given ctx : Context ): Symbol =
2185- internal.Symbol_field (self )(name)
2186+ internal.Symbol_field (sym )(name)
21862187
21872188 /** Get non-private named methods defined directly inside the class */
21882189 def classMethod (name : String )(given ctx : Context ): List [Symbol ] =
2189- internal.Symbol_classMethod (self )(name)
2190+ internal.Symbol_classMethod (sym )(name)
21902191
21912192 /** Get all non-private methods defined directly inside the class, exluding constructors */
21922193 def classMethods (given ctx : Context ): List [Symbol ] =
2193- internal.Symbol_classMethods (self )
2194+ internal.Symbol_classMethods (sym )
21942195
21952196 /** Get named non-private methods declared or inherited */
21962197 def method (name : String )(given ctx : Context ): List [Symbol ] =
2197- internal.Symbol_method (self )(name)
2198+ internal.Symbol_method (sym )(name)
21982199
21992200 /** Get all non-private methods declared or inherited */
22002201 def methods (given ctx : Context ): List [Symbol ] =
2201- internal.Symbol_methods (self )
2202+ internal.Symbol_methods (sym )
22022203
22032204 /** Fields of a case class type -- only the ones declared in primary constructor */
22042205 def caseFields (given ctx : Context ): List [Symbol ] =
2205- internal.Symbol_caseFields (self )
2206+ internal.Symbol_caseFields (sym )
22062207
22072208 def isTypeParam (given ctx : Context ): Boolean =
2208- internal.Symbol_isTypeParam (self )
2209+ internal.Symbol_isTypeParam (sym )
22092210
22102211 /** Signature of this definition */
22112212 def signature (given ctx : Context ): Signature =
2212- internal.Symbol_signature (self )
2213+ internal.Symbol_signature (sym )
22132214
22142215 /** The class symbol of the companion module class */
22152216 def moduleClass (given ctx : Context ): Symbol =
2216- internal.Symbol_moduleClass (self )
2217+ internal.Symbol_moduleClass (sym )
22172218
22182219 /** The symbol of the companion class */
22192220 def companionClass (given ctx : Context ): Symbol =
2220- internal.Symbol_companionClass (self )
2221+ internal.Symbol_companionClass (sym )
22212222
22222223 /** The symbol of the companion module */
22232224 def companionModule (given ctx : Context ): Symbol =
2224- internal.Symbol_companionModule (self)
2225+ internal.Symbol_companionModule (sym)
2226+
2227+ /** Shows the tree as extractors */
2228+ def showExtractors (given ctx : Context ): String =
2229+ new ExtractorsPrinter [self.type ](self).showSymbol(sym)
2230+
2231+ /** Shows the tree as fully typed source code */
2232+ def show (given ctx : Context ): String =
2233+ sym.showWith(SyntaxHighlight .plain)
2234+
2235+ /** Shows the tree as fully typed source code */
2236+ def showWith (syntaxHighlight : SyntaxHighlight )(given ctx : Context ): String =
2237+ new SourceCodePrinter [self.type ](self)(syntaxHighlight).showSymbol(sym)
22252238 }
22262239
22272240
@@ -2684,21 +2697,6 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
26842697 // PRINTERS //
26852698 // ////////////
26862699
2687- /** Adds `show` as an extension method of a `Symbol` */
2688- extension SymbolShowDeco on (symbol : Symbol ) {
2689- /** Shows the tree as extractors */
2690- def showExtractors (given ctx : Context ): String =
2691- new ExtractorsPrinter [self.type ](self).showSymbol(symbol)
2692-
2693- /** Shows the tree as fully typed source code */
2694- def show (given ctx : Context ): String =
2695- symbol.showWith(SyntaxHighlight .plain)
2696-
2697- /** Shows the tree as fully typed source code */
2698- def showWith (syntaxHighlight : SyntaxHighlight )(given ctx : Context ): String =
2699- new SourceCodePrinter [self.type ](self)(syntaxHighlight).showSymbol(symbol)
2700- }
2701-
27022700 /** Adds `show` as an extension method of a `Flags` */
27032701 extension FlagsShowDeco on (flags : Flags ) {
27042702 /** Shows the tree as extractors */
0 commit comments