Fix methods #58 and #55

This commit is contained in:
2026-06-04 17:38:49 +02:00
parent 20d9641dda
commit a8717aa5c4
3 changed files with 14 additions and 7 deletions
+5 -6
View File
@@ -281,8 +281,12 @@ self_param = {
"self" ~ mutable? ~ deref_px?
}
method_args = _{
((self_param ~ ("," ~ param_list)?) | param_list) ~ ","?
}
method = {
visibility? ~ type_expr ~ identifier ~ generics_decl? ~ "(" ~ self_param? ~ ("," ~ param_list)? ~ ")" ~ block
visibility? ~ type_expr ~ identifier ~ generics_decl? ~ "(" ~ method_args ~ ")" ~ (block | semicolon)
}
class_item = _{
@@ -310,13 +314,8 @@ impl_decl = {
// ======================================================
trait_requirements = { ":" ~ type_expr_param ~ ("+" ~ type_expr_param)* }
method_no_body = {
visibility? ~ type_expr ~ identifier ~ generics_decl? ~ "(" ~ self_param? ~ ("," ~ param_list)? ~ ")" ~ semicolon
}
trait_item = _{
method
| method_no_body
}
trait_decl = {