From 8e1c31e860db8342212cee92625a2a1558120db2 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 18 Aug 2019 01:18:05 +0300 Subject: [PATCH] cc(): print compilation error correctly --- compiler/main.v | 9 +++++---- compiler/parser.v | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/main.v b/compiler/main.v index a77ec5358b..d56761a091 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -890,12 +890,13 @@ mut args := '' println(cmd) } ticks := time.ticks() - _ := os.exec(cmd) or { + res := os.exec(cmd) or { panic(err) } + if res.exit_code != 0 { if v.pref.is_debug { - println(err) + println(res.output) } else { - print(err.limit(200)) - if err.len > 200 { + print(res.output.limit(200)) + if res.output.len > 200 { println('...\n(Use `v -debug` to print the entire error message)\n') } } diff --git a/compiler/parser.v b/compiler/parser.v index 58c4885a4b..3868bef221 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -176,7 +176,7 @@ fn (p mut Parser) parse() { } p.fgenln('\n') p.builtin_mod = p.mod == 'builtin' - p.can_chash = p.mod == 'freetype' || p.mod=='ui' // TODO tmp remove + p.can_chash = p.mod == 'freetype' || p.mod=='ui' || p.file_path.contains('/focus.v') // TODO tmp remove // Import pass - the first and the smallest pass that only analyzes imports // fully qualify the module name, eg base64 to encoding.base64 fq_mod := p.table.qualify_module(p.mod, p.file_path)