diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-09 19:48:04 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-21 12:59:46 +0200 |
commit | ff5dde125a9a88395f52a898a26aabb28f81f5e9 (patch) | |
tree | b6dc2b1f36b24c15d79269d997220e39420cff17 | |
parent | b1cb00456e6ff545a4c6b8e8d1fe32823e832418 (diff) | |
download | scala-ff5dde125a9a88395f52a898a26aabb28f81f5e9.tar.gz scala-ff5dde125a9a88395f52a898a26aabb28f81f5e9.tar.bz2 scala-ff5dde125a9a88395f52a898a26aabb28f81f5e9.zip |
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`.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 9af9de37e0..bc7fb48571 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/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 |