Skip to content

Feature/generic function support poc#20

Open
VxTi wants to merge 61 commits intomainfrom
feature/generic-function-support-poc
Open

Feature/generic function support poc#20
VxTi wants to merge 61 commits intomainfrom
feature/generic-function-support-poc

Conversation

@VxTi
Copy link
Copy Markdown
Owner

@VxTi VxTi commented Mar 23, 2026

No description provided.

VxTi added 29 commits March 15, 2026 14:50
…e function handling in parser

- Removed `const` qualifiers from certain `FieldDefinition` pointers to allow modifications.
- Added `AstFunctionCall` and `AstReturnStatement` classes in the AST structure.
- Introduced utilities for collecting free variables, return statements, and resolving forward references.
- Added LLVM code generation logic for function declarations and calls.
… dedicated file, improve generic type resolution and argument handling
…tion in function bodies, standardize naming in function metadata

- Introduced `resolve_generics_in_body` to resolve generic types in function bodies recursively, with bottom-up traversal.
- Renamed `GenericFunctionMetadata` to `FunctionImplementation`, streamlining function metadata handling.
- Updated logic for cloning function bodies with resolved generics.
- Improved type re-inference during generic parameter substitution.
- Improved generic resolution for object initializers in the AST (`AstObjectInitializer`).
- Added logic to resolve return types with generics in function declarations.
- Updated expression node with the ability to set generic type arguments.
…declarations

- Updated type inference to handle substitution of generic parameter names with concrete types in function calls.
- Refactored `function_definition` to `function_declaration` and enhanced overload handling for generic functions.
- Adjusted LLVM code generation to use resolved bodies for generic overloads.
- Updated function implementation metadata to include resolved function bodies.
- Minor updates to tests to integrate empty generic type lists and align with new logic.
…and expanding free variable collection for various expression types
…casting logic

- Guarded against unresolved generic parameters in multiple cases (e.g., type extraction, casting, and assignability checks).
- Updated type inference to prioritize unresolved generic parameters when resolving operation types.
- Adjusted `AstVariableDeclaration` creation to use `std::optional` for annotated types.
- Extracted `codegen_ptr` from `AstIdentifier` for pointer-based code generation.
- Refactored generic type resolution to include annotated types in `AstVariableDeclaration`.
- Streamlined identifier resolution for globals and functions.
- Simplified generic overload management and added guard clauses for absent overloads in function declarations.
- Added logic to temporarily update and restore parameter types during validation of generic function instantiations.
- Refined LLVM code generation to resolve return and parameter types for generic functions.
- Enhanced generic function matching in the function registry based on parameter counts.
…ric function variants before type resolution to ensure generic parameters are resolved correctly
…neric function definitions and improving instantiation logic
@VxTi VxTi changed the base branch from feature/add-generic-support-to-functions to main March 28, 2026 00:00
VxTi added 26 commits April 3, 2026 10:12
…ing; remove global scope variable definition methods; improve logging and type resolution
…e_variable implementation and improve traversal symbol table handling
…aversal logic to support scoped symbol tables in AST blocks and control structures
…e cloning, context resolution, and idempotency in symbol registration
… inference, symbol cloning, and generic function registration
…ing and improve type checks in function definitions
…ogging; improve type resolution, traversal logic, and function definition consistency
…parameter handling and enhance logging in function declaration and registry
…rences` methods, simplify forward reference logic, and move functionality to `ForwardReferenceInitializer`
…; integrate SymbolTable in type comparisons, simplify recursive type resolution, and consolidate type validation logic
…bolTable` into type comparisons, simplify operand access, and enhance forward reference handling with `<format>`
…d, update alias handling with `clone_as`, and simplify function type inference signature
…lify symbol table handling, function type inference signatures, and alias type resolution
…node` logic in generic and function node handling
…y `AstNodeTraverser` by delegating state handling to visitor
…resolve_forward_references` method with visitor-based approach.
…ntation` struct; refactor function body code generation logic to streamline LLVM IR generation.
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