Skip to content

Move TryFrom<&FnDecl> for FunctionType from types.rs to conversions.rs#12

Open
Meredith2328 wants to merge 1 commit into
tea-compiler:mainfrom
Meredith2328:refactor/move-fndecl-tryfrom-to-conversions
Open

Move TryFrom<&FnDecl> for FunctionType from types.rs to conversions.rs#12
Meredith2328 wants to merge 1 commit into
tea-compiler:mainfrom
Meredith2328:refactor/move-fndecl-tryfrom-to-conversions

Conversation

@Meredith2328

Copy link
Copy Markdown
Contributor

src/ir/types.rs, the module that defines IR data structures, previously imported crate::ast solely to implement TryFrom<&ast::FnDecl> for FunctionType.
This introduced a reverse dependency — the low-level IR type-definition layer had to know about AST nodes — and scattered the AST→IR conversion logic across two files.

This commit unifies all AST→IR type and signature conversions under src/ir/gen/conversions.rs by moving the only such impl that previously lived outside that module.

  • Remove use crate::ast from types.rs
  • Move the TryFrom<&FnDecl> impl from types.rs to conversions.rs (no logic changed — the conversion and its validation rules are preserved verbatim)
  • Add FunctionType import to conversions.rs
  • Update module-level and section comments in conversions.rs to reflect the broader scope

src/ir/types.rs, the module that defines IR data structures, previously
imported crate::ast solely to implement TryFrom<&ast::FnDecl> for
FunctionType.
This introduced a reverse dependency — the low-level IR
type-definition layer had to know about AST nodes — and scattered the
AST→IR conversion logic across two files.

Unify all AST→IR type and signature conversions under
src/ir/gen/conversions.rs.

- Remove use crate::ast from types.rs
- Move the TryFrom<&FnDecl> impl from types.rs to conversions.rs
  (no logic changed — the conversion and its validation rules are
  preserved verbatim)
- Add FunctionType import to conversions.rs
- Update module-level and section comments in conversions.rs to
  reflect the broader scope
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