Commit Graph

120 Commits (67ae1670131cd51d11bd82eb9df46efcff401cfc)

Author SHA1 Message Date
Alexander Medvednikov 67ae167013 compiler: remove math dependency 2019-10-11 03:12:34 +03:00
Alexander Medvednikov 52168d0781 fix table.v 2019-10-10 00:56:33 +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 9defbf989d compiler: improve module import error messages 2019-10-08 02:32:12 +03:00
joe-conigliaro 22f162c3cd parser: multiple returns, allow assignment as well as deceleration closes 2019-10-05 19:17:08 +03:00
joe-conigliaro 24136ab88b compiler: get existing parser using path 2019-10-05 07:10:28 +03:00
joe-conigliaro 549413b48b compiler: no more mem error, so recycle import table struct 2019-10-04 16:12:16 +03:00
Alexander Medvednikov 5ba354fa2c `if a := foo() {` syntax for handling optionals 2019-10-01 22:57:38 +03:00
hazohelet 30ca149be7 table.v: fix typo 2019-10-01 18:08:10 +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
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 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 d4bae356ba compiler/vlib: add error for no new vars in loop ("_,_") & remove "." from errors 2019-09-25 17:59:50 +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
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 fbc19311b5 compiler: clean up get_file_import_table 2019-09-23 15:12:23 +03:00
joe-conigliaro 23c84516e2 compiler: error on unused imports 2019-09-23 13:42:20 +03:00
joe-conigliaro 090ca27b15 compiler: improve module typo error message 2019-09-23 13:40:18 +03:00
Alexander Medvednikov b4207e1be7 compiler: allow "u64_var == 0" without casting the const literal 2019-09-23 02:14:10 +03:00
Alexander Medvednikov 6a788bb364 testing: do not allow fn main in tests and make sure there is at least one test fn 2019-09-22 09:49:33 +03:00
Delyan Angelov f042dfb861 compiler: fix line numbers in unused variable error messages 2019-09-20 13:42:37 +03:00
Alexander Medvednikov ad6ab39287 table: use ?Var in find_const() 2019-09-19 14:19:44 +03:00
Alexander Medvednikov 13e4c79f58 table: use optional in find_method() 2019-09-19 04:56:22 +03:00
Alexander Medvednikov 74b82b688c table: simplify find_method() 2019-09-18 19:48:28 +03:00
Alexander Medvednikov 040d03912b table: use an optional for find_fn() 2019-09-18 15:06:34 +03:00
Alexander Medvednikov d180324413 find_field: use optional 2019-09-18 14:28:11 +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
joe-conigliaro 5db25352e5 compiler: fix module typo detection 2019-09-15 20:39:48 +03:00
joe-conigliaro 075a8e5ccb compiler: improve typo detection 2019-09-15 20:07:12 +03:00
Alexander Medvednikov 3e923871cf compiler: use *char() cast in C functions to afix warnings 2019-09-15 15:19:18 +03:00
Alexander Medvednikov 5cc81b91cb JavaSript backend (early stage) 2019-09-15 03:49:57 +03:00
joe-conigliaro 5aaa794519 compiler: clean up the typo check 2019-09-13 16:15:30 +03:00
Alexander Medvednikov 9dd86f6fb8 compiler: more memory logic + replace "cur_fn &Fn" with "cur_fn Fn" 2019-09-13 15:47:31 +03:00
joe-conigliaro 41734affb3 compiler: detect typos in function/variable/module names 2019-09-13 14:10:24 +03:00
Alexander Medvednikov 9853323157 array: make ".contains()" private, use "in" everywhere 2019-09-11 15:12:13 +03:00
Alexander Medvednikov 00687de43b memory: clean up all arrays in the V compiler 2019-09-09 13:55:47 +03:00
Alexander Medvednikov 76a89c832e parser: small optimizations 2019-08-26 01:19:39 +03:00
joe-conigliaro 8ac0a2b2dd compiler: rework flags & support win path spaces + more 2019-09-06 15:12:04 +03:00
Joe Conigliaro 1f67d9edd8 fix bugs breaking tests 2019-09-03 15:21:52 +03:00
Alexander Medvednikov 1c6d51f271 remove u8 and i32 from tests and examples 2019-09-02 15:02:25 +03:00
Alexander Medvednikov 0db1eaa55a parser: get_type2() for the upcoming type system refactoring 2019-09-02 14:55:26 +03:00