checker: add back check struct field fn args
parent
c1ee14cc3e
commit
fb1c60c53d
|
@ -65,10 +65,8 @@ fn (pb mut Publisher) publish(name string, sender voidptr, args voidptr) {
|
||||||
if event.once {
|
if event.once {
|
||||||
pb.registry.events.delete(i)
|
pb.registry.events.delete(i)
|
||||||
}
|
}
|
||||||
//
|
if event.receiver != 0 {
|
||||||
x := event.receiver
|
event.handler(event.receiver, args, sender)
|
||||||
if x != 0 {
|
|
||||||
event.handler(x, args, sender)
|
|
||||||
} else {
|
} else {
|
||||||
event.handler(sender, args, voidptr(0))
|
event.handler(sender, args, voidptr(0))
|
||||||
}
|
}
|
||||||
|
|
|
@ -685,13 +685,17 @@ pub fn (mut c Checker) call_method(call_expr mut ast.CallExpr) table.Type {
|
||||||
return table.string_type
|
return table.string_type
|
||||||
}
|
}
|
||||||
// call struct field fn type
|
// call struct field fn type
|
||||||
// TODO: can we use SelectorExpr for all?
|
// TODO: can we use SelectorExpr for all? this dosent really belong here
|
||||||
if field := c.table.struct_find_field(left_type_sym, method_name) {
|
if field := c.table.struct_find_field(left_type_sym, method_name) {
|
||||||
field_type_sym := c.table.get_type_symbol(field.typ)
|
field_type_sym := c.table.get_type_symbol(field.typ)
|
||||||
if field_type_sym.kind == .function {
|
if field_type_sym.kind == .function {
|
||||||
call_expr.is_method = false
|
call_expr.is_method = false
|
||||||
info := field_type_sym.info as table.FnType
|
info := field_type_sym.info as table.FnType
|
||||||
call_expr.return_type = info.func.return_type
|
call_expr.return_type = info.func.return_type
|
||||||
|
// TODO: check args (do it once for all of the above)
|
||||||
|
for arg in call_expr.args {
|
||||||
|
c.expr(arg.expr)
|
||||||
|
}
|
||||||
return info.func.return_type
|
return info.func.return_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue