@@ -19,48 +19,48 @@ object ContextOps:
1919 def enter (sym : Symbol ): Symbol = inContext(ctx) {
2020 ctx.owner match
2121 case cls : ClassSymbol => cls.classDenot.enter(sym)
22- case _ => scope.openForMutations.enter(sym)
22+ case _ => ctx. scope.openForMutations.enter(sym)
2323 sym
2424 }
2525
2626 /** The denotation with the given `name` and all `required` flags in current context
2727 */
2828 def denotNamed (name : Name , required : FlagSet = EmptyFlags ): Denotation = inContext(ctx) {
29- if (owner.isClass)
30- if (outer.owner == owner) { // inner class scope; check whether we are referring to self
31- if (scope.size == 1 ) {
32- val elem = scope.lastEntry
29+ if (ctx. owner.isClass)
30+ if (ctx. outer.owner == ctx. owner) { // inner class scope; check whether we are referring to self
31+ if (ctx. scope.size == 1 ) {
32+ val elem = ctx. scope.lastEntry
3333 if (elem.name == name) return elem.sym.denot // return self
3434 }
35- val pre = owner.thisType
35+ val pre = ctx. owner.thisType
3636 pre.findMember(name, pre, required, EmptyFlags )
3737 }
3838 else // we are in the outermost context belonging to a class; self is invisible here. See inClassContext.
39- owner.findMember(name, owner.thisType, required, EmptyFlags )
39+ ctx. owner.findMember(name, ctx. owner.thisType, required, EmptyFlags )
4040 else
41- scope.denotsNamed(name).filterWithFlags(required, EmptyFlags ).toDenot(NoPrefix )
41+ ctx. scope.denotsNamed(name).filterWithFlags(required, EmptyFlags ).toDenot(NoPrefix )
4242 }
4343
4444 /** A fresh local context with given tree and owner.
4545 * Owner might not exist (can happen for self valdefs), in which case
4646 * no owner is set in result context
4747 */
4848 def localContext (tree : untpd.Tree , owner : Symbol ): FreshContext = inContext(ctx) {
49- val freshCtx = fresh.setTree(tree)
50- if ( owner.exists) freshCtx.setOwner(owner) else freshCtx
49+ val freshCtx = ctx. fresh.setTree(tree)
50+ if owner.exists then freshCtx.setOwner(owner) else freshCtx
5151 }
5252
5353 /** Context where `sym` is defined, assuming we are in a nested context. */
5454 def defContext (sym : Symbol ): Context = inContext(ctx) {
55- outersIterator
55+ ctx. outersIterator
5656 .dropWhile(_.owner != sym)
5757 .dropWhile(_.owner == sym)
5858 .next()
5959 }
6060
6161 /** A new context for the interior of a class */
6262 def inClassContext (selfInfo : TypeOrSymbol ): Context = inContext(ctx) {
63- val localCtx : Context = fresh.setNewScope
63+ val localCtx : Context = ctx. fresh.setNewScope
6464 selfInfo match {
6565 case sym : Symbol if sym.exists && sym.name != nme.WILDCARD => localCtx.scope.openForMutations.enter(sym)
6666 case _ =>
@@ -69,7 +69,7 @@ object ContextOps:
6969 }
7070
7171 def packageContext (tree : untpd.PackageDef , pkg : Symbol ): Context = inContext(ctx) {
72- if (pkg.is(Package )) fresh.setOwner(pkg.moduleClass).setTree(tree)
72+ if (pkg.is(Package )) ctx. fresh.setOwner(pkg.moduleClass).setTree(tree)
7373 else ctx
7474 }
7575end ContextOps
0 commit comments