feat(tdl): Add Type AST nodes for primitive and container types. - #184
Conversation
WalkthroughThis update introduces a comprehensive set of new AST node types and supporting utilities for the TDL parser, including primitive types (Bool, Int, Float), container types (List, Map), type specification enums, and serialization/validation helpers. Build configuration and tests are expanded to cover these new AST node classes and their behaviours. Changes
Sequence Diagram(s)sequenceDiagram
participant TestSuite
participant ASTFactory
participant Node
participant Type/Primitive/Container
participant Utils
TestSuite->>ASTFactory: create Int/Float/Bool/List/Map node(s)
ASTFactory->>Node: validate child node type(s)
Node-->>ASTFactory: success or error
ASTFactory->>Type/Primitive/Container: instantiate node
Type/Primitive/Container-->>ASTFactory: node instance
TestSuite->>Type/Primitive/Container: serialize_to_str()
Type/Primitive/Container->>Utils: create_indentation(), serialize_int_spec/float_spec()
Utils-->>Type/Primitive/Container: formatted string or error
Type/Primitive/Container-->>TestSuite: serialized string or error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes Possibly related PRs
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ 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)
✨ 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 comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.hpp (1)
44-54: Consider adding noexcept specifier for consistency.The accessor methods are correctly implemented with appropriate static_cast usage and documentation. Consider adding
noexceptspecifiers for consistency with similar accessor methods in other container types like List.- [[nodiscard]] auto get_key_type() const -> Type const* { + [[nodiscard]] auto get_key_type() const noexcept -> Type const* { // The factory function ensures that the first child is of type `Type`. // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) return static_cast<Type const*>(get_child_unsafe(0)); } - [[nodiscard]] auto get_value_type() const -> Type const* { + [[nodiscard]] auto get_value_type() const noexcept -> Type const* { // The factory function ensures that the first child is of type `Type`. // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) return static_cast<Type const*>(get_child_unsafe(1)); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
src/spider/CMakeLists.txt(2 hunks)src/spider/tdl/parser/ast/FloatSpec.hpp(1 hunks)src/spider/tdl/parser/ast/IntSpec.hpp(1 hunks)src/spider/tdl/parser/ast/Node.cpp(1 hunks)src/spider/tdl/parser/ast/Node.hpp(2 hunks)src/spider/tdl/parser/ast/node_impl/Identifier.cpp(1 hunks)src/spider/tdl/parser/ast/node_impl/Identifier.hpp(1 hunks)src/spider/tdl/parser/ast/node_impl/Type.hpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/Container.hpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/Primitive.hpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.cpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.hpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.cpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.hpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.cpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.hpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.cpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.cpp(1 hunks)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hpp(1 hunks)src/spider/tdl/parser/ast/utils.cpp(1 hunks)src/spider/tdl/parser/ast/utils.hpp(1 hunks)tests/tdl/test-parser-ast.cpp(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: LinZhihao-723
PR: y-scope/spider#182
File: src/spider/tdl/parser/ast/Node.hpp:0-0
Timestamp: 2025-08-07T14:54:20.253Z
Learning: In the spider TDL AST Node class, derived classes should use the `add_child` method in their factory functions rather than passing children directly to a constructor, to ensure proper parent-child relationship management and error handling.
📚 Learning: 2025-08-07T14:54:20.253Z
Learnt from: LinZhihao-723
PR: y-scope/spider#182
File: src/spider/tdl/parser/ast/Node.hpp:0-0
Timestamp: 2025-08-07T14:54:20.253Z
Learning: In the spider TDL AST Node class, derived classes should use the `add_child` method in their factory functions rather than passing children directly to a constructor, to ensure proper parent-child relationship management and error handling.
Applied to files:
src/spider/tdl/parser/ast/Node.cppsrc/spider/tdl/parser/ast/node_impl/type_impl/Container.hppsrc/spider/tdl/parser/ast/node_impl/Identifier.hppsrc/spider/tdl/parser/ast/node_impl/type_impl/Primitive.hppsrc/spider/tdl/parser/ast/node_impl/Type.hppsrc/spider/CMakeLists.txtsrc/spider/tdl/parser/ast/Node.hppsrc/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hppsrc/spider/tdl/parser/ast/utils.hppsrc/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.cppsrc/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.hpp
📚 Learning: 2025-07-17T19:44:06.132Z
Learnt from: sitaowang1998
PR: y-scope/spider#168
File: lint-tasks.yaml:62-65
Timestamp: 2025-07-17T19:44:06.132Z
Learning: ANTLR-generated C++ code in the G_SRC_DSL_DIR (src/stdl) should not be included in linting tasks because it's auto-generated code that doesn't follow manual coding standards.
Applied to files:
src/spider/CMakeLists.txtsrc/spider/tdl/parser/ast/utils.cpp
📚 Learning: 2025-04-09T17:15:24.552Z
Learnt from: davidlion
PR: y-scope/spider#100
File: src/spider/worker/worker.cpp:205-230
Timestamp: 2025-04-09T17:15:24.552Z
Learning: Documentation should be added to new functions in the spider codebase, as already discussed with the user.
Applied to files:
src/spider/CMakeLists.txt
📚 Learning: 2025-04-08T05:46:35.492Z
Learnt from: davidlion
PR: y-scope/spider#100
File: src/spider/worker/worker.cpp:191-196
Timestamp: 2025-04-08T05:46:35.492Z
Learning: According to the project's coding guidelines, file-scope functions (those in unnamed namespaces) should have separate declarations and definitions.
Applied to files:
src/spider/tdl/parser/ast/utils.cpp
🧬 Code Graph Analysis (11)
src/spider/tdl/parser/ast/FloatSpec.hpp (1)
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp (2)
Float(35-35)Float(35-35)
src/spider/tdl/parser/ast/node_impl/Identifier.hpp (1)
src/spider/tdl/parser/ast/Node.hpp (5)
nodiscard(45-45)nodiscard(50-50)nodiscard(73-79)nodiscard(112-114)indentation_level(88-89)
src/spider/tdl/parser/ast/node_impl/Identifier.cpp (4)
src/spider/tdl/parser/ast/Node.hpp (1)
indentation_level(88-89)src/spider/tdl/parser/ast/node_impl/Identifier.hpp (1)
indentation_level(27-28)src/spider/tdl/parser/ast/utils.cpp (2)
create_indentation(14-19)create_indentation(14-14)src/spider/tdl/parser/ast/utils.hpp (1)
create_indentation(21-21)
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hpp (3)
src/spider/tdl/parser/ast/Node.hpp (5)
nodiscard(45-45)nodiscard(50-50)nodiscard(73-79)nodiscard(112-114)indentation_level(88-89)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.hpp (2)
nodiscard(20-22)indentation_level(25-26)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp (4)
nodiscard(22-24)nodiscard(31-31)spec(22-22)indentation_level(27-28)
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.cpp (7)
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.cpp (2)
serialize_to_str(12-19)serialize_to_str(12-13)src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.cpp (2)
serialize_to_str(25-33)serialize_to_str(25-26)src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.cpp (2)
serialize_to_str(84-94)serialize_to_str(84-85)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.cpp (2)
serialize_to_str(12-19)serialize_to_str(12-13)src/spider/tdl/parser/ast/Node.hpp (1)
indentation_level(88-89)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.hpp (1)
indentation_level(25-26)src/spider/tdl/parser/ast/utils.cpp (2)
create_indentation(14-19)create_indentation(14-14)
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.hpp (3)
src/spider/tdl/parser/ast/Node.hpp (5)
nodiscard(45-45)nodiscard(50-50)nodiscard(73-79)nodiscard(112-114)indentation_level(88-89)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp (3)
nodiscard(22-24)nodiscard(31-31)indentation_level(27-28)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hpp (3)
nodiscard(22-24)nodiscard(31-31)indentation_level(27-28)
src/spider/tdl/parser/ast/utils.hpp (4)
src/spider/tdl/parser/ast/Node.hpp (5)
nodiscard(45-45)nodiscard(50-50)nodiscard(73-79)nodiscard(112-114)indentation_level(88-89)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp (4)
nodiscard(22-24)nodiscard(31-31)indentation_level(27-28)spec(22-22)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hpp (4)
nodiscard(22-24)nodiscard(31-31)indentation_level(27-28)spec(22-22)src/spider/tdl/parser/ast/node_impl/Identifier.hpp (2)
nodiscard(31-31)indentation_level(27-28)
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.cpp (5)
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.cpp (2)
serialize_to_str(12-15)serialize_to_str(12-13)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.cpp (2)
serialize_to_str(12-19)serialize_to_str(12-13)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp (1)
indentation_level(27-28)src/spider/tdl/parser/ast/utils.cpp (4)
create_indentation(14-19)create_indentation(14-14)serialize_float_spec(36-45)serialize_float_spec(36-36)src/spider/tdl/parser/ast/utils.hpp (2)
create_indentation(21-21)serialize_float_spec(40-41)
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp (3)
src/spider/tdl/parser/ast/Node.hpp (5)
nodiscard(45-45)nodiscard(50-50)nodiscard(73-79)nodiscard(112-114)indentation_level(88-89)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.hpp (2)
nodiscard(20-22)indentation_level(25-26)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hpp (4)
nodiscard(22-24)nodiscard(31-31)spec(22-22)indentation_level(27-28)
src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.hpp (5)
src/spider/tdl/parser/ast/Node.hpp (5)
nodiscard(45-45)nodiscard(50-50)nodiscard(73-79)nodiscard(112-114)indentation_level(88-89)src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.hpp (2)
nodiscard(32-36)indentation_level(28-29)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.hpp (2)
nodiscard(20-22)indentation_level(25-26)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp (3)
nodiscard(22-24)nodiscard(31-31)indentation_level(27-28)src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hpp (3)
nodiscard(22-24)nodiscard(31-31)indentation_level(27-28)
src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.hpp (2)
src/spider/tdl/parser/ast/Node.hpp (5)
nodiscard(45-45)nodiscard(50-50)nodiscard(73-79)nodiscard(112-114)indentation_level(88-89)src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.hpp (3)
nodiscard(44-48)nodiscard(50-54)indentation_level(40-41)
⏰ 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-22.04)
- GitHub Check: non-storage-unit-tests (ubuntu-24.04)
- GitHub Check: lint
🔇 Additional comments (46)
src/spider/tdl/parser/ast/Node.cpp (1)
28-31: LGTM!The new error codes and their corresponding descriptive messages are well-defined and consistent with the existing error handling pattern. The messages clearly communicate the nature of each error condition.
src/spider/tdl/parser/ast/FloatSpec.hpp (1)
1-15: LGTM!The
FloatSpecenum is well-designed with proper scoping, explicit underlying type, and clear naming. The include guards and namespace structure follow the project conventions correctly.src/spider/tdl/parser/ast/Node.hpp (2)
24-25: LGTM!The new error codes are appropriately added to support the extended AST node functionality for type validation and specification handling.
93-94: LGTM!The protected default constructor is correctly implemented for the base class. This follows good inheritance design principles where the base class constructor is accessible to derived classes but not to external code.
src/spider/tdl/parser/ast/node_impl/Type.hpp (1)
1-12: LGTM!The
Typeabstract base class is correctly implemented as a foundation for the type hierarchy. The simple design with public inheritance fromNodeis appropriate for this use case.src/spider/tdl/parser/ast/node_impl/type_impl/Container.hpp (1)
1-12: LGTM!The
Containerabstract base class correctly extends the type hierarchy fromType. The implementation follows the established pattern and supports the intended class structure for container types likeListandMap.src/spider/tdl/parser/ast/node_impl/type_impl/Primitive.hpp (1)
6-9: LGTM! Clean abstract base class definition.The
Primitiveclass provides a proper foundation for all primitive type nodes in the AST hierarchy. The implementation follows the established pattern with appropriate namespace organization and inheritance structure.src/spider/tdl/parser/ast/IntSpec.hpp (1)
6-14: LGTM! Well-designed enum class for integer specifications.The
IntSpecenum class follows good practices with scoped enumeration, compactuint8_tunderlying type, and clear naming for standard integer sizes. This provides a solid foundation for the integer primitive type nodes.src/spider/tdl/parser/ast/node_impl/Identifier.cpp (1)
12-15: LGTM! Consistent serialization implementation.The
serialize_to_strmethod follows the established pattern used across other AST nodes, with proper indentation handling, error wrapping, and clean string formatting usingfmt::format.src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.cpp (1)
12-15: LGTM! Appropriate serialization for Bool primitive type.The
serialize_to_strimplementation correctly follows the established pattern. The simpler format without specification details (unlikeIntandFloattypes) is appropriate sinceBooldoesn't have type variants requiring additional specification information.src/spider/CMakeLists.txt (3)
198-209: LGTM! Comprehensive source file additions for AST nodes.The new source files are well-organized following the established directory hierarchy and cover all the AST node implementations (identifiers, primitive types, container types, and utilities).
211-227: LGTM! Complete header file organization for AST type system.The header files are systematically organized, covering all specification enums, base classes, and concrete implementations. The structure clearly reflects the type hierarchy design.
234-239: LGTM! Appropriate public linkage of fmt library.Adding
fmt::fmtas a PUBLIC dependency is correct since the AST node headers use fmt formatting in their implementations, requiring downstream consumers to have access to the fmt library.src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.cpp (2)
1-10: LGTM - Includes are appropriate and well-organized.The includes are properly organized with system headers first, followed by third-party libraries (fmt, ystdlib), and finally project-specific headers. All necessary dependencies for the implementation are included.
12-19: LGTM - Consistent implementation following established patterns.The
serialize_to_strmethod implementation correctly follows the same pattern as other primitive types (Int, Bool). It properly uses:
create_indentationfor formatting consistencyserialize_float_specwith error handling viaYSTDLIB_ERROR_HANDLING_TRYXfmt::formatfor string construction- Consistent output format
[Type[Primitive[Float]]]:{spec}src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Bool.hpp (4)
1-12: LGTM - Proper header structure and includes.Header guards follow the correct naming convention, and all necessary includes are present for the class definition and its dependencies.
20-22: LGTM - Factory method follows established pattern.The factory method correctly returns a
std::unique_ptr<Node>and usesstd::make_uniquewith brace initialization, consistent with other primitive type implementations (Int, Float). The parameterless design is appropriate since Bool has no specification variants.
25-26: LGTM - Proper method signature override.The
serialize_to_strmethod correctly overrides the base class virtual method with the same signature and return type.
30-30: LGTM - Appropriate constructor design.The private, defaulted constructor enforces the factory pattern and is appropriate since Bool requires no initialization parameters.
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.cpp (2)
1-10: LGTM - Consistent include organization.The includes follow the same organizational pattern as Float.cpp with proper separation of system, third-party, and project headers.
12-19: LGTM - Correct implementation following established pattern.The
serialize_to_strmethod implementation is consistent with Float.cpp, using:
create_indentationfor proper formattingserialize_int_spec(m_spec)with error propagation- Consistent output format
[Type[Primitive[Int]]]:{spec}- Proper error handling with
YSTDLIB_ERROR_HANDLING_TRYXsrc/spider/tdl/parser/ast/node_impl/Identifier.hpp (4)
1-13: LGTM - Proper header structure and necessary includes.Header guards follow the correct naming convention. All necessary includes are present, including
<utility>forstd::moveand<string_view>for the getter method.
22-24: LGTM - Well-designed factory method with move semantics.The factory method correctly:
- Takes the
nameparameter by value for optimal move semantics- Uses
std::movewhen passing to the constructor- Returns
std::unique_ptr<Node>consistent with other factory methods- Uses brace initialization with
std::make_unique
31-31: LGTM - Efficient getter method.The
get_namemethod returnsstd::string_viewwhich avoids unnecessary copying and provides const access to the stored name.
35-35: LGTM - Proper constructor with move semantics.The private constructor correctly uses
std::moveto efficiently transfer the string parameter to the member variable, and is markednoexceptappropriately.src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.cpp (3)
1-14: LGTM - Comprehensive includes for container implementation.All necessary headers are included for the implementation, including validation utilities, error handling, and formatting dependencies.
16-23: LGTM - Correct implementation following established learning.The factory method correctly follows the retrieved learning by:
- Using
add_childmethod instead of passing children to constructor (line 21)- Validating child node type using
validate_child_node_type<Type>(line 18)- Proper error handling with
YSTDLIB_ERROR_HANDLING_TRYV- Creating the node first, then adding the child to establish parent-child relationships properly
This aligns with the learning that "derived classes should use the
add_childmethod in their factory functions rather than passing children directly to a constructor."
25-33: LGTM - Well-formatted serialization with proper indentation.The
serialize_to_strmethod implementation correctly:
- Uses multi-line formatting for better readability
- Applies appropriate indentation levels (+1 for "ElementType:", +2 for the actual element type)
- Recursively serializes the element type with proper error propagation
- Maintains consistent formatting style with other container types
src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Int.hpp (1)
14-40: LGTM!The
Intclass implementation follows good design patterns with a private constructor and static factory method. The class structure is clean and well-organized.src/spider/tdl/parser/ast/node_impl/type_impl/primitive_impl/Float.hpp (1)
14-40: LGTM!The
Floatclass implementation is consistent with theIntclass design, maintaining the same factory pattern and structure. Well implemented.src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/List.hpp (1)
14-41: LGTM!The
Listclass header is well-designed with proper error handling throughResultreturn type in the factory method. Theget_element_typemethod correctly relies on factory validation with appropriate documentation.src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.cpp (1)
69-82: LGTM! Factory method correctly usesadd_child.The factory implementation properly validates child node types and uses the
add_childmethod as per the established pattern, ensuring proper parent-child relationship management.src/spider/tdl/parser/ast/utils.hpp (1)
43-62: Well-designed template validation function.The
validate_child_node_typetemplate function is well-implemented with proper SFINAE constraint usingrequiresclause and appropriate error handling using dynamic_cast for runtime type checking.tests/tdl/test-parser-ast.cpp (7)
3-35: LGTM: Comprehensive test setup.The includes and using declarations properly support the extensive testing of the new AST node types. Good use of Catch2 generators for parameterized testing.
37-51: LGTM: Thorough Identifier node testing.Comprehensive coverage of Identifier node creation, properties, and serialization with proper assertions and test data.
53-73: LGTM: Well-designed parameterized testing.Excellent use of Catch2 generators to test all IntSpec values comprehensively. The dynamic construction of expected serialization results ensures consistency with the utility functions.
75-94: LGTM: Consistent parameterized testing approach.Good consistency with the Int test pattern, providing comprehensive coverage of FloatSpec values with proper assertions.
96-105: LGTM: Appropriate Bool node testing.Simple and effective testing for the Bool node, which correctly doesn't need parameterization unlike Int and Float types.
162-182: LGTM: Comprehensive error handling validation.Excellent negative testing that verifies proper error codes are returned for invalid container type creation scenarios.
184-202: LGTM: Thorough Map key type validation testing.Good coverage of Map-specific error handling for unsupported key types with clear commenting on the testing strategy.
src/spider/tdl/parser/ast/utils.cpp (3)
14-19: LGTM: Well-implemented indentation utility.The function correctly creates indentation with appropriate documentation explaining the braced init list limitation and proper NOLINT usage.
21-34: LGTM: Correct IntSpec serialization with proper error handling.The function correctly maps all IntSpec enum values to their string representations with appropriate error handling for unknown values.
36-45: LGTM: Consistent FloatSpec serialization implementation.Good consistency with the IntSpec serialization function, properly handling all FloatSpec values with appropriate error handling.
src/spider/tdl/parser/ast/node_impl/type_impl/container_impl/Map.hpp (3)
17-25: LGTM: Well-designed error handling.Proper class hierarchy with Container inheritance and well-structured error code enum using the project's error handling conventions.
26-37: LGTM: Well-designed factory function with comprehensive documentation.The factory function follows best practices with proper parameter types, return type, and thorough documentation of error conditions and behavior.
56-66: LGTM: Proper encapsulation and error code integration.Good use of private constructor to enforce factory usage and proper integration with the error handling system using the required macro.
Co-authored-by: sitaowang1998 <sitaowang1998@outlook.com>
Description
Reference
This PR depends on #183.
Overview
This PR adds
TypeAST nodes for primitive and container types, following this hierarchy:Notice that we still need to support
Structafter we introduceNamedVar.Checklist
breaking change.
Validation performed
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores