Skip to main content

check_ast_depth

Function check_ast_depth 

Source
pub fn check_ast_depth(current_depth: usize) -> PatternsResult<()>
Expand description

Check if AST depth limit has been exceeded.

Uses checked comparison to avoid any overflow issues.

§Arguments

  • current_depth - The current traversal depth

§Returns

Ok(()) if within limits, error otherwise.

§Errors

  • PatternsError::DepthLimitExceeded if depth >= MAX_AST_DEPTH