--enable-globals
parent
f8d14a216b
commit
f60d44eda9
|
@ -116,6 +116,7 @@ pub mut:
|
||||||
//generating_vh bool
|
//generating_vh bool
|
||||||
comptime_define string // -D vfmt for `if $vfmt {`
|
comptime_define string // -D vfmt for `if $vfmt {`
|
||||||
fast bool // use tcc/x64 codegen
|
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
|
// 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
|
is_run: 'run' in args
|
||||||
autofree: '-autofree' in args
|
autofree: '-autofree' in args
|
||||||
compress: '-compress' in args
|
compress: '-compress' in args
|
||||||
|
enable_globals: '--enable-globals' in args
|
||||||
fast: '-fast' in args
|
fast: '-fast' in args
|
||||||
is_repl: is_repl
|
is_repl: is_repl
|
||||||
build_mode: build_mode
|
build_mode: build_mode
|
||||||
|
|
|
@ -373,8 +373,12 @@ fn (p mut Parser) parse(pass Pass) {
|
||||||
.key_global {
|
.key_global {
|
||||||
if !p.pref.translated && !p.pref.is_live &&
|
if !p.pref.translated && !p.pref.is_live &&
|
||||||
!p.builtin_mod && !p.pref.building_v &&
|
!p.builtin_mod && !p.pref.building_v &&
|
||||||
p.mod != 'ui' && !os.getwd().contains('/volt') {
|
p.mod != 'ui' && !os.getwd().contains('/volt') &&
|
||||||
p.error('__global is only allowed in translated code')
|
!p.pref.enable_globals
|
||||||
|
{
|
||||||
|
p.error('use `v --enable-globals ...` to enable globals')
|
||||||
|
|
||||||
|
//p.error('__global is only allowed in translated code')
|
||||||
}
|
}
|
||||||
p.next()
|
p.next()
|
||||||
name := p.check_name()
|
name := p.check_name()
|
||||||
|
|
Loading…
Reference in New Issue