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

-bare option

This commit is contained in:
Alexander Medvednikov 2019-11-14 06:50:21 +03:00
parent b1fa0d25f0
commit 1d460c4d49
2 changed files with 7 additions and 2 deletions

View File

@ -346,12 +346,10 @@ fn (p mut Parser) name_expr() string {
}
else if !p.is_var_decl && is_or_else {
f.typ = p.gen_handle_option_or_else(f.typ, '', fn_call_ph)
p.print_tok()
}
else if !p.is_var_decl && !is_or_else && !p.inside_return_expr &&
f.typ.starts_with('Option_') {
opt_type := f.typ[7..]
p.print_tok()
p.error('unhandled option type: `?$opt_type`')
}

View File

@ -118,6 +118,7 @@ pub mut:
fast bool // use tcc/x64 codegen
enable_globals bool // allow __global for low level code
is_fmt bool
is_bare bool
}
// Should be called by main at the end of the compilation process, to cleanup
@ -940,6 +941,7 @@ pub fn new_v(args[]string) &V {
compress: '-compress' in args
enable_globals: '--enable-globals' in args
fast: '-fast' in args
is_bare: '-bare' in args
is_repl: is_repl
build_mode: build_mode
cflags: cflags
@ -954,6 +956,11 @@ pub fn new_v(args[]string) &V {
if pref.is_so {
out_name_c = out_name.all_after(os.path_separator) + '_shared_lib.c'
}
$if !linux {
if pref.is_bare {
verror('-bare only works on Linux for now')
}
}
return &V{
os: _os
out_name: out_name