func lookupFunction()

in Sources/LLBBuildSystem/BuildEngine.swift [46:61]


    func lookupFunction(forKey key: LLBKey, _ ctx: Context) -> LLBFuture<LLBFunction> {
        if let buildKey = key as? LLBBuildKey {
            // First look in the build system function map, and if not found, resolve it using the delegate.
            guard let function = functionMap.get(type(of: buildKey).identifier) ??
                    buildFunctionLookupDelegate?.lookupBuildFunction(for: type(of: buildKey).identifier) else {
                return ctx.group.next().makeFailedFuture(
                    LLBBuildEngineError.unknownBuildKeyIdentifier(String(describing: type(of: buildKey)))
                )
            }
            return ctx.group.next().makeSucceededFuture(function)
        } else {
            return ctx.group.next().makeFailedFuture(
                LLBBuildEngineError.unknownKeyType(String(describing: type(of: key)))
            )
        }
    }