diff options
author | Martin Odersky <odersky@gmail.com> | 2011-09-07 15:26:26 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-09-07 15:26:26 +0000 |
commit | 8cd3eae681f938ceb64578ffa8bdc69d85c20781 (patch) | |
tree | 418201219b5cfa097b31dd8840441ae22c79a39a /src/compiler/scala/reflect/internal/Scopes.scala | |
parent | 68806429fbd41b6fdfe55da4c124ad1bf2ba8cc4 (diff) | |
download | scala-8cd3eae681f938ceb64578ffa8bdc69d85c20781.tar.gz scala-8cd3eae681f938ceb64578ffa8bdc69d85c20781.tar.bz2 scala-8cd3eae681f938ceb64578ffa8bdc69d85c20781.zip |
Another problem solved for reflexive compiler.
Diffstat (limited to 'src/compiler/scala/reflect/internal/Scopes.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/Scopes.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/reflect/internal/Scopes.scala b/src/compiler/scala/reflect/internal/Scopes.scala index e71d4147ed..a73b0f4b4f 100644 --- a/src/compiler/scala/reflect/internal/Scopes.scala +++ b/src/compiler/scala/reflect/internal/Scopes.scala @@ -74,10 +74,7 @@ trait Scopes extends api.Scopes { self: SymbolTable => } /** Returns a new scope with the same content as this one. */ - def cloneScope: Scope = mkScope(this.toList) - - /** Returns a new scope of the same class as this one, with initial elements `decls` */ - def mkScope(decls: List[Symbol] = Nil): Scope = new Scope(decls) + def cloneScope: Scope = new Scope(this.toList) /** is the scope empty? */ override def isEmpty: Boolean = elems eq null @@ -299,7 +296,7 @@ trait Scopes extends api.Scopes { self: SymbolTable => override def foreach[U](p: Symbol => U): Unit = toList foreach p override def filter(p: Symbol => Boolean): Scope = - if (!(toList forall p)) mkScope(toList filter p) else this + if (!(toList forall p)) new Scope(toList filter p) else this override def mkString(start: String, sep: String, end: String) = toList.map(_.defString).mkString(start, sep, end) @@ -314,6 +311,11 @@ trait Scopes extends api.Scopes { self: SymbolTable => /** Create new scope for the members of package `pkg` */ def newPackageScope(pkgClass: Symbol): Scope = new Scope + /** Transform scope of members of `owner` using operation `op` + * This is overridden by the reflective compiler to avoid creating new scopes for packages + */ + def scopeTransform(owner: Symbol)(op: => Scope): Scope = op + def newScopeWith(elems: Symbol*) = { val scope = newScope elems foreach scope.enter |