mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
--enable-globals
This commit is contained in:
parent
f8d14a216b
commit
f60d44eda9
@ -116,6 +116,7 @@ pub mut:
|
||||
//generating_vh bool
|
||||
comptime_define string // -D vfmt for `if $vfmt {`
|
||||
fast bool // use tcc/x64 codegen
|
||||
enable_globals bool // allow __global for low level code
|
||||
}
|
||||
|
||||
// Should be called by main at the end of the compilation process, to cleanup
|
||||
@ -934,6 +935,7 @@ pub fn new_v(args[]string) &V {
|
||||
is_run: 'run' in args
|
||||
autofree: '-autofree' in args
|
||||
compress: '-compress' in args
|
||||
enable_globals: '--enable-globals' in args
|
||||
fast: '-fast' in args
|
||||
is_repl: is_repl
|
||||
build_mode: build_mode
|
||||
|
@ -373,8 +373,12 @@ fn (p mut Parser) parse(pass Pass) {
|
||||
.key_global {
|
||||
if !p.pref.translated && !p.pref.is_live &&
|
||||
!p.builtin_mod && !p.pref.building_v &&
|
||||
p.mod != 'ui' && !os.getwd().contains('/volt') {
|
||||
p.error('__global is only allowed in translated code')
|
||||
p.mod != 'ui' && !os.getwd().contains('/volt') &&
|
||||
!p.pref.enable_globals
|
||||
{
|
||||
p.error('use `v --enable-globals ...` to enable globals')
|
||||
|
||||
//p.error('__global is only allowed in translated code')
|
||||
}
|
||||
p.next()
|
||||
name := p.check_name()
|
||||
|
Loading…
Reference in New Issue
Block a user