Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

During serialisation ^Config.value is modified for each section/sub-section #31

Open
hrszpuk opened this issue Jun 11, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@hrszpuk
Copy link
Owner

hrszpuk commented Jun 11, 2024

// Section name appends to a "prefix" which is made up of the previous structs.
            if prefix {
                section_head := fmt.aprintf("%s%v%s", c.value, Options.Symbols.NestedSection, value.value)
                strings.write_string(&sections, section_head)
                new_value := fmt.aprintf("%s%v%s", c.value, Options.Symbols.NestedSection, value.value)
                delete(value.value)

                // TODO(hrs) directly modifying the values means post-serialisation values will be different... If you serialise twice you'll get double the nesting.
                // Perhaps "prefix" could be a string of previous nesting? Override it for each new section/nested section.

                value.value = new_value
                delete(section_head)
            } else {
                strings.write_string(&sections, value.value)
            }

Directly modifying the section's value is a bad idea. This means serialising more than once will lead to repeated identifier names.

@hrszpuk hrszpuk added the bug Something isn't working label Jun 11, 2024
@hrszpuk hrszpuk self-assigned this Jun 11, 2024
@hrszpuk hrszpuk mentioned this issue Jun 12, 2024
11 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant