Skip to content

Commit f175435

Browse files
committed
Move FlagsShowDeco inot FlagsOps
1 parent 704b45a commit f175435

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

library/src/scala/tasty/Reflection.scala

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,16 +2500,29 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
25002500
// FLAGS //
25012501
///////////////
25022502

2503-
extension FlagsOps on (self: Flags) {
2503+
/** Members of `Flag` */
2504+
extension FlagsOps on (flags: Flags) {
25042505

25052506
/** Is the given flag set a subset of this flag sets */
2506-
def is(that: Flags): Boolean = internal.Flags_is(self)(that)
2507+
def is(that: Flags): Boolean = internal.Flags_is(flags)(that)
25072508

25082509
/** Union of the two flag sets */
2509-
def |(that: Flags): Flags = internal.Flags_or(self)(that)
2510+
def |(that: Flags): Flags = internal.Flags_or(flags)(that)
25102511

25112512
/** Intersection of the two flag sets */
2512-
def &(that: Flags): Flags = internal.Flags_and(self)(that)
2513+
def &(that: Flags): Flags = internal.Flags_and(flags)(that)
2514+
2515+
/** Shows the tree as extractors */
2516+
def showExtractors(given ctx: Context): String =
2517+
new ExtractorsPrinter[self.type](self).showFlags(flags)
2518+
2519+
/** Shows the tree as fully typed source code */
2520+
def show(given ctx: Context): String =
2521+
flags.showWith(SyntaxHighlight.plain)
2522+
2523+
/** Shows the tree as fully typed source code */
2524+
def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String =
2525+
new SourceCodePrinter[self.type](self)(syntaxHighlight).showFlags(flags)
25132526

25142527
}
25152528

@@ -2693,25 +2706,6 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
26932706
def warning(msg: => String, source: SourceFile, start: Int, end: Int)(given ctx: Context): Unit =
26942707
internal.warning(msg, source, start, end)
26952708

2696-
//////////////
2697-
// PRINTERS //
2698-
//////////////
2699-
2700-
/** Adds `show` as an extension method of a `Flags` */
2701-
extension FlagsShowDeco on (flags: Flags) {
2702-
/** Shows the tree as extractors */
2703-
def showExtractors(given ctx: Context): String =
2704-
new ExtractorsPrinter[self.type](self).showFlags(flags)
2705-
2706-
/** Shows the tree as fully typed source code */
2707-
def show(given ctx: Context): String =
2708-
flags.showWith(SyntaxHighlight.plain)
2709-
2710-
/** Shows the tree as fully typed source code */
2711-
def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String =
2712-
new SourceCodePrinter[self.type](self)(syntaxHighlight).showFlags(flags)
2713-
}
2714-
27152709

27162710
//////////////
27172711
// COMMENTS //

0 commit comments

Comments
 (0)