- Change distinct -> typedef.

- Order of attribute declaration is changed for `alias`.
- Added `LANGUAGE_DEV_VERSION` env constant.
- Rename `anyfault` -> `fault`.
- Changed `fault` -> `faultdef`.
- Added `attrdef` instead of `alias` for attribute aliases.
This commit is contained in:
Christoffer Lerno
2025-03-15 15:21:55 +01:00
committed by Christoffer Lerno
parent fc5615a7a1
commit 5c77c9a754
221 changed files with 649 additions and 684 deletions

View File

@@ -1,6 +1,6 @@
module base64;
fault INVALID_CHARACTER;
faultdef INVALID_CHARACTER;
// Based on the C2 version.

View File

@@ -4,7 +4,7 @@ import std::io;
const BF_MEM = 30000;
char[BF_MEM] memory;
fault INTEPRET_FAILED;
faultdef INTEPRET_FAILED;
fn void? print_error_type_at(usz pos, String err)
{

View File

@@ -4,8 +4,7 @@ import libc;
import std::io;
import std::collections::maybe;
fault TITLE_MISSING;
fault BAD_READ;
faultdef TITLE_MISSING, BAD_READ;
struct Doc
{

View File

@@ -6,7 +6,7 @@ struct Resource
String name;
}
fault WELCOME_TO_YOUR_DOOM;
faultdef WELCOME_TO_YOUR_DOOM;
fn Resource? resource_init(String name)
{

View File

@@ -11,7 +11,7 @@ struct Game
int high;
}
fault NOT_AN_INT, FAILED_TO_READ;
faultdef NOT_AN_INT, FAILED_TO_READ;
int err_count = 0;

View File

@@ -2,7 +2,7 @@ module std::container::map{Key, Type};
import std::core::builtin;
import std::io;
fault KEY_NOT_FOUND;
faultdef KEY_NOT_FOUND;
struct Entry
{

View File

@@ -2,8 +2,8 @@ module glfw;
import std::io;
distinct Window @public = inline _Window*;
distinct Monitor @public = inline _Monitor*;
typedef Window @public = inline _Window*;
typedef Monitor @public = inline _Monitor*;
fn void Window.create(&self, int width, int height, String title, Monitor monitor = {}, Window share = {}
) @public
@@ -37,8 +37,8 @@ extern fn void terminate() @extern("glfwTerminate") @public;
extern fn void pollEvents() @extern("glfwPollEvents") @public;
distinct _Window @private = void;
distinct _Monitor @private = void;
typedef _Window @private = void;
typedef _Monitor @private = void;
extern fn _Window* _glfwCreateWindow(int width, int height, char* title, _Monitor* monitor, _Window* share) @extern("glfwCreateWindow") @private;

View File

@@ -2,7 +2,7 @@ module test;
import std::io;
import libc;
fault NO_MORE_TOKENS;
faultdef NO_MORE_TOKENS;
// While we could have written this with libc

View File

@@ -1,7 +1,7 @@
module test;
import libc;
fault NOPE;
faultde NOPE;
fn int? eventually_succeed()
{
@@ -13,7 +13,7 @@ fn int? eventually_succeed()
macro @retry(#function, int retries = 3)
{
var $Type = $typeof(#function);
anyfault e;
fault e;
do
{
$Type? result = #function;