Super VTable generation

This commit is contained in:
2026-06-07 01:18:14 +02:00
parent fafc03d5d8
commit 58e1f9ddd2
5 changed files with 46 additions and 4 deletions
+1
View File
@@ -94,6 +94,7 @@ pub struct ClassConstructor {
#[derive(Debug, Clone, Serialize)]
pub struct FunctionDecl {
pub visibility: Visibility,
pub is_override: bool,
pub name: Identifier,
pub generics: GenericsDecl,
pub params: ParamList,
+4 -1
View File
@@ -32,6 +32,7 @@ keyword = {
| "loop"
| "fn"
| "unsafe"
| "override"
}
identifier = @{
@@ -324,8 +325,10 @@ trait_decl = {
// FUNCTIONS
// ======================================================
override_kw = { "override" }
function_decl = {
visibility? ~ "fn" ~ identifier ~ generics_decl? ~ "(" ~ method_args ~ ")" ~ type_expr? ~ (block | semicolon)
visibility? ~ override_kw? ~ "fn" ~ identifier ~ generics_decl? ~ "(" ~ method_args ~ ")" ~ type_expr? ~ (block | semicolon)
}
// ======================================================
@@ -13,6 +13,7 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for FunctionDecl {
ast_ensure!(pair, Rule::function_decl => {
let mut inner = pair.into_inner();
let visibility = Visibility::try_from(&mut inner);
let is_override: AstResult<bool> = Ok(listen_rule(&mut inner, Rule::override_kw));
let name = Identifier::try_from(inner.next().unwrap());
let generics = consume_rule(&mut inner, Rule::generics_decl)
@@ -66,6 +67,7 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for FunctionDecl {
ast_expr!(Self {
visibility: visibility,
is_override: is_override,
return_type: return_type,
name: name,
generics: generics,