native: inital support for aliased types #18703
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for aliased data types.
🤖 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 newaddress_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
address_size
to theCodeGen
interface and its implementationsAmd64
andArm64
to return the size of an address in bytes for the target architecture (link, link, link)unwrap
that resolves any type aliases and returns the underlying type (link)mov_reg_to_var
(link, link)mov_var_to_reg
(link, link, link)assign_var
(link, link)gen_return
(link)gen_var_decl
(link, link)get_field_offset
(link)get_type_align
(link)mov_reg_to_var
(link)assign_var
(link)gen_var_decl
(link)get_ident_var
method by removing the redundanttyp
variable and returning theLocalVar
struct directly (link)ast.TypeDecl
in thegen_stmt
method to handle type declarations in the native backend (link)struct.vv
file to test the handling of type aliases, pointers, and return values in the native backend (link)