             }
             
             resolver.end()
+            
+            resolver.currentClass = enclosingClass
             
             return .class(name: name, methods: resolvedMethods)
             

        case method
    }
    
    private var scopes: [[String: Bool]] = []
    private(set) var currentFunction: FunctionType = .none
    
    func begin() {
        scopes.append([:])

                value: value.resolve(resolver: resolver))
        
        case .this(let keyword):
            if resolver.currentClass == .none {
                Lox.error(keyword, "Cannot use 'this' outside of a class.")
            }
            
            let depth = resolver.resolveLocal(keyword)
            return .this(keyword: keyword, depth: depth)
        }
