Skip to content

Commit 267f4de

Browse files
CEL Dev Teamcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 920105999
1 parent e00189c commit 267f4de

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

extensions/select_optimization.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Expr MakeSelectPathExpr(
153153
// Returns a single select operation based on the inferred type of the operand
154154
// and the field name. If the operand type doesn't define the field, returns
155155
// nullopt.
156-
absl::optional<SelectInstruction> GetSelectInstruction(
156+
std::optional<SelectInstruction> GetSelectInstruction(
157157
const StructType& runtime_type, PlannerContext& planner_context,
158158
absl::string_view field_name) {
159159
auto field_or = planner_context.type_reflector()
@@ -407,13 +407,13 @@ class RewriterImpl : public AstRewriterBase {
407407
// support message traversal.
408408
const TypeSpec checker_type = ast_.GetTypeOrDyn(operand.id());
409409

410-
absl::optional<Type> rt_type =
410+
std::optional<Type> rt_type =
411411
(checker_type.has_message_type())
412412
? GetRuntimeType(checker_type.message_type().type())
413413
: absl::nullopt;
414414
if (rt_type.has_value() && (*rt_type).Is<StructType>()) {
415415
const StructType& runtime_type = rt_type->GetStruct();
416-
absl::optional<SelectInstruction> field_or =
416+
std::optional<SelectInstruction> field_or =
417417
GetSelectInstruction(runtime_type, planner_context_, field_name);
418418
if (field_or.has_value()) {
419419
candidates_[&expr] = std::move(field_or).value();
@@ -538,7 +538,7 @@ class RewriterImpl : public AstRewriterBase {
538538
return candidates_.find(operand) != candidates_.end();
539539
}
540540

541-
absl::optional<Type> GetRuntimeType(absl::string_view type_name) {
541+
std::optional<Type> GetRuntimeType(absl::string_view type_name) {
542542
return planner_context_.type_reflector().FindType(type_name).value_or(
543543
absl::nullopt);
544544
}
@@ -582,22 +582,22 @@ class OptimizedSelectImpl {
582582

583583
AttributeTrail GetAttributeTrail(const AttributeTrail& operand_trail) const;
584584

585-
absl::optional<Attribute> attribute() const { return attribute_; }
585+
std::optional<Attribute> attribute() const { return attribute_; }
586586

587587
const std::vector<AttributeQualifier>& qualifiers() const {
588588
return qualifiers_;
589589
}
590590

591591
private:
592-
absl::optional<Attribute> attribute_;
592+
std::optional<Attribute> attribute_;
593593
std::vector<SelectQualifier> select_path_;
594594
std::vector<AttributeQualifier> qualifiers_;
595595
bool presence_test_;
596596
SelectOptimizationOptions options_;
597597
};
598598

599599
// Check for unknowns or missing attributes.
600-
absl::StatusOr<absl::optional<Value>> CheckForMarkedAttributes(
600+
absl::StatusOr<std::optional<Value>> CheckForMarkedAttributes(
601601
ExecutionFrameBase& frame, const AttributeTrail& attribute_trail) {
602602
if (attribute_trail.empty()) {
603603
return absl::nullopt;
@@ -715,7 +715,7 @@ absl::Status StackMachineImpl::Evaluate(ExecutionFrame* frame) const {
715715
// select arguments.
716716
// TODO(uncreated-issue/51): add support variable qualifiers
717717
attribute_trail = GetAttributeTrail(frame);
718-
CEL_ASSIGN_OR_RETURN(absl::optional<Value> value,
718+
CEL_ASSIGN_OR_RETURN(std::optional<Value> value,
719719
CheckForMarkedAttributes(*frame, attribute_trail));
720720
if (value.has_value()) {
721721
frame->value_stack().Pop(kStackInputs);

extensions/select_optimization_test.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ class MockAccessApis : public LegacyTypeInfoApis, public LegacyTypeAccessApis {
254254
return nullptr;
255255
}
256256

257-
absl::optional<LegacyTypeInfoApis::FieldDescription> FindFieldByName(
258-
absl::string_view field_name) const override {
257+
std::optional<
258+
google::api::expr::runtime::LegacyTypeInfoApis::FieldDescription>
259+
FindFieldByName(absl::string_view field_name) const override {
259260
return absl::nullopt;
260261
}
261262

0 commit comments

Comments
 (0)