Files
swift-mirror/include/swift/IDE/AfterPoundExprCompletion.h
Ben Barham ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00

57 lines
1.8 KiB
C++

//===--- AfterPoundExprCompletion.h ---------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2022 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_IDE_AFTERPOUNDEXPRCOMPLETION_H
#define SWIFT_IDE_AFTERPOUNDEXPRCOMPLETION_H
#include "swift/IDE/CodeCompletionConsumer.h"
#include "swift/IDE/CodeCompletionContext.h"
#include "swift/IDE/TypeCheckCompletionCallback.h"
namespace swift {
namespace ide {
/// Used to collect and store information needed to perform unresolved member
/// completion (\c CompletionKind::UnresolvedMember ) from the solutions
/// formed during expression type-checking.
class AfterPoundExprCompletion : public TypeCheckCompletionCallback {
struct Result {
Type ExpectedTy;
bool IsImpliedResult;
/// Whether the surrounding context is async and thus calling async
/// functions is supported.
bool IsInAsyncContext;
};
CodeCompletionExpr *CompletionExpr;
DeclContext *DC;
std::optional<StmtKind> ParentStmtKind;
SmallVector<Result, 4> Results;
void sawSolutionImpl(const constraints::Solution &solution) override;
public:
AfterPoundExprCompletion(CodeCompletionExpr *CompletionExpr, DeclContext *DC,
std::optional<StmtKind> ParentStmtKind)
: CompletionExpr(CompletionExpr), DC(DC), ParentStmtKind(ParentStmtKind) {
}
void collectResults(ide::CodeCompletionContext &CompletionCtx);
};
} // end namespace ide
} // end namespace swift
#endif // SWIFT_IDE_AFTERPOUNDEXPRCOMPLETION_H