From 8f1bf6033e55bc1ebd0a412e43e3574a095eb969 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 23 Aug 2019 03:10:37 +0300 Subject: [PATCH] compiler: remove module_path() --- CHANGELOG.md | 10 ++++++---- compiler/main.v | 22 +++++++++------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd813e2d49..92ce217019 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,12 @@ *XX Aug 2019* - New `mysql` module. +- Custom json field names: `struct User { last_name string [json:lastName] }`. - Better error format that is supported by all major editors (go to error). - Raw json fields via the `[raw]` attribute. - `import const` was removed from the language. - All C code was removed from the `freetype` module. -- `[typedef] attribute for imported C struct typedefs. +- `[typedef]` attribute for imported C struct typedefs. - Support of Objective C interfaces (primarily for using Cocoa). - REPL: clear command and custom functions. - Syntax bug fixed: `foo[0] += 10` is now possible. @@ -19,6 +20,7 @@ + ## V 0.1.18 *16 Aug 2019* @@ -145,7 +147,7 @@ - maps fixed -## 0.1.9 - 0.1.10 +## V 0.1.9 - 0.1.10 *29 Jun 2019* - Windows support via MinGW-w64. Pre-built Windows binary. - File structure has been simplified: all vlib modules were moved to the vlib/ directory, @@ -153,12 +155,12 @@ - One single archive with pre-built binaries for all operating systems. - `mut var := val` was fixed (previously `mut var = val` was allowed as well). -## 0.1.8 +## V 0.1.8 *28 Jun 2019* - Single file programs without `fn main` now work as expected. - REPL has been fixed: it now supports imports, consts, function definitions, etc. -## 0.1.7 +## V 0.1.7 *27 Jun 2019* - All C code in the compiler and vlib has been replaced with V. - `#` syntax for embedding C code has been removed. diff --git a/compiler/main.v b/compiler/main.v index 8e3ddfa44b..ccfb45c718 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -24,13 +24,9 @@ enum BuildMode { build //TODO a better name would be smth like `.build_module` I think } -fn modules_path() string { - return os.home_dir() + '/.vmodules/' -} - const ( SupportedPlatforms = ['windows', 'mac', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', 'msvc'] - ModPath = modules_path() + ModPath = os.home_dir() + '/.vmodules/' ) enum OS { @@ -243,11 +239,11 @@ fn (v mut V) compile() { if v.pref.is_debug { cgen.genln('#define VDEBUG (1) ') } - + cgen.genln(CommonCHeaders) v.generate_hotcode_reloading_declarations() - + imports_json := v.table.imports.contains('json') // TODO remove global UI hack if v.os == .mac && ((v.pref.build_mode == .embed_vlib && v.table.imports.contains('ui')) || @@ -310,11 +306,11 @@ fn (v mut V) compile() { } dd := d.str() cgen.lines.set(defs_pos, dd)// TODO `def.str()` doesn't compile - + v.generate_main() - + v.generate_hotcode_reloading_code() - + cgen.save() if v.pref.is_verbose { v.log('flags=') @@ -325,7 +321,7 @@ fn (v mut V) compile() { fn (v mut V) generate_main() { mut cgen := v.cgen - + // if v.build_mode in [.default, .embed_vlib] { if v.pref.build_mode == .default_mode || v.pref.build_mode == .embed_vlib { mut consts_init_body := cgen.consts_init.join_lines() @@ -548,11 +544,11 @@ fn (v mut V) cc() { else { a << '-g' } - + for f in v.generate_hotcode_reloading_compiler_flags() { a << f } - + mut libs := ''// builtin.o os.o http.o etc if v.pref.build_mode == .build { a << '-c'