1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: error on an unknown ident

This commit is contained in:
Alexander Medvednikov 2020-04-03 10:52:48 +02:00
parent a25f47124d
commit 1d52847924
2 changed files with 6 additions and 4 deletions

View File

@ -683,7 +683,7 @@ pub fn get_raw_line() string {
} $else {
max := size_t(0)
mut buf := charptr(0)
nr_chars := C.getline(&buf, &max, stdin)
nr_chars := C.getline(&buf, &max, C.stdin)
//defer { unsafe{ free(buf) } }
if nr_chars == 0 || nr_chars == -1 {
return ''
@ -1118,7 +1118,7 @@ pub fn flush_stdout() {
}
pub fn flush() {
C.fflush(stdout)
C.fflush(C.stdout)
}
pub fn mkdir_all(path string) {

View File

@ -944,11 +944,13 @@ pub fn (c mut Checker) ident(ident mut ast.Ident) table.Type {
return fn_type
}
}
// TODO
// c.error('unknown ident: `$ident.name`', ident.pos)
if ident.is_c {
return table.int_type
}
// TODO
if ident.name != '_' {
c.error('unknown ident: `$ident.name`', ident.pos)
}
return table.void_type
}