quick for deeper issue regarding block statement index
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 29 Jan 2022 05:53:23 +0000 (23:53 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 29 Jan 2022 05:53:23 +0000 (23:53 -0600)
core/type_info/helper.onyx
modules/perlin/perlin.onyx
src/symres.c

index d6ed6a5fe688e944547eed378cad8d1a6b761862..8dd29e153aa20b878bc74694712fd2bcdac228a6 100644 (file)
@@ -161,6 +161,14 @@ struct_constructed_from :: (struct_type: type_expr, base_type: type_expr) -> boo
     return (cast(^Type_Info_Struct) struct_info).constructed_from == base_type;
 }
 
+struct_inherits :: (struct_type: type_expr, base_type: type_expr) -> bool {
+    struct_info := cast(^Type_Info_Struct) get_type_info(struct_type);
+    if struct_info.kind != .Struct do return false;
+
+    first_member := ^struct_info.members[0];
+    return first_member.used && first_member.type == base_type;
+}
+
 #operator == (t1: Type_Info_Function, t2: Type_Info_Function) -> bool {
     if t1.parameter_types.count != t2.parameter_types.count do return false;
     if t1.return_type           != t2.return_type           do return false;
index a91198b28ecd9c91f2d02121a864114a3b7bcac6..d4bd4b640b4c0a903dbf3d44cd60d47758e8c650 100644 (file)
@@ -72,6 +72,9 @@ noise :: (x, y, z: f64) -> f64 {
         138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
     ]; 
 
-    p :: macro (x: i32) => cast(i32) permutations[x % 256];
+    p :: macro (x: i32) -> i32 {
+        permutations :: permutations;
+        return cast(i32) permutations[x % 256];
+    }
 }
 
index 647e5322a2f2670cc9c0dc9fe1033c7899f8463c..c4f40bfaf9568a1c9ae7425889dda0c5d7bb5945 100644 (file)
@@ -889,9 +889,9 @@ static SymresStatus symres_block(AstBlock* block) {
 
     if (block->body) {
         AstNode** start = &block->body;
-        fori (i, 0, block->statement_idx) {
-            start = &(*start)->next;
-        }
+        // fori (i, 0, block->statement_idx) {
+        //     start = &(*start)->next;
+        // }
 
         b32 remove = 0;