summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-04-12 23:20:03 +0000
committerPaul Phillips <paulp@improving.org>2010-04-12 23:20:03 +0000
commit4f12f2af975af384202ccd123c067d8e04bff516 (patch)
tree5a562dd1685a4de44455e10e0768783e2f1c08fc /src/compiler/scala/tools/nsc/settings/MutableSettings.scala
parent406e54b7e59671462c4057894776f04d8f77b80e (diff)
downloadscala-4f12f2af975af384202ccd123c067d8e04bff516.tar.gz
scala-4f12f2af975af384202ccd123c067d8e04bff516.tar.bz2
scala-4f12f2af975af384202ccd123c067d8e04bff516.zip
Noticed that Settings post-set hooks were not b...
Noticed that Settings post-set hooks were not being set in the place where they ought to be, so multiple setting settings (such as -optimise) were not flipping all the right bits when set programmatically instead of via command line options. This may be a factor in inlining issues, though by itself it does not appear to solve anything. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/settings/MutableSettings.scala')
-rw-r--r--src/compiler/scala/tools/nsc/settings/MutableSettings.scala14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
index 8012b9389b..b32796e829 100644
--- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
@@ -95,10 +95,7 @@ class MutableSettings(val errorFn: String => Unit) extends AbsSettings with Scal
): Option[List[String]] =
lookupSetting(cmd) match {
case None => errorFn("Parameter '" + cmd + "' is not recognised by Scalac.") ; None
- case Some(cmd) =>
- val res = setter(cmd)(args)
- cmd.postSetHook()
- res
+ case Some(cmd) => setter(cmd)(args)
}
// if arg is of form -Xfoo:bar,baz,quux
@@ -191,10 +188,15 @@ class MutableSettings(val errorFn: String => Unit) extends AbsSettings with Scal
trait SettingValue extends AbsSettingValue {
protected var v: T
protected var setByUser: Boolean = false
+ def postSetHook(): Unit
def isDefault: Boolean = !setByUser
def value: T = v
- def value_=(arg: T) = { setByUser = true ; v = arg }
+ def value_=(arg: T) = {
+ setByUser = true
+ v = arg
+ postSetHook()
+ }
}
/** A class for holding mappings from source directories to
@@ -305,7 +307,7 @@ class MutableSettings(val errorFn: String => Unit) extends AbsSettings with Scal
abstract class Setting(val name: String, val helpDescription: String) extends AbsSetting with SettingValue with Mutable {
/** Will be called after this Setting is set for any extra work. */
private var _postSetHook: this.type => Unit = (x: this.type) => ()
- def postSetHook() = { _postSetHook(this) ; this }
+ def postSetHook(): Unit = _postSetHook(this)
def withPostSetHook(f: this.type => Unit): this.type = { _postSetHook = f ; this }
/** The syntax defining this setting in a help string */