Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Compiler_Function_Decl Struct Reference

Node representing a top-level function declaration. More...

#include <Compiler_AST.H>

Inheritance diagram for Aleph::Compiler_Function_Decl:
[legend]
Collaboration diagram for Aleph::Compiler_Function_Decl:
[legend]

Public Member Functions

 Compiler_Function_Decl (const Source_Span &kw={}, std::string value="", const Source_Span &name_sp={}, const Source_Span &arrow_sp={}, Compiler_Type_Expr *result_annot=nullptr, Compiler_Block_Stmt *block=nullptr) noexcept
 Constructs a function declaration.
 
- Public Member Functions inherited from Aleph::Compiler_Ast_Node
 Compiler_Ast_Node (const Source_Span &sp={}) noexcept
 Constructs a node with an optional span.
 
virtual ~Compiler_Ast_Node () noexcept=default
 Virtual destructor to ensure proper cleanup of derived nodes.
 

Public Attributes

Source_Span keyword_span
 Location of the fn keyword.
 
std::string name
 Function name.
 
Source_Span name_span
 Location of the function name token.
 
DynArray< Compiler_Param > parameters
 Ordered list of parameters.
 
Source_Span arrow_span
 Location of the optional -> before the result annotation.
 
Compiler_Type_Expr * return_annotation = nullptr
 Optional declared return type.
 
Compiler_Block_Stmt * body = nullptr
 Scoped body of the function.
 
- Public Attributes inherited from Aleph::Compiler_Ast_Node
Source_Span span
 Source region covered by this node.
 

Detailed Description

Node representing a top-level function declaration.

Example: fn add(a, b) { return a + b; }.

Definition at line 1056 of file Compiler_AST.H.

Constructor & Destructor Documentation

◆ Compiler_Function_Decl()

Aleph::Compiler_Function_Decl::Compiler_Function_Decl ( const Source_Span &  kw = {},
std::string  value = "",
const Source_Span &  name_sp = {},
const Source_Span &  arrow_sp = {},
Compiler_Type_Expr *  result_annot = nullptr,
Compiler_Block_Stmt *  block = nullptr 
)
inlinenoexcept

Constructs a function declaration.

Definition at line 1067 of file Compiler_AST.H.

Member Data Documentation

◆ arrow_span

Source_Span Aleph::Compiler_Function_Decl::arrow_span

Location of the optional -> before the result annotation.

Definition at line 1062 of file Compiler_AST.H.

◆ body

Compiler_Block_Stmt* Aleph::Compiler_Function_Decl::body = nullptr

Scoped body of the function.

Definition at line 1064 of file Compiler_AST.H.

Referenced by Aleph::Compiler_Typed_Semantic_Analyzer::analyze_function(), and Aleph::Compiler_HIR_Lowering::lower_function().

◆ keyword_span

Source_Span Aleph::Compiler_Function_Decl::keyword_span

Location of the fn keyword.

Definition at line 1058 of file Compiler_AST.H.

◆ name

std::string Aleph::Compiler_Function_Decl::name

◆ name_span

Source_Span Aleph::Compiler_Function_Decl::name_span

Location of the function name token.

Definition at line 1060 of file Compiler_AST.H.

Referenced by Aleph::Compiler_Typed_Semantic_Analyzer::analyze_function(), and Aleph::Compiler_HIR_Lowering::lower_function().

◆ parameters

◆ return_annotation

Compiler_Type_Expr* Aleph::Compiler_Function_Decl::return_annotation = nullptr

Optional declared return type.

Definition at line 1063 of file Compiler_AST.H.

Referenced by Aleph::Compiler_Typed_Semantic_Analyzer::predeclare_function().


The documentation for this struct was generated from the following file: