From 6c6be7acaafff114dab7dc5d5a4463da45ad2525 Mon Sep 17 00:00:00 2001 From: Ivan Greene Date: Sat, 22 Jun 2019 23:34:41 -0500 Subject: [PATCH] Convert OS to enum --- compiler/main.v | 14 ++++++-------- compiler/parser.v | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/compiler/main.v b/compiler/main.v index d3226e74c0..b541a9fb35 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -33,13 +33,11 @@ const ( TmpPath = vtmp_path() ) -// TODO V was re-written in V before enums were implemented. Lots of consts need to be replaced with -// enums. -const ( - MAC = 0 - LINUX = 1 - WINDOWS = 2 -) +enum Os { + MAC + LINUX + WINDOWS +} enum Pass { // A very short pass that only looks at imports in the begginning of each file @@ -63,7 +61,7 @@ enum Pass { struct V { mut: build_mode BuildMode - os int // the OS to build for + os Os // the OS to build for nofmt bool // disable vfmt out_name_c string // name of the temporary C file files []string // all V files that need to be parsed and compiled diff --git a/compiler/parser.v b/compiler/parser.v index f116ae1023..a22131de06 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -41,7 +41,7 @@ mut: cgen *CGen table *Table run Pass // TODO rename `run` to `pass` - os int + os Os pkg string inside_const bool expr_var Var