         
         currentFunction = enclosingFunction
         
-        return resolvedBody
+        return .function(name: name, parameters: parameters, body: resolvedBody)
     }
 }
 

        return scopes.count // global
    }
    
    func resolveFunction(name: Token, parameters: [Token], body: [Stmt], type functionType: FunctionType) -> [ResolvedStmt] {
        let enclosingFunction = currentFunction
        currentFunction = functionType
        

            resolver.declare(name)
            resolver.define(name)
            
            return resolver.resolveFunction(name: name, parameters: parameters, body: body, type: .function)
        
        case .expr(let expr):
            return .expr(expr: expr.resolve(resolver: resolver))
