mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
do not allow go print()
This commit is contained in:
parent
c8a781bf77
commit
b6bb6a5a60
@ -188,11 +188,16 @@ fn main() {
|
||||
// TODO remove
|
||||
if v.pref.autofree {
|
||||
println('started freeing v struct')
|
||||
v.table.fns.free()
|
||||
v.table.typesmap.free()
|
||||
v.table.obf_ids.free()
|
||||
v.cgen.lines.free()
|
||||
free(v.cgen)
|
||||
for _, f in v.table.fns {
|
||||
f.local_vars.free()
|
||||
f.args.free()
|
||||
//f.defer_text.free()
|
||||
}
|
||||
v.table.fns.free()
|
||||
free(v.table)
|
||||
//for p in parsers {
|
||||
|
||||
@ -226,6 +231,8 @@ fn (v mut V) compile() {
|
||||
for file in v.files {
|
||||
mut p := v.new_parser(file)
|
||||
p.parse(.decl)
|
||||
|
||||
|
||||
}
|
||||
// Main pass
|
||||
cgen.pass = Pass.main
|
||||
|
@ -17,8 +17,9 @@ struct Parser {
|
||||
file_pcguard string // When p.file_pcguard != '', it contains a
|
||||
// C ifdef guard clause that must be put before
|
||||
// the #include directives in the parsed .v file
|
||||
mut:
|
||||
v &V
|
||||
pref &Preferences // Preferences shared from V struct
|
||||
mut:
|
||||
scanner &Scanner
|
||||
// tokens []Token // TODO cache all tokens, right now they have to be scanned twice
|
||||
token_idx int
|
||||
@ -40,7 +41,6 @@ mut:
|
||||
expected_type string
|
||||
tmp_cnt int
|
||||
is_script bool
|
||||
pref &Preferences // Preferences shared from V struct
|
||||
builtin_mod bool
|
||||
vh_lines []string
|
||||
inside_if_expr bool
|
||||
@ -1078,7 +1078,7 @@ fn (p mut Parser) close_scope() {
|
||||
free_fn = 'v_array_free'
|
||||
} else if v.typ == 'string' {
|
||||
free_fn = 'v_string_free'
|
||||
//continue
|
||||
continue
|
||||
} else if v.ptr || v.typ.ends_with('*') {
|
||||
free_fn = 'v_ptr_free'
|
||||
//continue
|
||||
@ -3562,7 +3562,7 @@ fn (p mut Parser) go_statement() {
|
||||
// Normal function
|
||||
else {
|
||||
f := p.table.find_fn(p.lit) or { panic('fn') }
|
||||
if f.name == 'println' {
|
||||
if f.name == 'println' || f.name == 'print' {
|
||||
p.error('`go` cannot be used with `println`')
|
||||
}
|
||||
p.async_fn_call(f, 0, '', '')
|
||||
|
Loading…
Reference in New Issue
Block a user