compiler: stage 2 of vhash support

pull/1923/head
Delyan Angelov 2019-09-11 01:12:46 +03:00 committed by Alexander Medvednikov
parent a53c69de38
commit bc606415c3
2 changed files with 7 additions and 11 deletions

View File

@ -105,8 +105,8 @@ fn main() {
args := env_vflags_and_os_args()
// Print the version and exit.
if '-v' in args || '--version' in args || 'version' in args {
versionhash := vhash()
println('V $Version $versionhash')
version_hash := vhash()
println('V $Version $version_hash')
return
}
if '-h' in args || '--help' in args || 'help' in args {
@ -1018,13 +1018,9 @@ pub fn cerror(s string) {
exit(1)
}
// TODO: this must be uncommented on stage 2, after V_COMMIT_HASH is always present and preserved
fn vhash() string {
/*
mut buf := [50]byte
buf[0] = 0
C.snprintf(buf, 50, '%s', C.V_COMMIT_HASH )
return tos_clone(buf)
*/
return '0000000'
return tos_clone(buf)
}

View File

@ -51,9 +51,9 @@ fn (r mut Repl) function_call(line string) bool {
}
fn repl_help() {
versionhash := vhash()
version_hash := vhash()
println('
V $Version $versionhash
V $Version $version_hash
help Displays this information.
Ctrl-C, Ctrl-D, exit Exits the REPL.
clear Clears the screen.
@ -61,8 +61,8 @@ V $Version $versionhash
}
fn run_repl() []string {
versionhash := vhash()
println('V $Version $versionhash')
version_hash := vhash()
println('V $Version $version_hash')
println('Use Ctrl-C or `exit` to exit')
file := '.vrepl.v'
temp_file := '.vrepl_temp.v'