aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/unpickleScala2
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-01 17:21:39 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:12 +0200
commite4780e574f9613346e6908f7947f40a58327e376 (patch)
tree86272adfb176be109d35ceac9573f314598ee702 /compiler/src/dotty/tools/dotc/core/unpickleScala2
parente2fb134fd3a49848ea49a6db42a298276c08b110 (diff)
downloaddotty-e4780e574f9613346e6908f7947f40a58327e376.tar.gz
dotty-e4780e574f9613346e6908f7947f40a58327e376.tar.bz2
dotty-e4780e574f9613346e6908f7947f40a58327e376.zip
Keep package member names mangled
Once we start using unencoded operators internally, we will face the problem that one cannot decode realiably a class file filename. We therefore turn things around, keeping members of package scopes in mangled and encoded form. This is compensated by (1) mangling names for lookup of such members and (2) when unpickling from Scala 2 info or Tasty, comparing mangled names when matching a read class or module object against a root.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/unpickleScala2')
-rw-r--r--compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
index 5871ec46c..1e8fbe54b 100644
--- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
@@ -448,15 +448,18 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
flags = flags &~ Scala2SuperAccessor
}
- def isClassRoot = (name == classRoot.name) && (owner == classRoot.owner) && !(flags is ModuleClass)
- def isModuleClassRoot = (name == moduleClassRoot.name) && (owner == moduleClassRoot.owner) && (flags is Module)
- def isModuleRoot = (name == moduleClassRoot.name.sourceModuleName) && (owner == moduleClassRoot.owner) && (flags is Module)
+ val sname = name.toSimpleName
+ def nameMatches(rootName: Name) = sname == rootName.toSimpleName
+ def isClassRoot = nameMatches(classRoot.name) && (owner == classRoot.owner) && !(flags is ModuleClass)
+ def isModuleClassRoot = nameMatches(moduleClassRoot.name) && (owner == moduleClassRoot.owner) && (flags is Module)
+ def isModuleRoot = nameMatches(moduleClassRoot.name.sourceModuleName) && (owner == moduleClassRoot.owner) && (flags is Module)
//if (isClassRoot) println(s"classRoot of $classRoot found at $readIndex, flags = $flags") // !!! DEBUG
//if (isModuleRoot) println(s"moduleRoot of $moduleRoot found at $readIndex, flags = $flags") // !!! DEBUG
//if (isModuleClassRoot) println(s"moduleClassRoot of $moduleClassRoot found at $readIndex, flags = $flags") // !!! DEBUG
def completeRoot(denot: ClassDenotation, completer: LazyType): Symbol = {
+ denot.name = name
denot.setFlag(flags)
denot.resetFlag(Touched) // allow one more completion
denot.info = completer