File tree Expand file tree Collapse file tree 7 files changed +36
-0
lines changed 
compiler/src/dotty/tools/dotc/tastyreflect Expand file tree Collapse file tree 7 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ package  dotty .tools .dotc .tastyreflect 
2+ 
3+ trait  SettingsOpsImpl  extends  scala.tasty.reflect.SettingsOps  with  TastyCoreImpl  {
4+ 
5+   def  settings (implicit  ctx : Context ):  Settings  =  ctx.settings
6+ 
7+   def  SettingsDeco (settings : Settings ):  SettingsAPI  =  new  SettingsAPI  {
8+     def  color (implicit  ctx : Context ):  Boolean  =  settings.color.value ==  " always" 
9+   }
10+ 
11+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ trait TastyCoreImpl extends scala.tasty.reflect.TastyCore {
99
1010  type  Context  =  core.Contexts .Context 
1111
12+   type  Settings  =  config.ScalaSettings 
13+ 
1214  type  TermOrTypeTree  =  tpd.Tree 
1315
1416  type  Tree  =  tpd.Tree 
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class TastyImpl(val rootContext: Contexts.Context)
1414    with  PatternOpsImpl 
1515    with  PositionOpsImpl 
1616    with  PrintersImpl 
17+     with  SettingsOpsImpl 
1718    with  SignatureOpsImpl 
1819    with  StandardDefinitions 
1920    with  SymbolOpsImpl 
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ abstract class Tasty
1313    with  PatternOps 
1414    with  PositionOps 
1515    with  Printers 
16+     with  SettingsOps 
1617    with  SignatureOps 
1718    with  StandardDefinitions 
1819    with  SymbolOps 
Original file line number Diff line number Diff line change 1+ package  scala .tasty .reflect 
2+ 
3+ trait  SettingsOps  extends  TastyCore  {
4+ 
5+   /**  Compiler settings */  
6+   def  settings (implicit  ctx : Context ):  Settings 
7+ 
8+   trait  SettingsAPI  {
9+     def  color (implicit  ctx : Context ):  Boolean 
10+   }
11+   implicit  def  SettingsDeco (settings : Settings ):  SettingsAPI 
12+ 
13+ }
Original file line number Diff line number Diff line change @@ -114,6 +114,9 @@ trait TastyCore {
114114  /**  Compilation context */  
115115  type  Context 
116116
117+   /**  Settings */  
118+   type  Settings 
119+ 
117120  //  TODO: When bootstrapped, remove and use `Term | TypeTree` type directly in other files
118121  /**  Workaround missing `|` types in Scala 2 to represent `Term | TypeTree` */  
119122  type  TermOrTypeTree  /*  Term | TypeTree */ 
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import scala.annotation.switch
66class  ShowSourceCode [T  <:  Tasty  with  Singleton ](tasty0 : T ) extends  Show [T ](tasty0) {
77  import  tasty .{rootContext  =>  _ , _ }
88
9+   private [this ] val  color :  Boolean  =  {
10+     import  tasty .rootContext 
11+     tasty.settings.color
12+   }
13+ 
914  def  showTree (tree : Tree )(implicit  ctx : Context ):  String  = 
1015    (new  Buffer ).printTree(tree).result()
1116
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments