Commit Graph

155 Commits (4c91a5c94bf644c69a2f322911841d2607cb635f)

Author SHA1 Message Date
joe-conigliaro 51388fea75 compiler: module init function & init consts for cached modules 2019-10-12 01:17:37 +03:00
Delyan Angelov 2b087dbf95 backtraces: add source line numbers too on linux
* Add source line numbers to backtraces on linux.

* Fix -g (broken after token caching).

* reset the #line directives after all the v code is compiled

* cleanup p.cgen.line setting inside p.next() .

* Support windows filepaths like "C:\Users\travis\build\vlang\v\v.exe.tmp.c" inside generated #line directives.

* Try to diagnose better windows-gcc failing.

* Revert "Try to diagnose better windows-gcc failing."

* implement and use cescaped_path/1 .

* Use cescaped_path/1 consistently throughout compiler/ .
2019-10-12 00:04:42 +03:00
Alexander Medvednikov e1dd4c19b5 compiler: cache modules if they are not built yet 2019-10-10 22:53:59 +03:00
Alexander Medvednikov 2ee252be5f fix vid compilation 2019-10-10 01:46:05 +03:00
Alexander Medvednikov 2411b8d1e7 module cache fixes; do not allow function names starting with _ 2019-10-10 00:44:26 +03:00
joe-conigliaro febd532c4a parser: allow multi returns in high order fns 2019-10-09 20:55:36 +03:00
Alexander Medvednikov a9a73d9315 caching modules: almost there 2019-10-09 06:35:58 +03:00
Anders Busch c620da9089 compiler: rename Tok/Token to Token/TokenKind 2019-10-09 01:05:34 +03:00
joe-conigliaro b4bf12378e fix newline being added when using print with int 2019-10-08 09:52:11 +03:00
Alexander Medvednikov 03bc5ab3d5 compiler: use the new optimized in 2019-10-06 16:56:22 +03:00
Alexander Medvednikov 52f4f4026b
compiler: cache modules 2019-10-04 15:48:09 +03:00
Alexander Medvednikov 745413331b Revert "remove accidental duplicate code"
This reverts commit 7eaf289e33.
2019-10-03 02:41:48 +03:00
Alexander Medvednikov 7eaf289e33 remove accidental duplicate code 2019-10-03 02:21:38 +03:00
joe-conigliaro 282cd44cec compiler: variadic fn - improve error, fix bug when only arg is varg 2019-10-01 14:48:19 +03:00
joe-conigliaro 7311db60a0 compiler: vargs - for loop support & indexing / dot fixes 2019-09-30 17:11:12 +03:00
joe-conigliaro f7c8e923c0 compiler/lang: add variadic function args support 2019-09-30 13:46:50 +03:00
Delyan Angelov e72fe25224 compiler: more precise 'declared and not used' error positioning
* compiler: extract and cleanup error handling functionality into its own file compiler/compile_errors.v

* compiler: implement p.error_with_token_index and p.warn_with_token_index and use them. Fix tests.

* tools/performance_compare: add a 'Source lines in compiler/' line

* MSVC does not have STDOUT_FILENO nor STDERR_FILENO ...
2019-09-29 20:37:39 +03:00
Alexander Medvednikov 83022a2478 fix pushing to mutable array args 2019-09-29 17:02:28 +03:00
Alexander Medvednikov ee8ff39454 rename ModPath to v_modules_path; do not allow long variable names without _ 2019-09-29 05:34:17 +03:00
Delyan Angelov 8b8cd13929 parser: add some infrastructure for more specific errors
* compiler: change s.line_nr in just one place, so that s.last_nl_pos will be updated in tandem too.

* Cleanup spurious spaces.

* Store ScannerPos info inside the cached tokens.

Use the stored information when errors are encountered.

* Fix #2079 ( cannot use type...in assignment ).

* do not store scannerpos per each token, instead rescan the source once on error to get the position.

* compiler: implement highlighting for errors. Use only line/col info stored in the cached tokens.

* fixing building on windows

* Split can_show_color to _nix and _win files.
2019-09-29 04:33:23 +03:00
Alexander Medvednikov a52662fca0 do not allow duplicate methods; fix os_win.v; minor fixes and docs 2019-09-29 04:13:32 +03:00
Delyan Angelov a4cbe78d97 compiler: streamline main function handling
* compiler: streamline C main function generation

