quick-function macros; error message cleanup
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 30 Aug 2021 20:02:22 +0000 (15:02 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 30 Aug 2021 20:02:22 +0000 (15:02 -0500)
CHANGELOG
bin/onyx
src/onyxchecker.c
src/onyxparser.c

index c99f480678e4a016f1547f858b059d420789f1f3..65f4327c343574043219ba778ed0e2347dba59f7 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
-Release v0.0.7
+Release v0.1.0-beta
 --------------
 This release contains MANY CHANGES because I am terrible at keeping up to date with a
 proper changelog and release schedule. Basically, this is the first release where I
@@ -8,6 +8,10 @@ are going to be changed and added in the future, but first I want to get this be
 version out there in a packaged format.
 
 Additions:
+* Quick-Functions
+* do-expressions
+* typeof
+* '#auto' return type
 * Macros and paste-able code blocks
 * overloaded procedures can have polymorphic and overloaded procedures as overloads.  This makes them MUCH more powerful.
 * types are not required on struct members that have default values. This is still very experimental so there are some
@@ -31,6 +35,7 @@ Additions:
 Removals:
 
 Changes:
+* initialization statements on if/while/switch are a lot more powerful.
 * the "proc" keyword is now optional in a lot of cases. There are inevitably some bugs with this change,
     but you can always add it in when it may be necessary. Note, that for overloaded procedures, "#match"
     is now used.
index 8d2601d3a4178de4a47c25e8e4d05277a248a06e..82cd9f03e844dbf14d72e076dd1ef72de74fde39 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index c7ec01e37b2fd9a34de8092108aeac2221a64ce7..59978901eaa196bac09356381b5d1695f8301124 100644 (file)
@@ -1940,7 +1940,7 @@ CheckStatus check_function(AstFunction* func) {
     expected_return_type = &func->type->Function.return_type;
     if (func->body) {
         CheckStatus status = check_block(func->body);
-        if (status == Check_Error && func->generated_from)
+        if (status == Check_Error && func->generated_from && context.cycle_detected == 0)
             ERROR(func->generated_from->pos, "Error in polymorphic procedure generated from this location.");
 
         if (status != Check_Success) return status;
index 58c34b4028925b1264d44b0d99f6260da70b1101..bfc44810f22701ca8a9aa60ea211eab5a43a2396 100644 (file)
@@ -2418,7 +2418,12 @@ static AstIf* parse_static_if_stmt(OnyxParser* parser, b32 parse_block_as_statem
 static AstMacro* parse_macro(OnyxParser* parser) {
     AstMacro* macro = make_node(AstMacro, Ast_Kind_Macro);
     macro->token = expect_token(parser, Token_Type_Keyword_Macro);
-    macro->body  = (AstTyped *) parse_function_definition(parser, macro->token);
+    
+    // First try quick function
+    if (!parse_possible_quick_function_definition(parser, &macro->body)) {
+        // Otherwise, do a normal function
+        macro->body  = (AstTyped *) parse_function_definition(parser, macro->token);
+    }
 
     ENTITY_SUBMIT(macro);
     return macro;