| 401 | } |
| 402 | |
| 403 | ConstantKindCase GetConstantKindCase(absl::string_view type_name) { |
| 404 | static const auto kTypeNameToConstantKindCase = |
| 405 | absl::NoDestructor<absl::flat_hash_map<std::string, ConstantKindCase>>({ |
| 406 | {"null", ConstantKindCase::kNull}, |
| 407 | {"bool", ConstantKindCase::kBool}, |
| 408 | {"int", ConstantKindCase::kInt}, |
| 409 | {"uint", ConstantKindCase::kUint}, |
| 410 | {"double", ConstantKindCase::kDouble}, |
| 411 | {"string", ConstantKindCase::kString}, |
| 412 | {"bytes", ConstantKindCase::kBytes}, |
| 413 | {"duration", ConstantKindCase::kDuration}, |
| 414 | {"timestamp", ConstantKindCase::kTimestamp}, |
| 415 | }); |
| 416 | if (auto it = kTypeNameToConstantKindCase->find(type_name); |
| 417 | it != kTypeNameToConstantKindCase->end()) { |
| 418 | return it->second; |
| 419 | } |
| 420 | return ConstantKindCase::kUnspecified; |
| 421 | } |
| 422 | |
| 423 | absl::StatusOr<Constant> ParseConstantValue(absl::string_view yaml, |
| 424 | const YAML::Node& node, |
no test coverage detected