small fix
This commit is contained in:
5
parser.v
5
parser.v
@@ -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{})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user