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

ast: remove const hack for global_table, use a proper global instead

This commit is contained in:
Delyan Angelov 2021-12-30 13:15:38 +02:00
parent d421f28de4
commit 7531f78f67
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -1,6 +1,7 @@
// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved. // Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license // Use of this source code is governed by an MIT license
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
[has_globals]
module ast module ast
import v.cflag import v.cflag
@ -186,13 +187,10 @@ pub fn new_table() &Table {
return t return t
} }
const global_table = &Table(0) __global global_table = &Table(0)
pub fn set_global_table(t &Table) { pub fn set_global_table(t &Table) {
unsafe { global_table = t
mut pg := &ast.global_table
*pg = t
}
} }
// used to compare fn's & for naming anon fn's // used to compare fn's & for naming anon fn's