mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: fix building_v
This commit is contained in:
parent
6dcdb224a1
commit
71224ad17c
@ -97,6 +97,7 @@ mut:
|
||||
// You could pass several -cflags XXX arguments. They will be merged with each other.
|
||||
// You can also quote several options at the same time: -cflags '-Os -fno-inline-small-functions'.
|
||||
ccompiler string // the name of the used C compiler
|
||||
building_v bool
|
||||
}
|
||||
|
||||
|
||||
@ -811,6 +812,7 @@ fn new_v(args[]string) &V {
|
||||
}
|
||||
|
||||
obfuscate := args.contains('-obf')
|
||||
is_repl:=args.contains('-repl')
|
||||
pref := &Preferences {
|
||||
is_test: is_test
|
||||
is_script: is_script
|
||||
@ -827,10 +829,12 @@ fn new_v(args[]string) &V {
|
||||
show_c_cmd: args.contains('-show_c_cmd')
|
||||
translated: args.contains('translated')
|
||||
is_run: args.contains('run')
|
||||
is_repl: args.contains('-repl')
|
||||
is_repl: is_repl
|
||||
build_mode: build_mode
|
||||
cflags: cflags
|
||||
ccompiler: find_c_compiler()
|
||||
building_v: !is_repl && (dir == 'compiler' ||
|
||||
dir.contains('v/vlib'))
|
||||
}
|
||||
if pref.is_verbose || pref.is_debug {
|
||||
println('C compiler=$pref.ccompiler')
|
||||
|
@ -60,7 +60,6 @@ mut:
|
||||
attr string
|
||||
v_script bool // "V bash", import all os functions into global space
|
||||
var_decl_name string // To allow declaring the variable so that it can be used in the struct initialization
|
||||
building_v bool
|
||||
is_alloc bool // Whether current expression resulted in an allocation
|
||||
cur_gen_type string // "App" to replace "T" in current generic function
|
||||
is_vweb bool
|
||||
@ -106,8 +105,6 @@ fn (v mut V) new_parser(path string) Parser {
|
||||
pref: v.pref
|
||||
os: v.os
|
||||
vroot: v.vroot
|
||||
building_v: !v.pref.is_repl && (path.contains('compiler/') ||
|
||||
path.contains('v/vlib'))
|
||||
|
||||
}
|
||||
|
||||
@ -243,7 +240,7 @@ fn (p mut Parser) parse(pass Pass) {
|
||||
p.comp_time()
|
||||
case Token.key_global:
|
||||
if !p.pref.translated && !p.pref.is_live &&
|
||||
!p.builtin_mod && !p.building_v && !os.getwd().contains('/volt') {
|
||||
!p.builtin_mod && !p.pref.building_v && !os.getwd().contains('/volt') {
|
||||
p.error('__global is only allowed in translated code')
|
||||
}
|
||||
p.next()
|
||||
@ -1056,7 +1053,7 @@ fn (p mut Parser) close_scope() {
|
||||
// println('breaking. "$v.name" v.scope_level=$v.scope_level')
|
||||
break
|
||||
}
|
||||
if p.building_v && v.is_alloc {
|
||||
if p.pref.building_v && v.is_alloc {
|
||||
if v.typ.starts_with('array_') {
|
||||
p.genln('v_array_free($v.name); // close_scope free')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user