summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/classfile
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-27 15:45:18 +0300
committerEugene Burmako <xeno.by@gmail.com>2014-02-12 14:53:48 +0100
commitc34b24a6c4b75a6215bdb8fd8ff94ce869430435 (patch)
tree4792a96322e2f30b7fe1830091cf748503636bfc /src/compiler/scala/tools/nsc/symtab/classfile
parent7c06c9d7f6a12c2b13c83b195fffa30c5a4ec3ce (diff)
downloadscala-c34b24a6c4b75a6215bdb8fd8ff94ce869430435.tar.gz
scala-c34b24a6c4b75a6215bdb8fd8ff94ce869430435.tar.bz2
scala-c34b24a6c4b75a6215bdb8fd8ff94ce869430435.zip
disambiguates uses of “local” in internal symbol API
There’s been a conflation of two distinct meanings of the word “local” in the internal symbol API: the first meaning being “local to this” (as in has the LOCAL flag set), the second meaning being “local to block” (as in declared in a block, i.e. having owner being a term symbol). Especially confusing is the fact that sym.isLocal isn’t the same as sym.hasFlag(LOCAL), which has led to now fixed SI-6733. This commit fixes the semantic mess by deprecating both Symbol.isLocal and Symbol.hasLocalFlag (that we were forced to use, because Symbol.isLocal had already been taken), and replacing them with Symbol.isLocalToThis and Symbol.isLocalToBlock. Unfortunately, we can’t remove the deprecated methods right away, because they are used in SBT, so I had to take small steps.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index 55f45257dc..592c5497b5 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -99,7 +99,7 @@ abstract class Pickler extends SubComponent {
* added to fix that bug, but there may be a better way.
*/
private def localizedOwner(sym: Symbol) =
- if (isLocal(sym) && !isRootSym(sym) && !isLocal(sym.owner))
+ if (isLocalToPickle(sym) && !isRootSym(sym) && !isLocalToPickle(sym.owner))
// don't use a class as the localized owner for type parameters that are not owned by a class: those are not instantiated by asSeenFrom
// however, they would suddenly be considered by asSeenFrom if their localized owner became a class (causing the crashes of #4079, #2741)
(if ((sym.isTypeParameter || sym.isValueParameter) && !sym.owner.isClass) nonClassRoot
@@ -110,14 +110,14 @@ abstract class Pickler extends SubComponent {
* anyway? This is the case if symbol is a refinement class,
* an existentially bound variable, or a higher-order type parameter.
*/
- private def isLocal(sym: Symbol): Boolean = (sym != NoSymbol) && !sym.isPackageClass && (
+ private def isLocalToPickle(sym: Symbol): Boolean = (sym != NoSymbol) && !sym.isPackageClass && (
isRootSym(sym)
|| sym.isRefinementClass
|| sym.isAbstractType && sym.hasFlag(EXISTENTIAL) // existential param
|| sym.isParameter
- || isLocal(sym.owner)
+ || isLocalToPickle(sym.owner)
)
- private def isExternalSymbol(sym: Symbol): Boolean = (sym != NoSymbol) && !isLocal(sym)
+ private def isExternalSymbol(sym: Symbol): Boolean = (sym != NoSymbol) && !isLocalToPickle(sym)
// Phase 1 methods: Populate entries/index ------------------------------------
@@ -174,7 +174,7 @@ abstract class Pickler extends SubComponent {
val sym = deskolemize(sym0)
if (putEntry(sym)) {
- if (isLocal(sym)) {
+ if (isLocalToPickle(sym)) {
putEntry(sym.name)
putSymbol(sym.owner)
putSymbol(sym.privateWithin)
@@ -428,7 +428,7 @@ abstract class Pickler extends SubComponent {
}
def writeSymbolBody(sym: Symbol) {
if (sym ne NoSymbol) {
- if (isLocal(sym))
+ if (isLocalToPickle(sym))
writeLocalSymbolBody(sym)
else
writeExtSymbolBody(sym)