1d5a3b774e59 — Leonard Ritter 1 year, 1 month ago
* compiler.Printer: export new implementations of `print`, `report`, `repr` and `tostring`
1 files changed, 15 insertions(+), 4 deletions(-)

M lib/scopes/compiler/Printer.sc
M lib/scopes/compiler/Printer.sc +15 -4
@@ 248,7 248,6 @@ struct StringPrinter < Printer
         countof self.string
 
     inline tostring (self)
-        'flush-style self
         'emit (storagecast self) 'string
 
     inline fwrite (self str size)

          
@@ 456,9 455,9 @@ inline /nolines (...)
 inline /nostyle (...)
     @@ printer
     inline (ss)
-        'flush-style ss
         prev-style := 'get-style ss
         'set-style ss Style.None
+        'flush-style ss
         do
             ss := 'change-options ss
                 ANSI? = false

          
@@ 643,6 642,13 @@ inline cprint2 (...)
 inline crepr (...)
     sprint := (StringPrinter)
     (view sprint) ...
+    'flush-style sprint
+    'tostring sprint
+
+inline ctostring (...)
+    sprint := (StringPrinter)
+    (view sprint)
+        /nostyle ...
     'tostring sprint
 
 spice creport (...)

          
@@ 850,6 856,11 @@ static-if main-module?
 do
     let Printer ErrorPrinter StdPrinter Styled Style /nostyle /s /.. /n /p /t
     let /nolines /pc /ps /pn /tstyle ReprIndentToken /n? /quote /string
-    let cprint cprint2 StringPrinter printer creport /data /depth char-printable?
-    let crepr
+    let /data /depth char-printable? StringPrinter
+    let
+        print = cprint
+        print2 = cprint2
+        report = creport
+        repr = crepr
+        tostring = ctostring
     locals;