From 1d5284792456bb4cf80137b3f625e9d757051dd9 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 3 Apr 2020 10:52:48 +0200 Subject: [PATCH] checker: error on an unknown ident --- vlib/os/os.v | 4 ++-- vlib/v/checker/checker.v | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index 1a445ac97a..42733d9e99 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -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) { diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 4a309716e6..9eba420f1e 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -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 }