* fix most tests

* compiler: fix for 'go update()' in graph.v . More precise parser error messages.

* Fix temporarily examples/hot_reload/message.v by using os inside it (os.clear).

* Make graph.v easier to quickly modify by defining y outside the loop.

* Fix failure of /v/nv/compiler/tests/defer_test.v when run with 'v -g' (#line directive was not on its own line, but right after } ).

* Do not pass the os.args to tests, even if the tests import os (they are more stable when run in a controlled environment).

* fix declared and not used in the js backend.

* fix js main => main__main too.
2019-09-28 20:42:29 +03:00
joe-conigliaro ed3a4961d0 compiler: blank identifier for loops. dont declare any variables 2019-09-28 19:53:56 +03:00
Alexander Medvednikov 1821dac795 compiler: remove old generics hack; disable generics and repl tests for
now
2019-09-28 02:29:04 +03:00
joe-conigliaro ad99b82930 compiler: make vgen use strings.Builder & allow parser creation from string 2019-09-27 14:02:01 +03:00
Alexander Medvednikov da43267e09 parser: cached tokens (second step) 2019-09-27 04:01:12 +03:00
Alexander Medvednikov 04e4018228 compiler: small fixes + some logic for freeing strings 2019-09-26 03:24:58 +03:00
joe-conigliaro 8974aa4513 compiler/vlib: change `_ :=` to `_ =` and disable `_ :=` 2019-09-25 15:10:45 +03:00
Alexander Medvednikov 55d09d23b4 compiler: rename cerror() to verror(); some small optimizations 2019-09-24 19:38:04 +03:00
joe-conigliaro 3317d7fd7c compiler: clean up multiple returns and verify number of returned values 2019-09-24 13:14:04 +03:00
joe-conigliaro a44a03f9a5 compiler: fix mark_var_used() 2019-09-24 06:18:06 +03:00
Alexander Medvednikov f27f3515ae compiler: optimize mark_var_used() etc 2019-09-23 23:06:40 +03:00
Alexander Medvednikov 8d52d877fb compiler: free local_vars 2019-09-23 22:16:52 +03:00
Alexander Medvednikov bf1ee28194 ui: Objective-C @interface support for Cocoa; minor clean-ups 2019-09-23 15:54:17 +03:00
joe-conigliaro 23c84516e2 compiler: error on unused imports 2019-09-23 13:42:20 +03:00
joe-conigliaro 23e30962b9 compiler: multiple returns - add test & fix use with array/map 2019-09-23 13:39:35 +03:00
joe-conigliaro 60d932e57d compiler: functions with multiple returns 2019-09-23 05:45:19 +03:00
joe-conigliaro b1e1536d56 compiler: fix live reload on win with auto completed filename `.\file.v` 2019-09-21 17:08:48 +03:00
Henrixounez ffcff9ebd4 builtins: ustring comparisons, concatenation and other functions 2019-09-20 19:07:38 +03:00
Delyan Angelov f042dfb861 compiler: fix line numbers in unused variable error messages 2019-09-20 13:42:37 +03:00
joe-conigliaro f657d70a67 typo detection: only check fn variables in same or higher scope 2019-09-20 12:23:42 +03:00
Alexander Medvednikov 9a7fface7d make the unused variable error a warning in non-production builds 2019-09-19 19:50:43 +03:00
Alexander Medvednikov a94c1556ce array: remove temporary repeat2() 2019-09-19 05:22:24 +03:00
Alexander Medvednikov 13e4c79f58 table: use optional in find_method() 2019-09-19 04:56:22 +03:00
Alexander Medvednikov 040d03912b table: use an optional for find_fn() 2019-09-18 15:06:34 +03:00
Alexander Medvednikov d1500511e6 "none" keyword for optionals + more memory fixes 2019-09-18 14:15:10 +03:00
Alexander Medvednikov 1397d532c6 compiler: check if mutable receivers are modified 2019-09-17 13:10:43 +03:00
Alexander Medvednikov 19b04d5427 math: fix const warnings 2019-09-16 22:49:18 +03:00
BigBlack 3e52984e88 compiler: another C function call fix 2019-09-16 18:28:20 +03:00
joe-conigliaro cbd4478b5e compiler: fix msvc empty struct & enable travis msvc 2019-09-16 13:01:07 +03:00