Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions eval/compiler/flat_expr_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ class FlatExprVisitor : public cel::AstVisitor {

// Attempt to resolve a select expression as a namespaced identifier for an
// enum or type constant value.
absl::optional<cel::Value> const_value;
std::optional<cel::Value> const_value;
int64_t select_root_id = -1;
std::string path_candidate;

Expand Down Expand Up @@ -1080,7 +1080,7 @@ class FlatExprVisitor : public cel::AstVisitor {

// Returns the maximum recursion depth of the current program if it is
// eligible for recursion, or nullopt if it is not.
absl::optional<int> RecursionEligible() {
std::optional<int> RecursionEligible() {
if (!PlanRecursiveProgram() || program_builder_.current() == nullptr) {
return absl::nullopt;
}
Expand Down Expand Up @@ -1525,7 +1525,7 @@ class FlatExprVisitor : public cel::AstVisitor {
}
}
}
if (absl::optional<int> depth = RecursionEligible(); depth.has_value()) {
if (std::optional<int> depth = RecursionEligible(); depth.has_value()) {
auto deps = ExtractRecursiveDependencies();
if (deps.size() != list_expr.elements().size()) {
SetProgressStatusError(absl::InternalError(
Expand Down Expand Up @@ -1855,7 +1855,7 @@ class FlatExprVisitor : public cel::AstVisitor {
int64_t expr_id) {
absl::string_view ast_name = create_struct_expr.name();

absl::optional<std::pair<std::string, cel::Type>> type;
std::optional<std::pair<std::string, cel::Type>> type;
CEL_ASSIGN_OR_RETURN(type, resolver_.FindType(ast_name, expr_id));

if (!type.has_value()) {
Expand Down Expand Up @@ -1932,7 +1932,7 @@ class FlatExprVisitor : public cel::AstVisitor {
IndexManager index_manager_;

bool enable_optional_types_;
absl::optional<BlockInfo> block_;
std::optional<FlatExprVisitor::BlockInfo> block_;
int max_recursion_depth_ = 0;
};

Expand Down
2 changes: 1 addition & 1 deletion eval/compiler/flat_expr_builder_extensions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ size_t Subexpression::ComputeSize() const {
return size;
}

absl::optional<int> Subexpression::RecursiveDependencyDepth() const {
std::optional<int> Subexpression::RecursiveDependencyDepth() const {
auto* tree = absl::get_if<TreePlan>(&program_);
int depth = 0;
if (tree == nullptr) {
Expand Down
10 changes: 5 additions & 5 deletions eval/compiler/qualified_reference_resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ bool OverloadExists(const Resolver& resolver, absl::string_view name,

// Return the qualified name of the most qualified matching overload, or
// nullopt if no matches are found.
absl::optional<std::string> BestOverloadMatch(const Resolver& resolver,
absl::string_view base_name,
int argument_count) {
std::optional<std::string> BestOverloadMatch(const Resolver& resolver,
absl::string_view base_name,
int argument_count) {
if (IsSpecialFunction(base_name)) {
return std::string(base_name);
}
Expand Down Expand Up @@ -262,8 +262,8 @@ class ReferenceResolver : public cel::AstRewriterBase {
// Convert a select expr sub tree into a namespace name if possible.
// If any operand of the top element is a not a select or an ident node,
// return nullopt.
absl::optional<std::string> ToNamespace(const Expr& expr) {
absl::optional<std::string> maybe_parent_namespace;
std::optional<std::string> ToNamespace(const Expr& expr) {
std::optional<std::string> maybe_parent_namespace;
if (rewritten_reference_.find(expr.id()) != rewritten_reference_.end()) {
// The target expr matches a reference (resolved to an ident decl).
// This should not be treated as a function qualifier.
Expand Down
6 changes: 3 additions & 3 deletions eval/compiler/regex_precompilation_optimization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class RegexPrecompilationOptimization : public ProgramOptimizer {

// Try to check if the regex is valid, whether or not we can actually update
// the plan.
absl::optional<std::string> pattern =
std::optional<std::string> pattern =
GetConstantString(context, subexpression, node, pattern_expr);
if (!pattern.has_value()) {
return absl::OkStatus();
Expand All @@ -168,7 +168,7 @@ class RegexPrecompilationOptimization : public ProgramOptimizer {
}

private:
absl::optional<std::string> GetConstantString(
std::optional<std::string> GetConstantString(
PlannerContext& context,
ProgramBuilder::Subexpression* absl_nullable subexpression,
const Expr& call_expr, const Expr& re_expr) const {
Expand All @@ -180,7 +180,7 @@ class RegexPrecompilationOptimization : public ProgramOptimizer {
// Already modified, can't recover the input pattern.
return absl::nullopt;
}
absl::optional<Value> constant;
std::optional<Value> constant;
if (subexpression->IsRecursive()) {
const auto& program = subexpression->recursive_program();
auto deps = program.step->GetDependencies();
Expand Down
6 changes: 3 additions & 3 deletions eval/compiler/resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ absl::Span<const std::string> Resolver::GetPrefixesFor(
return namespace_prefixes_;
}

absl::optional<cel::Value> Resolver::FindConstant(absl::string_view name,
int64_t expr_id) const {
std::optional<cel::Value> Resolver::FindConstant(absl::string_view name,
int64_t expr_id) const {
auto prefixes = GetPrefixesFor(name);
for (const auto& prefix : prefixes) {
std::string qualified_name = absl::StrCat(prefix, name);
Expand Down Expand Up @@ -205,7 +205,7 @@ std::vector<cel::FunctionRegistry::LazyOverload> Resolver::FindLazyOverloads(
return funcs;
}

absl::StatusOr<absl::optional<std::pair<std::string, cel::Type>>>
absl::StatusOr<std::optional<std::pair<std::string, cel::Type>>>
Resolver::FindType(absl::string_view name, int64_t expr_id) const {
auto prefixes = GetPrefixesFor(name);
for (auto& prefix : prefixes) {
Expand Down