From 0074976636cde1be40f8de4361977cd88a1b8067 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 20 Feb 2020 12:04:51 +0100 Subject: [PATCH] checker: exit if there are errors --- vlib/v/checker/checker.v | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index e9bdbd86f2..3cfe279abf 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -33,6 +33,9 @@ pub fn (c mut Checker) check(ast_file ast.File) { for stmt in ast_file.stmts { c.stmt(stmt) } + if c.nr_errors > 0 { + exit(1) + } } pub fn (c mut Checker) check_files(ast_files []ast.File) { @@ -121,7 +124,6 @@ fn (c mut Checker) check_assign_expr(assign_expr ast.AssignExpr) { pub fn (c mut Checker) call_expr(call_expr ast.CallExpr) table.Type { fn_name := call_expr.name - mut found := false // look for function in format `mod.fn` or `fn` (main/builtin) mut f := table.Fn{} @@ -139,7 +141,6 @@ pub fn (c mut Checker) call_expr(call_expr ast.CallExpr) table.Type { if !found { c.error('unknown fn: $fn_name', call_expr.pos) } - if f.is_c || call_expr.is_c { return f.return_type }