355 Commits

Author SHA1 Message Date
Tadeo Kondrak
7ada59f873
remove nakedcc/stdcallcc/async fn/extern fn fnproto 2020-05-05 09:37:28 -06:00
Tadeo Kondrak
b957dc29a4
Rename noasync to nosuspend in C++ compiler 2020-05-05 05:17:34 -06:00
Henry Nelson
83b0f9c6f7 Fix unfortunate typo 2020-04-26 17:33:04 -04:00
Vexu
fff00c3bbb
disallow declarations between container fields 2020-04-18 23:56:03 +03:00
LemonBoy
128e70ff3a ir: Allow errdefer with payload
Closes #1265
2020-03-21 09:54:49 +01:00
Vexu
03c1431f9c
disallow resume and suspend in noasync scopes 2020-03-09 15:51:51 +02:00
Vexu
6f8d732599
update parsers to new noasync syntax 2020-03-09 12:23:30 +02:00
Andrew Kelley
63383a8af8
consistent capitalization of error message 2020-02-19 01:24:19 -05:00
LemonBoy
a6b74cdd38
stage1: Make the parser reject extern fn with body 2020-02-18 18:18:29 -05:00
Andrew Kelley
7f7d1fbe5a
Implement noasync awaits
Note that there is not yet runtime safety for this.

See #3157
2020-02-16 01:44:52 -05:00
Michael Dusan
edb210905d
stage1: memory/report overhaul
- split util_base.hpp from util.hpp
- new namespaces: `mem` and `heap`
- new `mem::Allocator` interface
- new `heap::CAllocator` impl with global `heap::c_allocator`
- new `heap::ArenaAllocator` impl
- new `mem::TypeInfo` extracts names without RTTI
- name extraction is enabled w/ ZIG_ENABLE_MEM_PROFILE=1
- new `mem::List` takes explicit `Allocator&` parameter
- new `mem::HashMap` takes explicit `Allocator&` parameter
- add Codegen.pass1_arena and use for all `ZigValue` allocs
- deinit Codegen.pass1_arena early in `zig_llvm_emit_output()`
2020-02-10 21:08:08 -05:00
LemonBoy
21932a0ef2 Fix edge case in cast between fn with varargs
* Prevent the next_param_index to become greater than the param_count
  one as it's expected by every other function.
* Fix a typo in a error message.

Closes #4381
2020-02-05 20:31:18 +01:00
Andrew Kelley
6aac423964
split IrInstruction into IrInst, IrInstSrc, IrInstGen
This makes it so that less memory is used for IR instructions, as well
as catching bugs when one expected one kind of instruction and received
the other.
2020-01-25 21:49:32 -05:00
Vexu
0ea96c11ef disallow multiline strings in test and library names 2020-01-15 14:20:48 -05:00
Andrew Kelley
5951b79af4
remove stdcallcc, extern, nakedcc from stage1; zig fmt rewrites 2020-01-06 15:23:05 -05:00
LemonBoy
563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
Andrew Kelley
26f3c2d061
fix std.mem.addNullByte and implement sentinel slicing
see #3770
2019-12-20 18:28:56 -05:00
Vexu
c759a77aa0 fix dot init parsing 2019-12-12 13:06:48 -05:00
Andrew Kelley
a3f6a58c77
remove var args from the language
closes #208
2019-12-09 15:27:27 -05:00
Andrew Kelley
fe8d65556d
add syntax for comptime struct fields 2019-12-08 12:26:20 -05:00
LemonBoy
26c8930b95 Accept comptime-known expression for asm 2019-12-02 19:53:06 -05:00
Andrew Kelley
f25182f46d
structs can have fields with type var
behavior tests passing now
2019-11-23 17:51:37 -05:00
Andrew Kelley
7597735bad
update the stage1 implementation to the new proposal
See #3731
2019-11-23 04:45:35 -05:00
Andrew Kelley
47f06be369
string literals are now null terminated
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
Andrew Kelley
1aa978f32e
implement null terminated pointers 2019-11-21 20:43:41 -05:00
Andrew Kelley
57b8614a5a
Merge pull request #3697 from Vexu/container-docs
Implement container level doc comments
2019-11-17 22:31:12 +00:00
Vexu
6cddf9d723 properly parse anon literal in array 2019-11-17 22:24:21 +00:00
Vexu
977b613881
add container doc comments to generated docs 2019-11-15 15:17:59 +02:00
Vexu
e509d21f39
implemented container doc comments in stage 1 2019-11-15 15:02:51 +02:00
Andrew Kelley
de30438ed2
stage1 parser code for anon container lit 2019-11-11 13:11:58 -05:00
Brendan Hansknecht
c1e8fdf812 add token for parsing pointer dereference 2019-11-06 14:03:21 -05:00
Vexu
2550cb4638 remove pub syntax for container fields 2019-10-21 23:04:19 -04:00
Andrew Kelley
e0f0e2aace
generated docs: error sets in fn docs 2019-10-08 18:09:08 -04:00
Andrew Kelley
2ccb48ddc3
generated docs: show doc comments on functions 2019-10-07 12:21:11 -04:00
Andrew Kelley
8e2c441b2e
stage1 parser supports doc comments 2019-10-06 16:39:27 -04:00
Andrew Kelley
0a3c6dbda9
implement noasync function calls
See #3157
2019-09-05 21:55:32 -04:00
LemonBoy
fabf45f5fc Add the noinline keyword for function declarations 2019-09-05 13:04:58 -04:00
Andrew Kelley
6ab8b2aab4
support recursive async and non-async functions
which heap allocate their own frames

related: #1006
2019-08-30 20:06:02 -04:00
Tetralux
3ec10ea174
parsing of align(N) on struct fields 2019-08-22 22:58:02 +00:00
Vexu
2151f84d59 implement new async syntax in self-hosted compiler 2019-08-16 06:17:28 -07:00
Andrew Kelley
13b5a4bf8c
remove cancel 2019-08-15 14:05:12 -04:00
Andrew Kelley
ee64a22045
add the anyframe and anyframe->T types 2019-07-26 19:52:35 -04:00
Andrew Kelley
54e716afdc
remove coroutines implementation and promise type 2019-07-19 18:18:44 -04:00
Andrew Kelley
af8661405b
fix usingnamespace
It used to be that usingnamespace was only allowed at top level. This
made it OK to put the state inside the AST node data structure. However,
now usingnamespace can occur inside any aggregate data structure, and
therefore the state must be in the TopLevelDeclaration rather than in
the AST node.

There were two other problems with the usingnamespace implementation:

 * It was passing the wrong destination ScopeDecl, so it could cause an
   incorrect error such as "import of file outside package path".
 * When doing `usingnamespace` on a file that already had
   `pub usingnamespace` in it would "steal" the usingnamespace, causing
   incorrect "use of undeclared identifier" errors in the target file.

closes #2632
closes #2580
2019-07-19 16:56:44 -04:00
Andrew Kelley
b1f8b53d20
rename internal names regarding usingnamespace 2019-07-16 16:20:54 -04:00
hryx
cce11a724c
Make anyerror not a keyword 2019-07-06 15:57:32 -07:00
Andrew Kelley
33371ab55c
Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-11 00:09:58 -04:00
Andrew Kelley
b7811d3269
whitespace cleanup 2019-06-10 00:45:24 -04:00
SamTebbs33
6c160b8856 Add check for null body in if, for and while 2019-06-10 00:41:33 -04:00
Andrew Kelley
3a4b749c8a
Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-09 19:44:01 -04:00