Skip to content

Fix/update string type conditions - #16

Draft
Hamedblue1381 wants to merge 9 commits into
masterfrom
fix/update-string-type-conditions
Draft

Fix/update string type conditions#16
Hamedblue1381 wants to merge 9 commits into
masterfrom
fix/update-string-type-conditions

Conversation

@Hamedblue1381

Copy link
Copy Markdown
Contributor

Context

This PR closes issue #14.

The problem was:

  • The TypeScript generator threw an error if encoding was not "ascii".
  • We were allowing string as a type, which should not be valid.

What I did

  • ❌ Removed support for string as valid types.
  • ✅ Updated the generator to use sia.addString{N|8|16|32|64} and sia.readString{N|8|16|32|64} or addAscii{number} and readAscii{number} based on the string type, not the encoding.
  • For Python, Go, and C++ generators, the encoding field is now ignored, as their respective SIA libraries do not have specific functions or arguments related to encodings.
  • Refactor the code abit with suffix map namings and usage of switch case for more readability

Tests

  • ✅ Updated test mock to make sure string now throw errors.
  • ✅ Confirmed that string8, string16, string32, string64 all generate correct code.

Notes

  • Users must now use valid types: stringN, string8, string16, string32, or string64.
  • The encoding field is ignored in the Python, Go, and C++ generators — type controls everything now.

@Hamedblue1381 Hamedblue1381 self-assigned this Jun 12, 2025
@Hamedblue1381

Copy link
Copy Markdown
Contributor Author

I havent figured out what function names for stringN must be used, WIP

@Hamedblue1381
Hamedblue1381 force-pushed the fix/update-string-type-conditions branch from a1a2676 to e59121e Compare July 8, 2025 16:27
@Hamedblue1381

Copy link
Copy Markdown
Contributor Author

requires asciiN and stringN to be merged

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.

1 participant