572 Commits

Author SHA1 Message Date
Alexandros Naskos
9ba400673d Generating TypeInfo's now forces definitions to be resolved. 2018-04-28 18:38:38 +03:00
Alexandros Naskos
61b0180596 Added definition TypeInfo generation, except for function definitions. 2018-04-28 17:01:19 +03:00
Alexandros Naskos
ea2596280f Added BoundFn TypeInfo generation. 2018-04-27 05:10:20 +03:00
Alexandros Naskos
8f703f919f Added Fn TypeInfo generation. 2018-04-27 04:29:50 +03:00
Alexandros Naskos
a2dadbc206 Added struct TypeInfo generation. 2018-04-27 02:52:09 +03:00
Alexandros Naskos
9041d0d37e Fixed enum tag type detection in TypeInfo generation. 2018-04-27 02:05:24 +03:00
Alexandros Naskos
884e32d5c3 Added ErrorUnion, Union TypeInfo generation 2018-04-26 19:56:34 +03:00
Alexandros Naskos
fbbbee6b72 Switched to shallow TypeInfo. 2018-04-26 18:18:47 +03:00
Alexandros Naskos
4aa5d87ada Added ErrorSet TypeInfo generation. 2018-04-26 17:14:38 +03:00
Alexandros Naskos
f5977f68eb Added Enum TypeInfo except for methods 2018-04-26 16:41:59 +03:00
Alexandros Naskos
7a91e4736a Reset parent on cached TypeInfo values if we need to. 2018-04-26 14:29:27 +03:00
Alexandros Naskos
bb56360bfa Added TypeInfo cache 2018-04-26 14:03:19 +03:00
Alexandros Naskos
dd88d7deda Cleanup 2018-04-26 13:27:16 +03:00
Alexandros Naskos
bc160821d3 Changed TypeInfo layout. 2018-04-25 17:50:11 +03:00
Alexandros Naskos
2606993cb4 Fixed ir_type_info_struct_set_parent for struct parents. 2018-04-25 11:59:35 +03:00
Alexandros Naskos
d68aea4f35 Added checks for field name/index mapping in TypeInfo generation. Abstracted the parent setting out. 2018-04-25 11:35:46 +03:00
Alexandros Naskos
778b931bf3 Fixed comptime union void field access 2018-04-25 02:50:18 +03:00
Alexandros Naskos
182a9fad2d Added ArrayInfo, NullableInfo, PromiseInfo generation 2018-04-24 17:38:30 +03:00
Alexandros Naskos
09d7033d1d PointerInfo child is known at comptime 2018-04-24 17:08:45 +03:00
Alexandros Naskos
2d8553c853 Fixed PointerInfo generation 2018-04-24 17:01:20 +03:00
Alexandros Naskos
189e8e97bd PointerInfo child is a pointer to a TypeInfo union, still not working correctly 2018-04-24 16:50:36 +03:00
Alexandros Naskos
0e5fb035e3 Added (broken) pointer info, float info 2018-04-24 16:23:22 +03:00
Alexandros Naskos
e9309d3b13 Fixed IntInfo generation. 2018-04-24 15:17:34 +03:00
Alexandros Naskos
ec2a3ed500 Attempt at adding comptime union field access 2018-04-24 15:03:46 +03:00
Alexandros Naskos
fb88f5a0d2 @typeInfo with void payloads now works! 2018-04-24 11:20:33 +03:00
Alexandros Naskos
7eab62325b One step towards @typeInfo 2018-04-24 01:49:22 +03:00
Andrew Kelley
8503eff8c1 add compile error for invalid deref on switch target
closes #945
2018-04-22 23:46:55 -04:00
Andrew Kelley
6e57243a79 zig fmt: preserve comments in front of test blocks
* refactor std.zig.parser
 * fix compiler crashing for some compile errors
 * take advantage of @field in std.zig.ast
 * move ast.NodeFoo to ast.Node.Foo
 * comment preservation is more explicit

