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

compiler: stage 2 of vhash support

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

View File

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