From 7531f78f675dac445ec8e18db99a49a5959ad3bd Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 30 Dec 2021 13:15:38 +0200 Subject: [PATCH] ast: remove const hack for global_table, use a proper global instead --- vlib/v/ast/table.v | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index fe62ba722c..ae9572856c 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -1,6 +1,7 @@ // Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved. // Use of this source code is governed by an MIT license // that can be found in the LICENSE file. +[has_globals] module ast import v.cflag @@ -186,13 +187,10 @@ pub fn new_table() &Table { return t } -const global_table = &Table(0) +__global global_table = &Table(0) pub fn set_global_table(t &Table) { - unsafe { - mut pg := &ast.global_table - *pg = t - } + global_table = t } // used to compare fn's & for naming anon fn's