Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 13, 2025

Summary

Changes

Before

template <typename TValue> struct ISetter<TValue>
{
    virtual void Set(TValue value) = 0;
    virtual ~ISetter<TValue>() = default;
};

After

template <typename TValue>
struct ISetter<TValue>
{
    virtual void Set(TValue value) = 0;
    virtual ~ISetter<TValue>() = default;
};

Implementation Details

  • Modified regex patterns in both CSharpToCppTransformer.cs and cs2cpp.py
  • Updated transformation rules for both struct/class and interface declarations
  • Added Environment.NewLine in C# and \n in Python to separate template and class/struct lines
  • Maintains existing functionality while improving code formatting

Test Plan

  • Added TemplateLineBreakTest for struct template declarations
  • Added InterfaceTemplateLineBreakTest for interface template declarations
  • Verified existing tests continue to pass
  • Tested regex patterns independently to ensure correct behavior

🤖 Generated with Claude Code


Resolves #68

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #68
@konard konard self-assigned this Sep 13, 2025
Place class/struct definition on the next line after template declaration for better readability. This change affects both the C# and Python implementations.

Changes:
- Modified C# regex pattern for class/struct template declarations to add newline before class/struct
- Updated Python regex patterns consistently
- Added comprehensive test cases covering both struct and interface template transformations

Before:
template <typename TValue> struct ISetter<TValue> {

After:
template <typename TValue>
struct ISetter<TValue> {

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Place class/struct definition on the next line after template definition. Fix template class/struct line formatting (Issue #68) Sep 13, 2025
@konard konard marked this pull request as ready for review September 13, 2025 01:29
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.

Place class/struct definition on the next line after template definition.

2 participants