Permalink
Browse files

SI-7345 Add Context#isLocal, akin to Symbol#isLocal

Out with the old, in with the new. `isLocal()`, which
has been removed, was unused. `isLocal`, the new entry,
has the same semantics as `Symbol#isLocal`.
  • Loading branch information...
1 parent b1cb004 commit ff5dde125a9a88395f52a898a26aabb28f81f5e9 @retronym retronym committed Apr 9, 2013
Showing with 4 additions and 8 deletions.
  1. +4 −8 src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -269,7 +269,7 @@ trait Contexts { self: Analyzer =>
c.prefix =
if (isTemplateOrPackage) c.owner.thisType
- else if (c.owner != this.owner && c.owner.isTerm) NoPrefix
+ else if (c.owner != this.owner && c.isLocal) NoPrefix
else prefix
c.enclClass = if (isTemplateOrPackage) c else enclClass
c(ConstructorSuffix) = !isTemplateOrPackage && c(ConstructorSuffix)
@@ -340,7 +340,7 @@ trait Contexts { self: Analyzer =>
argContext.scope enter e.sym
}
}
- if (c.owner.isTerm && !c.owner.isLocalDummy) {
+ if (c.isLocal && !c.owner.isLocalDummy) {
enterElems(c.outer)
enterLocalElems(c.scope.elems)
}
@@ -405,12 +405,8 @@ trait Contexts { self: Analyzer =>
else if (bufferErrors) warningsBuffer += ((pos, msg))
}
- def isLocal(): Boolean = tree match {
- case Block(_,_) => true
- case PackageDef(_, _) => false
- case EmptyTree => false
- case _ => outer.isLocal()
- }
+ /** Is the owning symbol of this context a term? */
+ final def isLocal: Boolean = owner.isTerm
def isNameInScope(name: Name) = lookupSymbol(name, _ => true).isSuccess

0 comments on commit ff5dde1

Please sign in to comment.