From eca65c7878196c1b258be4611bc71719650568d9 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 28 Jan 2022 23:53:23 -0600 Subject: [PATCH] quick for deeper issue regarding block statement index --- core/type_info/helper.onyx | 8 ++++++++ modules/perlin/perlin.onyx | 5 ++++- src/symres.c | 6 +++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/core/type_info/helper.onyx b/core/type_info/helper.onyx index d6ed6a5f..8dd29e15 100644 --- a/core/type_info/helper.onyx +++ b/core/type_info/helper.onyx @@ -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; diff --git a/modules/perlin/perlin.onyx b/modules/perlin/perlin.onyx index a91198b2..d4bd4b64 100644 --- a/modules/perlin/perlin.onyx +++ b/modules/perlin/perlin.onyx @@ -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]; + } } diff --git a/src/symres.c b/src/symres.c index 647e5322..c4f40bfa 100644 --- a/src/symres.c +++ b/src/symres.c @@ -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; -- 2.25.1