summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-04-10 10:30:43 +0000
committerMartin Odersky <odersky@gmail.com>2007-04-10 10:30:43 +0000
commitc5861d824317784efb52b52a60d4194960218bb3 (patch)
treeafbbda330bc838b3406fadb7c3b5c5c2c80fa13c /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parent1f2a73f36b7e3334b03ea8d321e8b9058289fa0e (diff)
downloadscala-c5861d824317784efb52b52a60d4194960218bb3.tar.gz
scala-c5861d824317784efb52b52a60d4194960218bb3.tar.bz2
scala-c5861d824317784efb52b52a60d4194960218bb3.zip
check for variables in pattern alternatives; ch...
check for variables in pattern alternatives; changes to enable presupercall initialization.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 156700d590..6943c78226 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -230,10 +230,23 @@ trait Contexts requires Analyzer {
val argContext = baseContext.makeNewScope(tree, owner)
argContext.reportGeneralErrors = this.reportGeneralErrors
argContext.reportAmbiguousErrors = this.reportAmbiguousErrors
- for (val sym <- scope.toList) argContext.scope enter sym
+ def enterElems(c: Context) {
+ def enterLocalElems(e: ScopeEntry) {
+ if (e != null && e.owner == c.scope) {
+ enterLocalElems(e.next)
+ argContext.scope enter e.sym
+ }
+ }
+ if (c.owner.isTerm && !c.owner.isLocalDummy) {
+ enterElems(c.outer)
+ enterLocalElems(c.scope.elems)
+ }
+ }
+ enterElems(this)
argContext
}
+ //todo: remove
def makeConstructorSuffixContext = {
val c = make(tree)
c.inConstructorSuffix = true