File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,11 @@ class GenBCode extends Phase {
5252 new PlainDirectory (new Directory (new JFile (ctx.settings.d.value)))
5353
5454 def run (implicit ctx : Context ): Unit = {
55- new GenBCodePipeline (entryPoints.toList,
56- new DottyBackendInterface (outputDir, superCallsMap.toMap)(ctx))(ctx).run(ctx.compilationUnit.tpdTree)
55+ val saved = Names .useMangled
56+ Names .useMangled = true
57+ try new GenBCodePipeline (entryPoints.toList,
58+ new DottyBackendInterface (outputDir, superCallsMap.toMap)(ctx))(ctx).run(ctx.compilationUnit.tpdTree)
59+ finally Names .useMangled = saved
5760 entryPoints.clear()
5861 }
5962}
Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ import java.util.HashMap
2222object Names {
2323 import NameKinds ._
2424
25+ // Gross hack because the backend uses toString on arbitrary names, which means
26+ // that the NameHelper abstraction is leaky. As long as cannot get rid of this,
27+ // parallel compilation is impossible.
28+ @ sharable var useMangled : Boolean = false
29+
2530 /** A common class for things that can be turned into names.
2631 * Instances are both names and strings, the latter via a decorator.
2732 */
@@ -295,7 +300,11 @@ object Names {
295300 override def hashCode : Int = start
296301
297302 override def toString =
298- if (length == 0 ) " " else new String (chrs, start, length)
303+ if (length == 0 ) " "
304+ else {
305+ val n = if (useMangled) mangled.asSimpleName else this
306+ new String (chrs, n.start, n.length)
307+ }
299308
300309 def sliceToString (from : Int , end : Int ) =
301310 if (end <= from) " " else new String (chrs, start + from, end - from)
You can’t perform that action at this time.
0 commit comments