feat(tdl): Add a super header to import all AST nodes and hide the implementation namespace. - #202
Conversation
WalkthroughAdds a new public aggregate header tdl/parser/ast/nodes.hpp that re-exports AST node types via type aliases, and updates src/spider/CMakeLists.txt to include this header in SPIDER_TDL_SHARED_HEADERS. No source or runtime control-flow changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/spider/tdl/parser/ast/nodes.hpp (2)
7-22: Re-export all includes for IWYU so consumers aren’t nudged to include node_impl headers directly.Currently only FloatSpec/IntSpec/Node are inside IWYU begin_exports. If clients include this super header and use, e.g., Function or List, IWYU may suggest including internal node_impl headers, which undermines the “single include” goal. Wrap all of these includes in the export block (or add per-include // IWYU pragma: export).
Apply this diff:
-#include <spider/tdl/parser/ast/node_impl/Function.hpp> +// IWYU pragma: begin_exports +#include <spider/tdl/parser/ast/node_impl/Function.hpp> #include <spider/tdl/parser/ast/node_impl/Identifier.hpp> #include <spider/tdl/parser/ast/node_impl/NamedVar.hpp> #include <spider/tdl/parser/ast/node_impl/Namespace.hpp> #include <spider/tdl/parser/ast/node_impl/StructSpec.hpp> #include <spider/tdl/parser/ast/node_impl/Type.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/Container.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/container_impl/Tuple.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/Primitive.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hpp> #include <spider/tdl/parser/ast/node_impl/type_impl/Struct.hpp> - -// IWYU pragma: begin_exports #include <spider/tdl/parser/ast/FloatSpec.hpp> #include <spider/tdl/parser/ast/IntSpec.hpp> #include <spider/tdl/parser/ast/Node.hpp> - -// IWYU pragma: end_exports +// IWYU pragma: end_exportsAlternative: keep the current layout but add “// IWYU pragma: export” after each include that you intend to re-export.
Also applies to: 23-29
30-46: Type alias façade reads clean and achieves the namespace-hiding goal.The alias set is coherent and keeps consumer code in spider::tdl::parser::ast. Consider a brief comment grouping (primitives/containers/nodes) for scanability, but this is optional.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/spider/CMakeLists.txt(1 hunks)src/spider/tdl/parser/ast/nodes.hpp(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: non-storage-unit-tests (ubuntu-24.04)
- GitHub Check: non-storage-unit-tests (ubuntu-22.04)
- GitHub Check: lint
🔇 Additional comments (1)
src/spider/tdl/parser/ast/nodes.hpp (1)
1-6: Header guard and intent doc look good.Guard is conventional and the file’s purpose is clear.
Description
As planned to use Antlr's actions to embed AST generation in the generated Antlr parser, this PR adds a super header that includes all AST nodes and hides implementation namespaces. Doing this has two benefits:
Checklist
breaking change.
Validation performed
Summary by CodeRabbit