MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / AstDepthValidator

Function AstDepthValidator

validator/ast_depth_validator.cc:22–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20namespace cel {
21
22Validation AstDepthValidator(int max_depth) {
23 return Validation([max_depth](ValidationContext& context) {
24 int height = context.navigable_ast().Root().height();
25 if (height > max_depth) {
26 context.ReportError(absl::StrCat("AST depth ", height,
27 " exceeds maximum of ", max_depth));
28 return false;
29 }
30 return true;
31 });
32}
33
34} // namespace cel

Callers 1

TESTFunction · 0.85

Calls 3

ValidationClass · 0.85
heightMethod · 0.80
ReportErrorMethod · 0.45

Tested by 1

TESTFunction · 0.68