validate a query
| 2015 | |
| 2016 | // validate a query |
| 2017 | static AST_Validation _ValidateScopes |
| 2018 | ( |
| 2019 | AST *ast // ast |
| 2020 | ) { |
| 2021 | // create a context for the traversal |
| 2022 | validations_ctx ctx = { |
| 2023 | .union_all = NOT_DEFINED, |
| 2024 | .defined_identifiers = raxNew(), |
| 2025 | .ignore_identifiers = false |
| 2026 | }; |
| 2027 | |
| 2028 | // create a visitor |
| 2029 | ast_visitor visitor = {&ctx, validations_mapping}; |
| 2030 | |
| 2031 | // visit (traverse) the ast |
| 2032 | AST_Visitor_visit(ast->root, &visitor); |
| 2033 | |
| 2034 | // cleanup |
| 2035 | raxFree(ctx.defined_identifiers); |
| 2036 | |
| 2037 | return !ErrorCtx_EncounteredError() ? AST_VALID : AST_INVALID; |
| 2038 | } |
| 2039 | |
| 2040 | // build the global mapping from ast-node-type to visiting functions |
| 2041 | bool AST_ValidationsMappingInit(void) { |
no test coverage detected