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

compiler: more precise 'declared and not used' error positioning

* compiler: extract and cleanup error handling functionality into its own file compiler/compile_errors.v

* compiler: implement p.error_with_token_index and p.warn_with_token_index and use them. Fix tests.

* tools/performance_compare: add a 'Source lines in compiler/' line

* MSVC does not have STDOUT_FILENO nor STDERR_FILENO ...
This commit is contained in:
Delyan Angelov
2019-09-29 20:37:39 +03:00
committed by Alexander Medvednikov
parent 6d483c0a56
commit e72fe25224
9 changed files with 303 additions and 241 deletions

View File

@ -0,0 +1,9 @@
module term
pub fn can_show_color_on_stdout() bool {
return can_show_color_on_fd(1)
}
pub fn can_show_color_on_stderr() bool {
return can_show_color_on_fd(2)
}

View File

@ -4,8 +4,8 @@ import os
fn C.isatty(int) int
pub fn can_show_color() bool {
pub fn can_show_color_on_fd(fd int) bool {
if os.getenv('TERM') == 'dumb' { return false }
if C.isatty(1) != 0 { return true }
if C.isatty(fd) != 0 { return true }
return false
}

View File

@ -4,7 +4,7 @@ import os
// TODO: implement proper checking on windows too.
// For now, just return false by default
pub fn can_show_color() bool {
pub fn can_show_color_on_fd(fd int) bool {
if os.getenv('TERM') == 'dumb' { return false }
return false
}