Skip to content

Commit ad5b829

Browse files
committed
v: remove closure usage from the compiler frontend (simplify bootstrapping/porting on more exotic platforms)
1 parent 38ff647 commit ad5b829

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cmd/v/v.v

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved.
22
// Use of this source code is governed by an MIT license
33
// that can be found in the LICENSE file.
4+
@[has_globals]
45
module main
56

67
import os
@@ -59,6 +60,8 @@ const external_tools = [
5960
]
6061
const list_of_flags_that_allow_duplicates = ['cc', 'd', 'define', 'cf', 'cflags']
6162

63+
__global timers = &util.Timers(unsafe { nil })
64+
6265
fn main() {
6366
unbuffer_stdout()
6467
mut timers_should_print := false
@@ -68,12 +71,12 @@ fn main() {
6871
if '-show-timings' in os.args {
6972
timers_should_print = true
7073
}
71-
mut timers := util.new_timers(should_print: timers_should_print, label: 'main')
74+
timers = util.new_timers(should_print: timers_should_print, label: 'main')
7275
timers.start('v start')
7376
timers.show('v start')
7477
timers.start('TOTAL')
7578
// use at_exit here, instead of defer, since some code paths later do early exit(0) or exit(1), for showing errors, or after `v run`
76-
at_exit(fn [mut timers] () {
79+
at_exit(fn () {
7780
timers.show('TOTAL')
7881
})!
7982
timers.start('v parsing CLI args')

0 commit comments

Comments
 (0)