checker: make sure all FnDecl types are valid
parent
3c08f655af
commit
270566055f
|
@ -266,7 +266,7 @@ pub fn (nn u16) hex() string {
|
||||||
if nn == 0 {
|
if nn == 0 {
|
||||||
return '0'
|
return '0'
|
||||||
}
|
}
|
||||||
|
|
||||||
mut n := nn
|
mut n := nn
|
||||||
max := 5
|
max := 5
|
||||||
mut buf := malloc(max + 1)
|
mut buf := malloc(max + 1)
|
||||||
|
@ -320,7 +320,7 @@ pub fn (nn u64) hex() string {
|
||||||
if nn == 0 {
|
if nn == 0 {
|
||||||
return '0'
|
return '0'
|
||||||
}
|
}
|
||||||
|
|
||||||
mut n := nn
|
mut n := nn
|
||||||
max := 18
|
max := 18
|
||||||
mut buf := malloc(max + 1)
|
mut buf := malloc(max + 1)
|
||||||
|
@ -356,6 +356,8 @@ pub fn (a []byte) contains(val byte) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
pub fn (c rune) str() string {
|
pub fn (c rune) str() string {
|
||||||
fst_byte := int(c)>>8 * 3 & 0xff
|
fst_byte := int(c)>>8 * 3 & 0xff
|
||||||
len := utf8_char_len(fst_byte)
|
len := utf8_char_len(fst_byte)
|
||||||
|
@ -369,6 +371,7 @@ pub fn (c rune) str() string {
|
||||||
str.str[len] = `\0`
|
str.str[len] = `\0`
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
pub fn (c byte) str() string {
|
pub fn (c byte) str() string {
|
||||||
mut str := string{
|
mut str := string{
|
||||||
|
|
|
@ -1217,6 +1217,15 @@ fn (mut c Checker) stmt(node ast.Stmt) {
|
||||||
// c.warn('duplicate method `$it.name`', it.pos)
|
// c.warn('duplicate method `$it.name`', it.pos)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
if !it.is_c {
|
||||||
|
// Make sure all types are valid
|
||||||
|
for arg in it.args {
|
||||||
|
sym := c.table.get_type_symbol(arg.typ)
|
||||||
|
if sym.kind == .placeholder {
|
||||||
|
c.error('unknown type `$sym.name`', it.pos)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
c.expected_type = table.void_type
|
c.expected_type = table.void_type
|
||||||
c.fn_return_type = it.return_type
|
c.fn_return_type = it.return_type
|
||||||
c.stmts(it.stmts)
|
c.stmts(it.stmts)
|
||||||
|
|
Loading…
Reference in New Issue