| 53 | } |
| 54 | |
| 55 | bool Activation::RemoveFunctionEntries( |
| 56 | const CelFunctionDescriptor& descriptor) { |
| 57 | auto map_entry = function_map_.find(descriptor.name()); |
| 58 | if (map_entry == function_map_.end()) { |
| 59 | return false; |
| 60 | } |
| 61 | std::vector<std::unique_ptr<CelFunction>>& overloads = map_entry->second; |
| 62 | bool funcs_removed = false; |
| 63 | auto func_iter = overloads.begin(); |
| 64 | while (func_iter != overloads.end()) { |
| 65 | if (descriptor.ShapeMatches(func_iter->get()->descriptor())) { |
| 66 | func_iter = overloads.erase(func_iter); |
| 67 | funcs_removed = true; |
| 68 | } else { |
| 69 | ++func_iter; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | if (overloads.empty()) { |
| 74 | function_map_.erase(map_entry); |
| 75 | } |
| 76 | |
| 77 | return funcs_removed; |
| 78 | } |
| 79 | |
| 80 | void Activation::InsertValue(absl::string_view name, const CelValue& value) { |
| 81 | value_map_.try_emplace(name, ValueEntry(value)); |