Skip to content

Feature/split serialize#2460

Open
aleksisch wants to merge 2 commits intoGaijinEntertainment:masterfrom
aleksisch:feature/split-serialize
Open

Feature/split serialize#2460
aleksisch wants to merge 2 commits intoGaijinEntertainment:masterfrom
aleksisch:feature/split-serialize

Conversation

@aleksisch
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors AST expression serialization by removing per-node serialize(AstSerializer&) virtual methods from Expression subclasses and replacing them with a visitor-based serialization path driven by a new Expression::dispatch(Visitor&) shim.

Changes:

  • Replace Expression::serialize/ExprXxx::serialize with Expression::dispatch/ExprXxx::dispatch and route expression serialization through SerializeVisitor.
  • Add src/ast/ast_dispatch.cpp implementing dispatch for expression classes.
  • Wire the new dispatch TU into the build and update headers accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/builtin/module_builtin_ast_serialize.cpp Moves expression serialization into SerializeVisitor and updates AstSerializer::operator<<(ExpressionPtr&) to use dispatch.
src/ast/ast_dispatch.cpp Adds per-class dispatch shims to call the correct Visitor::preVisit(...) overloads.
include/daScript/ast/ast_expressions.h Replaces serialize overrides with dispatch declarations for expression types.
include/daScript/ast/ast.h Replaces Expression::serialize with Expression::dispatch and forward-declares Visitor.
CMakeLists.txt Adds src/ast/ast_dispatch.cpp to AST_SRC.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ast/ast_dispatch.cpp Outdated
Comment thread src/builtin/module_builtin_ast_serialize.cpp Outdated
Comment thread src/builtin/module_builtin_ast_serialize.cpp
Comment thread src/ast/ast_dispatch.cpp Outdated
@borisbat borisbat self-assigned this Apr 23, 2026
@aleksisch aleksisch force-pushed the feature/split-serialize branch from c9af88f to cfd618d Compare May 2, 2026 19:47
@aleksisch aleksisch marked this pull request as draft May 2, 2026 19:47
aleksisch added 2 commits May 6, 2026 00:11
Now we can reuse visitor to just visit one node, not recursively.
It will be used in following commit to extract serialize from
Expression.
Ast should not know anything about serialization. Now serializer
is separate visitor declared in
src/builtin/module_builtin_ast_serialize.cpp
@aleksisch aleksisch force-pushed the feature/split-serialize branch from cfd618d to c6385f9 Compare May 5, 2026 21:11
@aleksisch aleksisch marked this pull request as ready for review May 5, 2026 21:12
@borisbat borisbat requested a review from Copilot May 5, 2026 21:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

void SerializeVisitor::preVisitExpression ( Expression * expr ) {
serializeBase(expr);
ser << macro;
ser.serializePointer(inFunction);
void SerializeVisitor::preVisit ( ExprLooksLikeCall * expr ) {
serializeLooksLikeCall(expr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants