compiler: remove module_path()

pull/1714/head
Alexander Medvednikov 2019-08-23 03:10:37 +03:00
parent e39cb41d6b
commit 8f1bf6033e
2 changed files with 15 additions and 17 deletions

View File

@ -2,11 +2,12 @@
*XX Aug 2019* *XX Aug 2019*
- New `mysql` module. - 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). - Better error format that is supported by all major editors (go to error).
- Raw json fields via the `[raw]` attribute. - Raw json fields via the `[raw]` attribute.
- `import const` was removed from the language. - `import const` was removed from the language.
- All C code was removed from the `freetype` module. - 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). - Support of Objective C interfaces (primarily for using Cocoa).
- REPL: clear command and custom functions. - REPL: clear command and custom functions.
- Syntax bug fixed: `foo[0] += 10` is now possible. - Syntax bug fixed: `foo[0] += 10` is now possible.
@ -19,6 +20,7 @@
## V 0.1.18 ## V 0.1.18
*16 Aug 2019* *16 Aug 2019*
@ -145,7 +147,7 @@
- maps fixed - maps fixed
## 0.1.9 - 0.1.10 ## V 0.1.9 - 0.1.10
*29 Jun 2019* *29 Jun 2019*
- Windows support via MinGW-w64. Pre-built Windows binary. - Windows support via MinGW-w64. Pre-built Windows binary.
- File structure has been simplified: all vlib modules were moved to the vlib/ directory, - 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. - One single archive with pre-built binaries for all operating systems.
- `mut var := val` was fixed (previously `mut var = val` was allowed as well). - `mut var := val` was fixed (previously `mut var = val` was allowed as well).
## 0.1.8 ## V 0.1.8
*28 Jun 2019* *28 Jun 2019*
- Single file programs without `fn main` now work as expected. - Single file programs without `fn main` now work as expected.
- REPL has been fixed: it now supports imports, consts, function definitions, etc. - REPL has been fixed: it now supports imports, consts, function definitions, etc.
## 0.1.7 ## V 0.1.7
*27 Jun 2019* *27 Jun 2019*
- All C code in the compiler and vlib has been replaced with V. - All C code in the compiler and vlib has been replaced with V.
- `#` syntax for embedding C code has been removed. - `#` syntax for embedding C code has been removed.

View File

@ -24,13 +24,9 @@ enum BuildMode {
build //TODO a better name would be smth like `.build_module` I think build //TODO a better name would be smth like `.build_module` I think
} }
fn modules_path() string {
return os.home_dir() + '/.vmodules/'
}
const ( const (
SupportedPlatforms = ['windows', 'mac', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', 'msvc'] SupportedPlatforms = ['windows', 'mac', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', 'msvc']
ModPath = modules_path() ModPath = os.home_dir() + '/.vmodules/'
) )
enum OS { enum OS {
@ -243,11 +239,11 @@ fn (v mut V) compile() {
if v.pref.is_debug { if v.pref.is_debug {
cgen.genln('#define VDEBUG (1) ') cgen.genln('#define VDEBUG (1) ')
} }
cgen.genln(CommonCHeaders) cgen.genln(CommonCHeaders)
v.generate_hotcode_reloading_declarations() v.generate_hotcode_reloading_declarations()
imports_json := v.table.imports.contains('json') imports_json := v.table.imports.contains('json')
// TODO remove global UI hack // TODO remove global UI hack
if v.os == .mac && ((v.pref.build_mode == .embed_vlib && v.table.imports.contains('ui')) || 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() dd := d.str()
cgen.lines.set(defs_pos, dd)// TODO `def.str()` doesn't compile cgen.lines.set(defs_pos, dd)// TODO `def.str()` doesn't compile
v.generate_main() v.generate_main()
v.generate_hotcode_reloading_code() v.generate_hotcode_reloading_code()
cgen.save() cgen.save()
if v.pref.is_verbose { if v.pref.is_verbose {
v.log('flags=') v.log('flags=')
@ -325,7 +321,7 @@ fn (v mut V) compile() {
fn (v mut V) generate_main() { fn (v mut V) generate_main() {
mut cgen := v.cgen mut cgen := v.cgen
// if v.build_mode in [.default, .embed_vlib] { // if v.build_mode in [.default, .embed_vlib] {
if v.pref.build_mode == .default_mode || v.pref.build_mode == .embed_vlib { if v.pref.build_mode == .default_mode || v.pref.build_mode == .embed_vlib {
mut consts_init_body := cgen.consts_init.join_lines() mut consts_init_body := cgen.consts_init.join_lines()
@ -548,11 +544,11 @@ fn (v mut V) cc() {
else { else {
a << '-g' a << '-g'
} }
for f in v.generate_hotcode_reloading_compiler_flags() { for f in v.generate_hotcode_reloading_compiler_flags() {
a << f a << f
} }
mut libs := ''// builtin.o os.o http.o etc mut libs := ''// builtin.o os.o http.o etc
if v.pref.build_mode == .build { if v.pref.build_mode == .build {
a << '-c' a << '-c'