Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native: inital support for aliased types #18703

Merged
merged 3 commits into from
Jun 29, 2023

Conversation

Spydr06
Copy link
Member

@Spydr06 Spydr06 commented Jun 28, 2023

This PR adds support for aliased data types.

Note
There are probably still some places where a g.unwrap(type) call is needed, but we will discover them as we go.

🤖 Generated by Copilot at 184156c

This pull request refactors the native code generator to support different architectures and handle type aliases more consistently and robustly. It introduces a new unwrap function and a new address_size method to simplify the code generation logic and error handling. It also adds some new test cases and error messages to improve the quality and coverage of the native backend.

🤖 Generated by Copilot at 184156c

  • Add a new method address_size to the CodeGen interface and its implementations Amd64 and Arm64 to return the size of an address in bytes for the target architecture (link, link, link)
  • Introduce a new function unwrap that resolves any type aliases and returns the underlying type (link)
  • Simplify the get_ident_var method by removing the redundant typ variable and returning the LocalVar struct directly (link)
  • Add a new case for ast.TypeDecl in the gen_stmt method to handle type declarations in the native backend (link)
  • Add some new test cases to the struct.vv file to test the handling of type aliases, pointers, and return values in the native backend (link)

@medvednikov medvednikov merged commit c4ba47a into vlang:master Jun 29, 2023
40 checks passed
@Spydr06 Spydr06 deleted the native-aliases branch June 29, 2023 18:51
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.

2 participants