Skip to content

Commit 050b21e

Browse files
seirlcopybara-github
authored andcommitted
Add AddUnknownPattern() and AddMissingPattern().
The other activation functions can be used incrementally, but SetUnknownPatterns() and SetMissingPatterns() cannot. This makes it a bit annoying to use, since you can't have a wrapper function that either binds an attribute or add an unknown pattern, that you could for example call in a loop. Since attribute patterns are just a vector anyway, it is easy to make it support incremental additions. PiperOrigin-RevId: 748766532
1 parent ce4e8be commit 050b21e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

runtime/activation.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,18 @@ class Activation final : public ActivationInterface {
9292
bool InsertOrAssignValueProvider(absl::string_view name,
9393
ValueProvider provider);
9494

95+
void AddUnknownPattern(cel::AttributePattern pattern) {
96+
unknown_patterns_.push_back(std::move(pattern));
97+
}
98+
9599
void SetUnknownPatterns(std::vector<cel::AttributePattern> patterns) {
96100
unknown_patterns_ = std::move(patterns);
97101
}
98102

103+
void AddMissingPattern(cel::AttributePattern pattern) {
104+
missing_patterns_.push_back(std::move(pattern));
105+
}
106+
99107
void SetMissingPatterns(std::vector<cel::AttributePattern> patterns) {
100108
missing_patterns_ = std::move(patterns);
101109
}

0 commit comments

Comments
 (0)