diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-04-20 19:08:36 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-04-20 22:57:41 +0200 |
commit | 89fd256787695774771b5d4509de493271267585 (patch) | |
tree | a58383ca643d0302e4de61d783cabb138a75c7b1 /src/library | |
parent | 016bc3db52d6f1ffa3ef2285d5801f82f5f49167 (diff) | |
download | scala-89fd256787695774771b5d4509de493271267585.tar.gz scala-89fd256787695774771b5d4509de493271267585.tar.bz2 scala-89fd256787695774771b5d4509de493271267585.zip |
scala.reflect.api: Reporters => FrontEnds
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/reflect/DummyMirror.scala | 6 | ||||
-rw-r--r-- | src/library/scala/reflect/DynamicProxy.scala | 2 | ||||
-rw-r--r-- | src/library/scala/reflect/api/FrontEnds.scala (renamed from src/library/scala/reflect/api/Reporters.scala) | 13 | ||||
-rw-r--r-- | src/library/scala/reflect/api/ToolBoxes.scala | 6 | ||||
-rwxr-xr-x | src/library/scala/reflect/api/Universe.scala | 2 | ||||
-rw-r--r-- | src/library/scala/reflect/makro/Context.scala | 2 | ||||
-rw-r--r-- | src/library/scala/reflect/makro/FrontEnds.scala (renamed from src/library/scala/reflect/makro/Reporters.scala) | 8 |
7 files changed, 21 insertions, 18 deletions
diff --git a/src/library/scala/reflect/DummyMirror.scala b/src/library/scala/reflect/DummyMirror.scala index 1fbf36be9d..9607621928 100644 --- a/src/library/scala/reflect/DummyMirror.scala +++ b/src/library/scala/reflect/DummyMirror.scala @@ -161,8 +161,8 @@ class DummyMirror(cl: ClassLoader) extends api.Mirror { def wrappingPos(trees: List[Tree]): Position = notSupported() def wrappingPos(default: Position,trees: List[Tree]): Position = notSupported() - // Members declared in scala.reflect.api.Reporters - def mkConsoleReporter(minSeverity: Int): Reporter = notSupported() + // Members declared in scala.reflect.api.FrontEnds + def mkConsoleFrontEnd(minSeverity: Int): FrontEnd = notSupported() // Members declared in scala.reflect.api.Scopes type Scope = DummyScope.type @@ -471,7 +471,7 @@ class DummyMirror(cl: ClassLoader) extends api.Mirror { } // Members declared in scala.reflect.api.ToolBoxes - def mkToolBox(reporter: Reporter,options: String): AbsToolBox = notSupported() + def mkToolBox(frontEnd: FrontEnd, options: String): AbsToolBox = notSupported() // Members declared in scala.reflect.api.TreeBuildUtil // type TreeGen = DummyTreeGen.type // [Eugene] cannot compile if uncomment this diff --git a/src/library/scala/reflect/DynamicProxy.scala b/src/library/scala/reflect/DynamicProxy.scala index 02872977f5..3ed17fea41 100644 --- a/src/library/scala/reflect/DynamicProxy.scala +++ b/src/library/scala/reflect/DynamicProxy.scala @@ -43,7 +43,7 @@ trait DynamicProxy extends Dynamic{ def applyDynamicNamed( method:String )( args:(String,DynamicReflectBoxed)* ) : Any = { val class_ = dynamicProxyTarget.getClass var i = 0 - val toolbox = mkToolBox(mkConsoleReporter(),"") + val toolbox = mkToolBox(mkConsoleFrontEnd(),"") val symbol = classToType( dynamicProxyTarget.getClass ).member( newTermName(method).encodedName ) if(args.size == 0){ invoke( dynamicProxyTarget, symbol )() diff --git a/src/library/scala/reflect/api/Reporters.scala b/src/library/scala/reflect/api/FrontEnds.scala index b7428e1599..2c1f3feff6 100644 --- a/src/library/scala/reflect/api/Reporters.scala +++ b/src/library/scala/reflect/api/FrontEnds.scala @@ -1,9 +1,9 @@ package scala.reflect package api -trait Reporters { self: Universe => +trait FrontEnds { self: Universe => - trait Reporter { + trait FrontEnd { object severity extends Enumeration class Severity(val id: Int) extends severity.Value { var count: Int = 0 @@ -18,6 +18,9 @@ trait Reporters { self: Universe => val WARNING = new Severity(1) val ERROR = new Severity(2) + def hasErrors = ERROR.count > 0 + def hasWarnings = WARNING.count > 0 + case class Info(val pos: Position, val msg: String, val severity: Severity) val infos = new collection.mutable.LinkedHashSet[Info] @@ -46,14 +49,14 @@ trait Reporters { self: Universe => } } - class SilentReporter extends Reporter { + class SilentFrontEnd extends FrontEnd { def display(info: Info) {} def interactive() {} } /** Creates a UI-less reporter that simply accumulates all the messages */ - def mkSilentReporter(): Reporter = new SilentReporter() + def mkSilentFrontEnd(): FrontEnd = new SilentFrontEnd() /** Creates a reporter that prints messages to the console according to the settings. * @@ -61,5 +64,5 @@ trait Reporters { self: Universe => * 0 stands for INFO, 1 stands for WARNING and 2 stands for ERROR. */ // todo. untangle warningsAsErrors from Reporters. I don't feel like moving this flag here! - def mkConsoleReporter(minSeverity: Int = 1): Reporter + def mkConsoleFrontEnd(minSeverity: Int = 1): FrontEnd }
\ No newline at end of file diff --git a/src/library/scala/reflect/api/ToolBoxes.scala b/src/library/scala/reflect/api/ToolBoxes.scala index 387ef5163b..aefd6b511c 100644 --- a/src/library/scala/reflect/api/ToolBoxes.scala +++ b/src/library/scala/reflect/api/ToolBoxes.scala @@ -5,17 +5,17 @@ trait ToolBoxes { self: Universe => type ToolBox <: AbsToolBox - def mkToolBox(reporter: Reporter = mkSilentReporter(), options: String = ""): AbsToolBox + def mkToolBox(frontEnd: FrontEnd = mkSilentFrontEnd(), options: String = ""): AbsToolBox // [Eugene] what do you think about the interface? namely about the ``freeTypes'' part. trait AbsToolBox { - /** UI of the toolbox. + /** Front end of the toolbox. * * Accumulates and displays warnings and errors, can drop to interactive mode (if supported). * The latter can be useful to study the typechecker or to debug complex macros. */ - def reporter: Reporter + def frontEnd: FrontEnd /** Typechecks a tree using this ToolBox. * This populates symbols and types of the tree and possibly transforms it to reflect certain desugarings. diff --git a/src/library/scala/reflect/api/Universe.scala b/src/library/scala/reflect/api/Universe.scala index d1f546608e..2b22839d39 100755 --- a/src/library/scala/reflect/api/Universe.scala +++ b/src/library/scala/reflect/api/Universe.scala @@ -19,7 +19,7 @@ abstract class Universe extends Symbols with ClassLoaders with TreeBuildUtil with ToolBoxes - with Reporters + with FrontEnds with Importers { /** Given an expression, generate a tree that when compiled and executed produces the original tree. diff --git a/src/library/scala/reflect/makro/Context.scala b/src/library/scala/reflect/makro/Context.scala index 5ce801e2e6..b304d98a5a 100644 --- a/src/library/scala/reflect/makro/Context.scala +++ b/src/library/scala/reflect/makro/Context.scala @@ -12,7 +12,7 @@ trait Context extends Aliases with Infrastructure with Names with Reifiers - with Reporters + with FrontEnds with Settings with Symbols with Typers diff --git a/src/library/scala/reflect/makro/Reporters.scala b/src/library/scala/reflect/makro/FrontEnds.scala index 7341b0e0b7..a1e24dcea3 100644 --- a/src/library/scala/reflect/makro/Reporters.scala +++ b/src/library/scala/reflect/makro/FrontEnds.scala @@ -1,14 +1,14 @@ package scala.reflect.makro -trait Reporters { +trait FrontEnds { self: Context => import mirror._ /** Exposes means to control the compiler UI */ - def reporter: Reporter - def setReporter(reporter: Reporter): this.type - def withReporter[T](reporter: Reporter)(op: => T): T + def frontEnd: FrontEnd + def setFrontEnd(frontEnd: FrontEnd): this.type + def withFrontEnd[T](frontEnd: FrontEnd)(op: => T): T /** For sending a message which should not be labeled as a warning/error, * but also shouldn't require -verbose to be visible. |