Rename Maybe::has_value to Maybe::HasValue to follow naming conventions

This commit is contained in:
Jacob Dufault 2018-02-11 13:56:34 -08:00
parent 95f6460e6e
commit 593ecd8f53
6 changed files with 11 additions and 11 deletions

View File

@ -28,12 +28,12 @@ public:
const T& operator*() const { return storage; }
T& operator*() { return storage; }
bool has_value() const {
bool HasValue() const {
return storage.HasValueForMaybe_();
}
explicit operator bool() const { return has_value(); }
explicit operator bool() const { return HasValue(); }
operator optional<T>() const {
if (has_value())
if (HasValue())
return storage;
return nullopt;
}

View File

@ -114,7 +114,7 @@ struct CqueryMemberHierarchyExpandHandler
Out_CqueryMemberHierarchy out;
out.id = request->id;
// |ExpandNode| uses -1 to indicate invalid |type_id|.
if (request->params.type_id.has_value())
if (request->params.type_id)
out.result = ExpandNode(db, working_files, *request->params.type_id);
QueueManager::WriteStdout(IpcId::CqueryMemberHierarchyExpand, out);

View File

@ -17,7 +17,7 @@ lsWorkspaceEdit BuildWorkspaceEdit(QueryDatabase* db,
continue;
Maybe<QueryFileId> file_id = db->GetFileId(use);
if (!file_id.has_value())
if (!file_id)
continue;
if (path_to_edit.find(*file_id) == path_to_edit.end()) {
path_to_edit[*file_id] = lsTextDocumentEdit();

View File

@ -255,9 +255,9 @@ QueryFile::DefUpdate BuildFileDefUpdate(const IdMap& id_map, const IndexFile& in
}
for (const IndexFunc& func : indexed.funcs) {
QueryFuncId id = id_map.ToQuery(func.id);
if (func.def.spell.has_value())
if (func.def.spell)
add_all_symbols_use(*func.def.spell, id, SymbolKind::Func);
if (func.def.extent.has_value())
if (func.def.extent)
add_outline_use(*func.def.extent, id, SymbolKind::Func);
for (const IndexFunc::Declaration& decl : func.declarations) {
add_all_symbols(decl.spelling, id, SymbolKind::Func,
@ -926,7 +926,7 @@ void QueryDatabase::ImportOrUpdate(std::vector<QueryVar::DefUpdate>&& updates) {
void QueryDatabase::UpdateSymbols(Maybe<Id<void>>* symbol_idx,
SymbolKind kind,
Id<void> idx) {
if (!symbol_idx->has_value()) {
if (!symbol_idx->HasValue()) {
*symbol_idx = Id<void>(symbols.size());
symbols.push_back(SymbolIdx{idx, kind});
}

View File

@ -380,7 +380,7 @@ optional<lsLocation> GetLsLocation(QueryDatabase* db,
Reference ref) {
std::string path;
Maybe<QueryFileId> file_id = db->GetFileId(ref);
if (!file_id.has_value())
if (!file_id)
return nullopt;
lsDocumentUri uri = GetLsDocumentUri(db, *file_id, &path);
optional<lsRange> range =
@ -496,7 +496,7 @@ optional<lsSymbolInformation> GetSymbolInfo(QueryDatabase* db,
info.containerName = func.def->detailed_name;
info.kind = lsSymbolKind::Function;
if (func.def->declaring_type.has_value()) {
if (func.def->declaring_type) {
QueryType& container = db->types[func.def->declaring_type->id];
if (container.def)
info.kind = lsSymbolKind::Method;

View File

@ -229,7 +229,7 @@ void ReflectMember(Writer& visitor, const char* name, optional<T>& value) {
// The same as std::optional
template <typename T>
void ReflectMember(Writer& visitor, const char* name, Maybe<T>& value) {
if (value.has_value() || visitor.Format() != SerializeFormat::Json) {
if (value.HasValue() || visitor.Format() != SerializeFormat::Json) {
visitor.Key(name);
Reflect(visitor, value);
}