@@ -2090,36 +2090,37 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
2090
2090
internal.Symbol_noSymbol
2091
2091
}
2092
2092
2093
- extension symbolOps on (self : Symbol ) {
2093
+ /** Members of `Symbol` */
2094
+ extension SymbolOps on (sym : Symbol ) {
2094
2095
2095
2096
/** 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 )
2097
2098
2098
2099
/** 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 )
2100
2101
2101
2102
/** 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 )
2103
2104
2104
2105
/** 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 )
2106
2107
2107
2108
/** 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 )
2109
2110
2110
2111
/** 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 )
2112
2113
2113
2114
/** 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 )
2115
2116
2116
2117
/** 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 )
2118
2119
2119
- def localContext (given ctx : Context ): Context = internal.Symbol_localContext (self )
2120
+ def localContext (given ctx : Context ): Context = internal.Symbol_localContext (sym )
2120
2121
2121
2122
/** 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 )
2123
2124
2124
2125
/** Tree of this definition
2125
2126
*
@@ -2131,97 +2132,109 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
2131
2132
* if this symbol `isBind` it will return a `Bind`
2132
2133
*/
2133
2134
def tree (given ctx : Context ): Tree =
2134
- internal.Symbol_tree (self )
2135
+ internal.Symbol_tree (sym )
2135
2136
2136
2137
/** 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 )
2138
2139
2139
- def isDefinedInCurrentRun (given ctx : Context ): Boolean = internal.Symbol_isDefinedInCurrentRun (self )
2140
+ def isDefinedInCurrentRun (given ctx : Context ): Boolean = internal.Symbol_isDefinedInCurrentRun (sym )
2140
2141
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 )
2148
2149
2149
2150
/** 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 )
2151
2152
2152
2153
/** 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 )
2154
2155
2155
2156
/** 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 )
2157
2158
2158
2159
/** 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 )
2160
2161
2161
2162
/** 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 )
2163
2164
2164
2165
/** 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 )
2166
2167
2167
2168
/** 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 )
2169
2170
2170
2171
/** 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 )
2172
2173
2173
2174
/** 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
2175
2176
2176
2177
/** 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
2178
2179
2179
2180
/** Fields directly declared in the class */
2180
2181
def fields (given ctx : Context ): List [Symbol ] =
2181
- internal.Symbol_fields (self )
2182
+ internal.Symbol_fields (sym )
2182
2183
2183
2184
/** Field with the given name directly declared in the class */
2184
2185
def field (name : String )(given ctx : Context ): Symbol =
2185
- internal.Symbol_field (self )(name)
2186
+ internal.Symbol_field (sym )(name)
2186
2187
2187
2188
/** Get non-private named methods defined directly inside the class */
2188
2189
def classMethod (name : String )(given ctx : Context ): List [Symbol ] =
2189
- internal.Symbol_classMethod (self )(name)
2190
+ internal.Symbol_classMethod (sym )(name)
2190
2191
2191
2192
/** Get all non-private methods defined directly inside the class, exluding constructors */
2192
2193
def classMethods (given ctx : Context ): List [Symbol ] =
2193
- internal.Symbol_classMethods (self )
2194
+ internal.Symbol_classMethods (sym )
2194
2195
2195
2196
/** Get named non-private methods declared or inherited */
2196
2197
def method (name : String )(given ctx : Context ): List [Symbol ] =
2197
- internal.Symbol_method (self )(name)
2198
+ internal.Symbol_method (sym )(name)
2198
2199
2199
2200
/** Get all non-private methods declared or inherited */
2200
2201
def methods (given ctx : Context ): List [Symbol ] =
2201
- internal.Symbol_methods (self )
2202
+ internal.Symbol_methods (sym )
2202
2203
2203
2204
/** Fields of a case class type -- only the ones declared in primary constructor */
2204
2205
def caseFields (given ctx : Context ): List [Symbol ] =
2205
- internal.Symbol_caseFields (self )
2206
+ internal.Symbol_caseFields (sym )
2206
2207
2207
2208
def isTypeParam (given ctx : Context ): Boolean =
2208
- internal.Symbol_isTypeParam (self )
2209
+ internal.Symbol_isTypeParam (sym )
2209
2210
2210
2211
/** Signature of this definition */
2211
2212
def signature (given ctx : Context ): Signature =
2212
- internal.Symbol_signature (self )
2213
+ internal.Symbol_signature (sym )
2213
2214
2214
2215
/** The class symbol of the companion module class */
2215
2216
def moduleClass (given ctx : Context ): Symbol =
2216
- internal.Symbol_moduleClass (self )
2217
+ internal.Symbol_moduleClass (sym )
2217
2218
2218
2219
/** The symbol of the companion class */
2219
2220
def companionClass (given ctx : Context ): Symbol =
2220
- internal.Symbol_companionClass (self )
2221
+ internal.Symbol_companionClass (sym )
2221
2222
2222
2223
/** The symbol of the companion module */
2223
2224
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)
2225
2238
}
2226
2239
2227
2240
@@ -2684,21 +2697,6 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
2684
2697
// PRINTERS //
2685
2698
// ////////////
2686
2699
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
-
2702
2700
/** Adds `show` as an extension method of a `Flags` */
2703
2701
extension FlagsShowDeco on (flags : Flags ) {
2704
2702
/** Shows the tree as extractors */
0 commit comments