summaryrefslogtreecommitdiff
path: root/src/continuations
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2013-07-01 21:20:05 +0200
committerSimon Ochsenreither <simon@ochsenreither.de>2013-07-06 12:22:13 +0200
commit415dda408d6bee761a6249a4a9578e6f50527a83 (patch)
tree5284f2fb7fe51ce912f89a6e40fac38afd61cb4f /src/continuations
parente2c173673f4068babde8e927a5d951e260b2942d (diff)
downloadscala-415dda408d6bee761a6249a4a9578e6f50527a83.tar.gz
scala-415dda408d6bee761a6249a4a9578e6f50527a83.tar.bz2
scala-415dda408d6bee761a6249a4a9578e6f50527a83.zip
SI-7174 Fix initialization issues
Without constant inlining, the compiler would not even bootstrap because it depends on constant inlining hiding initialization issues which would cause a NPE otherwise. In this case, global is null at runtime, but no NPE is happening despite accessing members of global (see SubComponent), because constant inlining has copied the values of those members to the call-sites and eliminated the dereference of global. This commit fixes the initialization order.
Diffstat (limited to 'src/continuations')
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala
index c16cce2f2c..d3b02d74f4 100644
--- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala
+++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala
@@ -11,22 +11,18 @@ class SelectiveCPSPlugin(val global: Global) extends Plugin {
val name = "continuations"
val description = "applies selective cps conversion"
- val anfPhase = new SelectiveANFTransform() {
- val global = SelectiveCPSPlugin.this.global
+ val anfPhase = new {val global = SelectiveCPSPlugin.this.global } with SelectiveANFTransform() {
val runsAfter = List("pickler")
}
- val cpsPhase = new SelectiveCPSTransform() {
- val global = SelectiveCPSPlugin.this.global
+ val cpsPhase = new {val global = SelectiveCPSPlugin.this.global } with SelectiveCPSTransform() {
val runsAfter = List("selectiveanf")
override val runsBefore = List("uncurry")
}
val components = List[PluginComponent](anfPhase, cpsPhase)
- val checker = new CPSAnnotationChecker {
- val global: SelectiveCPSPlugin.this.global.type = SelectiveCPSPlugin.this.global
- }
+ val checker = new { val global: SelectiveCPSPlugin.this.global.type = SelectiveCPSPlugin.this.global } with CPSAnnotationChecker
global.addAnnotationChecker(checker.checker)
global.analyzer.addAnalyzerPlugin(checker.plugin)