See #911
2018-04-20 02:15:09 -04:00
Jimmi Holst Christensen
1b91478bff Optimized field ptr ir for hot path and fix assignment bug 2018-04-19 21:34:18 +02:00
Jimmi Holst Christensen
6b4f6ebd89 Added field builtin function 2018-04-19 20:11:16 +02:00
Andrew Kelley
06909ceaab support break in suspend blocks
* you can label suspend blocks
 * labeled break supports suspend blocks

See #803
2018-04-18 22:21:54 -04:00
Andrew Kelley
f1f998e071 improve cmpxchg
* remove @cmpxchg, add @cmpxchgWeak and @cmpxchgStrong
   - See explanations in the langref.
 * add operand type as first parameter
 * return type is ?T where T is the operand type

closes #461
2018-04-18 12:16:42 -04:00
Andrew Kelley
b9360640ce add @atomicLoad builtin
See #174
2018-04-15 18:12:00 -04:00
Andrew Kelley
b5459eb987 add @sqrt built-in function
See #767
2018-04-15 13:26:58 -04:00
Andrew Kelley
b7af9edb8a add std.os.createThread
this adds kernel thread support to the standard library for
linux.

See #174
2018-04-14 02:24:05 -04:00
Andrew Kelley
373b3586a1 inline functions must be stored in const or comptime var
closes #913
2018-04-12 16:26:23 -04:00
Andrew Kelley
e48e707c32 allow integer and float literals to be passed to var params
closes #623
2018-04-11 14:47:37 -04:00
Andrew Kelley
e85a10e9f5 async tcp server proof of concept 2018-04-09 00:52:45 -04:00
Andrew Kelley
acd8f6ef18 fixups from rebase 2018-04-08 18:49:20 -04:00
Andrew Kelley
b85ef656ca running into the llvm corosplit error again 2018-04-08 18:30:54 -04:00
Andrew Kelley
0d22a00f6f *WIP* async/await TCP server 2018-04-08 18:26:24 -04:00
Andrew Kelley
ee1a4f4c1d error return traces work with async return case 2018-04-08 17:44:29 -04:00
Andrew Kelley
ada441157f put the error return addresses in the coro frame 2018-04-08 16:04:48 -04:00
Andrew Kelley
d26905c102 error return traces for the early return case
it would work but LLVM is not correctly spilling the addresses.

See #821
2018-04-08 16:04:48 -04:00
Marc Tiehuis
2e5115b068 Add run compiler command
'zig run file.zig' builds a file and stores the artifacts in the global
cache. On successful compilation the binary is executed.

'zig run file.zig -- a b c' does the same, but passes the arguments a,
b and c as runtime arguments to the program. Everything after an '--' are
treated as runtime arguments.

On a posix system, a shebang can be used to run a zig file directly. An
example shebang would be '#!/usr/bin/zig run'. You may not be able pass
extra compile arguments currently as part of the shebang. Linux for example
treats all arguments after the first as a single argument which will result
in an 'invalid command'.

Currently there is no customisability for the cache path as a compile
argument. For a posix system you can use `TMPDIR=. zig run file.zig` to
override, in this case using the current directory for the run cache.

The input file is always recompiled, even if it has changed. This is
intended to be cached but further discussion/thought needs to go into
this.

Closes #466.
2018-04-01 17:03:06 +12:00
Andrew Kelley
032fccf615 fix compile time array concatenation for slices
closes #866
2018-03-28 23:25:12 -04:00
Andrew Kelley
6cb99fdac3 fix crash when compile error in analyzing @panic call 2018-03-27 15:07:45 -04:00
Andrew Kelley
aa2995ee39 fix invalid codegen for error return traces across suspend points
See #821

Now the code works correctly, but error return traces are missing
the frames from coroutines.
2018-03-24 22:07:12 -04:00
Andrew Kelley
897e783763 add promise->T syntax parsing
closes #857
2018-03-24 19:25:53 -04:00
Andrew Kelley
18af2f9a27 fix async fns with inferred error sets
closes #856
2018-03-24 18:28:32 -04:00