@@ -19,48 +19,48 @@ object ContextOps:
19
19
def enter (sym : Symbol ): Symbol = inContext(ctx) {
20
20
ctx.owner match
21
21
case cls : ClassSymbol => cls.classDenot.enter(sym)
22
- case _ => scope.openForMutations.enter(sym)
22
+ case _ => ctx. scope.openForMutations.enter(sym)
23
23
sym
24
24
}
25
25
26
26
/** The denotation with the given `name` and all `required` flags in current context
27
27
*/
28
28
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
33
33
if (elem.name == name) return elem.sym.denot // return self
34
34
}
35
- val pre = owner.thisType
35
+ val pre = ctx. owner.thisType
36
36
pre.findMember(name, pre, required, EmptyFlags )
37
37
}
38
38
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 )
40
40
else
41
- scope.denotsNamed(name).filterWithFlags(required, EmptyFlags ).toDenot(NoPrefix )
41
+ ctx. scope.denotsNamed(name).filterWithFlags(required, EmptyFlags ).toDenot(NoPrefix )
42
42
}
43
43
44
44
/** A fresh local context with given tree and owner.
45
45
* Owner might not exist (can happen for self valdefs), in which case
46
46
* no owner is set in result context
47
47
*/
48
48
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
51
51
}
52
52
53
53
/** Context where `sym` is defined, assuming we are in a nested context. */
54
54
def defContext (sym : Symbol ): Context = inContext(ctx) {
55
- outersIterator
55
+ ctx. outersIterator
56
56
.dropWhile(_.owner != sym)
57
57
.dropWhile(_.owner == sym)
58
58
.next()
59
59
}
60
60
61
61
/** A new context for the interior of a class */
62
62
def inClassContext (selfInfo : TypeOrSymbol ): Context = inContext(ctx) {
63
- val localCtx : Context = fresh.setNewScope
63
+ val localCtx : Context = ctx. fresh.setNewScope
64
64
selfInfo match {
65
65
case sym : Symbol if sym.exists && sym.name != nme.WILDCARD => localCtx.scope.openForMutations.enter(sym)
66
66
case _ =>
@@ -69,7 +69,7 @@ object ContextOps:
69
69
}
70
70
71
71
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)
73
73
else ctx
74
74
}
75
75
end ContextOps
0 commit comments