Commit Graph

3374 Commits

Author SHA1 Message Date
Andrew Kelley
aa232089f2 translate-c: fix while loop with no body 2018-08-05 18:06:39 -04:00
Andrew Kelley
9bd8b01650 fix tagged union initialization with a runtime void
closes #1328
2018-08-03 15:21:08 -04:00
Andrew Kelley
c66c6304f9 add a friendly note in .gitignore 2018-08-03 15:20:19 -04:00
Matthew D. Steele
dcaaa241df Fix a type error in std.os.linux.getpid() (#1326)
syscall0() returns usize, but we were trying to @bitCast to i32.
2018-08-03 11:45:23 -04:00
Matthew D. Steele
c2a08d7c51 Fix the start-less-than-end assertion in std.rand.Random.range (#1325)
The function returns a value in [start, end), but was asserting
start <= end instead of start < end.  With this fix, range(1, 1)
will now assertion error instead of dividing by zero.
2018-08-03 11:44:39 -04:00
kristopher tate
298abbcff8 better support for _ identifier
* disallow variable declaration of `_`
 * prevent `_` from shadowing itself
 * prevent read access of `_`

closes #1204
closes #1320
2018-08-03 02:57:17 -04:00
Andrew Kelley
fb05b96492 Merge branch 'kristate-handle-builtin-issue1296' 2018-08-02 14:16:46 -04:00
Andrew Kelley
895f262a55 pull request fixups
* clean up parser code
 * fix stage2 parse and render code
 * remove redundant test
 * make stage1 compile tests leaner
2018-08-02 14:15:31 -04:00
Andrew Kelley
44fd3045ce Merge branch 'handle-builtin-issue1296' of https://github.com/kristate/zig into kristate-handle-builtin-issue1296 2018-08-02 13:37:24 -04:00
Andrew Kelley
9ecbabfc4c Merge branch 'pr-1319' 2018-08-02 13:35:06 -04:00
Andrew Kelley
729f2aceb0 fix API of RtlGenRandom 2018-08-02 13:34:31 -04:00
Andrew Kelley
cbca434cf0 Merge branch 'windows-RtlGenRandom-issue1318' of https://github.com/kristate/zig into pr-1319 2018-08-02 13:26:02 -04:00
kristopher tate
782043e2e6 std/os/windows/util.zig: SKIP instead of PASS on non-windows systems;
Tracking Issue #1318 ;
2018-08-03 02:16:49 +09:00
kristopher tate
dde7eb45c5 std/os/index.zig: call getRandomBytes() twice and compare;
Tracking Issue #1318 ;
2018-08-03 02:16:19 +09:00
kristopher tate
c44653f40f std/os/index.zig: swap CryptGetRandom() with RtlGenRandom();
Tracking Issue #1318 ;
2018-08-03 02:14:52 +09:00
kristopher tate
22fd359e2c std/os/windows/advapi32.zig: add SystemFunction036;
Tracking Issue #1318 ;
2018-08-03 02:14:06 +09:00
kristopher tate
432b7685bf std/os/index.zig: use "hw.logicalcpu" instead of "hw.ncpu" in macOS; (#1317)
Tracking Issue #1252 ;

hw.ncpu was deprecated in macOS. Among 4 new options available (hw.{physicalcpu, physicalcpu_max, logicalcpu, logicalcpu_max}), hw.logicalcpu was chosen because it actually reflects the number of logical cores the OS sees.
2018-08-02 12:59:59 -04:00
kristopher tate
96a94e7da9 std/event: directly return @handle();
Tracking Issue #1296 ;
2018-08-02 17:52:40 +09:00
kristopher tate
ac0a87d58d doc/langref.html.in: add builtin @handle() to docs;
Tracking Issue #1296 ;
2018-08-02 17:47:39 +09:00
kristopher tate
9b890d7067 test/cases/cancel.zig: update suspend to use @handle();
Tracking Issue #1296 ;
2018-08-02 17:47:03 +09:00
kristopher tate
9bed23f8b7 test/cases/coroutines.zig: update suspend to use @handle();
Tracking Issue #1296 ;
2018-08-02 17:46:41 +09:00
kristopher tate
915e321a23 doc/langref.html.in: update suspend example with @handle();
Tracking Issue #1296 ;
2018-08-02 17:45:35 +09:00
kristopher tate
5de92425d5 src/parser.cpp: fix typo from rebase; 2018-08-02 17:11:37 +09:00
kristopher tate
ff4a03f351 doc/langref.html.in: update docs to reflect that the promise symbol is no in scope with suspend;
Tracking Issue #1296 ;
2018-08-02 17:03:39 +09:00
kristopher tate
51955a5ca2 test/compile_errors.zig: update test to reflect that the promise symbol is no in scope with suspend;
Tracking Issue #1296 ;
2018-08-02 17:02:14 +09:00
kristopher tate
9b3cebcdb9 test/cases/coroutines.zig: test for immediate resume inside of suspend with @handle();
Tracking Issue #1296 ;
2018-08-02 17:02:14 +09:00
kristopher tate
3241ada468 test/cases/coroutines.zig: update test to reflect that the promise symbol is no in scope with suspend;
Tracking Issue #1296 ;
2018-08-02 17:02:14 +09:00
kristopher tate
79792a32e1 test/cases/coroutine_await_struct.zig: update test to reflect that the promise symbol is no in scope with suspend;
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
bc032a89cc std/zig/parser_test.zig: update test to reflect that the promise symbol is no in scope with suspend;
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
9fe140abad std/event/tcp.zig: remove promise_symbol from suspend and use @handle();
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
a3705b4251 std/event/loop.zig: remove promise_symbol from suspend and use @handle();
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
efec3a0e34 std/event/lock.zig: remove promise_symbol from suspend and use @handle();
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
b4ff464d39 std/event/group.zig: remove promise_symbol from suspend and use @handle();
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
244a7fdafb std/event/future.zig: remove promise_symbol from suspend and use @handle();
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
29057e5511 std/event/channel.zig: remove promise_symbol from suspend and use @handle();
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
d3f628907a src/parser.cpp: remove promise_symbol from suspend;
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
b3cd65d56e src/ir.cpp: remove promise_symbol from suspend;
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
5e5685c117 src/ast_render.cpp: remove promise_symbol from suspend;
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
ca1b356337 src/all_types.hpp: remove promise_symbol from suspend;
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
92cb330e16 src/codegen.cpp: @handle(): replace hacky ref chain with llvm intrinsic;
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
13ec5db234 test/compile_errors.zig: @handle() in non-async function
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
c546f750f1 test/compile_errors.zig: @handle() called outside of function definition;
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
104bdb03d6 src/codegen.cpp: return promise instead of null promise;
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
a8ea236095 src/ir.cpp: don't allow @handle() outside of a function;
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
fcf53b31fc src/ir.cpp: return promise->T instead of promise;
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
1f0040dd92 test/cases/coroutines.zig: remove dummy assert used for testing; 2018-08-02 16:50:08 +09:00
kristopher tate
c1a3b0cb0a src/ir.cpp: add/throw error for @handle() in a non async context;
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
db362bec18 src/codegen.cpp: reassert that there are no generated errors in codegen;
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
0ee6502562 src/codegen.cpp: remove add_node_error from ir_render_handle;
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
81f463626a src/codegen.cpp: add/throw error for @handle() in a non async context;
Tracking Issue #1296 ;

I removed/commented-out the assert checking for no errors since we now have some errors rendered.
2018-08-02 16:50:08 +09:00