aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Scopes.scala
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/Scopes.scala
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/Scopes.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Scopes.scala10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Scopes.scala b/compiler/src/dotty/tools/dotc/core/Scopes.scala
index 6090079e5..032442421 100644
--- a/compiler/src/dotty/tools/dotc/core/Scopes.scala
+++ b/compiler/src/dotty/tools/dotc/core/Scopes.scala
@@ -394,6 +394,14 @@ object Scopes {
}
}
+ class PackageScope extends MutableScope {
+ override final def newScopeEntry(name: Name, sym: Symbol)(implicit ctx: Context): ScopeEntry =
+ super.newScopeEntry(name.toSimpleName, sym)
+
+ override final def lookupEntry(name: Name)(implicit ctx: Context): ScopeEntry =
+ super.lookupEntry(name.toSimpleName)
+ }
+
/** Create a new scope */
def newScope: MutableScope = new MutableScope()
@@ -408,7 +416,7 @@ object Scopes {
}
/** Create new scope for the members of package `pkg` */
- def newPackageScope(pkgClass: Symbol): MutableScope = newScope
+ def newPackageScope(pkgClass: Symbol): MutableScope = new PackageScope()
/** Transform scope of members of `owner` using operation `op`
* This is overridden by the reflective compiler to avoid creating new scopes for packages