small fix

This commit is contained in:
uan
2026-02-07 19:33:18 +01:00
parent a3b978a09d
commit 7b5eef3bcb

View File

@@ -804,6 +804,10 @@ fn (mut p Parser) parse_func_decl() FuncDecl {
p.symbols.variable_scopes << map[string]VarSymbolInfo{} p.symbols.variable_scopes << map[string]VarSymbolInfo{}
if class_name != none {
params << Param{'this', class_name+'*'}
}
if p.peek().type != .rparen { if p.peek().type != .rparen {
for { for {
if p.peek().type != .identifier { if p.peek().type != .identifier {
@@ -856,7 +860,6 @@ fn (mut p Parser) parse_func_decl() FuncDecl {
if class_name != none { if class_name != none {
p.symbols.define_method(name_tok.text, class_name, type_tok.text, Block{}) p.symbols.define_method(name_tok.text, class_name, type_tok.text, Block{})
p.symbols.define_var('this', class_name+'*', false) p.symbols.define_var('this', class_name+'*', false)
params << Param{'this', class_name+'*'}
} else { } else {
p.symbols.define_func(name_tok.text, type_tok.text, Block{}) p.symbols.define_func(name_tok.text, type_tok.text, Block{})
} }