comptime: fix app.$action() or {}
parent
f81562ee7e
commit
8ecd62e56f
|
@ -197,12 +197,15 @@ fn (p mut Parser) comptime_method_call(typ Type) {
|
||||||
p.cgen.cur_line = ''
|
p.cgen.cur_line = ''
|
||||||
p.check(.dollar)
|
p.check(.dollar)
|
||||||
var := p.check_name()
|
var := p.check_name()
|
||||||
for method in typ.methods {
|
for i, method in typ.methods {
|
||||||
if method.typ != 'void' {
|
if method.typ != 'void' {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
receiver := method.args[0]
|
receiver := method.args[0]
|
||||||
amp := if receiver.is_mut { '&' } else { '' }
|
amp := if receiver.is_mut { '&' } else { '' }
|
||||||
|
if i > 0 {
|
||||||
|
p.gen(' else ')
|
||||||
|
}
|
||||||
p.gen('if ( string_eq($var, _STR("$method.name")) ) ${typ.name}_$method.name($amp $p.expr_var.name);')
|
p.gen('if ( string_eq($var, _STR("$method.name")) ) ${typ.name}_$method.name($amp $p.expr_var.name);')
|
||||||
}
|
}
|
||||||
p.check(.lpar)
|
p.check(.lpar)
|
||||||
|
|
|
@ -1030,7 +1030,7 @@ fn (p mut Parser) close_scope() {
|
||||||
p.genln('v_string_free($v.name); // close_scope free')
|
p.genln('v_string_free($v.name); // close_scope free')
|
||||||
}
|
}
|
||||||
else if v.ptr {
|
else if v.ptr {
|
||||||
p.genln('free($v.name); // close_scope free')
|
//p.genln('free($v.name); // close_scope free')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue