Commit Graph

9 Commits (7af6ed3f20bbf0459ce6aed833c7e170ee6c927b)

Author SHA1 Message Date
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 39d5f44863 *WI* error sets - basic support working 2018-02-02 14:26:14 -05:00
Andrew Kelley 3671582c15 syntax: functions require return type. remove `->`
The purpose of this is:

 * Only one way to do things
 * Changing a function with void return type to return a possible
   error becomes a 1 character change, subtly encouraging
   people to use errors.

See #632

Here are some imperfect sed commands for performing this update:

remove arrow:

```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```

add void:

```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```

Some cleanup may be necessary, but this should do the bulk of the work.
2018-01-25 04:10:11 -05:00
Andrew Kelley d917815d81 explicitly return from blocks
instead of last statement being expression value

closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley 0ad1239522 rework enums and unions and their relationship to each other
* @enumTagName renamed to @tagName and it works on enums and
   union-enums
 * Remove the EnumTag type. Now there is only enum and union,
   and the tag type of a union is always an enum.
 * unions support specifying the tag enum type, and they support
   inferring an enum tag type.
 * Enums no longer support field types but they do support
   setting the tag values. Likewise union-enums when inferring
   an enum tag type support setting the tag values.
 * It is now an error for enums and unions to have 0 fields.
 * switch statements support union-enums

closes #618
2017-12-03 20:43:56 -05:00
Andrew Kelley 634e8713c3 add @memberType and @memberName builtin functions
see #383

there is a plan to unify most of the reflection into 2
builtin functions, as outlined in the above issue,
but this gives us needed features for now, and we can
iterate on the design in future commits
2017-11-06 22:07:19 -05:00
Andrew Kelley f0d755153d add compile-time reflection for function arg types
See #383
2017-11-04 16:20:02 -04:00
Andrew Kelley a31b23c46b more compile-time type reflection
See #383
2017-11-03 00:00:57 -04:00