reduction of Code struct member function usage in base lib

This commit is contained in:
2024-12-02 02:38:55 -05:00
parent 9b68791e38
commit 9321a04ebc
9 changed files with 95 additions and 98 deletions

View File

@ -136,7 +136,7 @@ int gen_main()
case ECode::Using:
{
log_fmt("REPLACE THIS MANUALLY: %S\n", entry->Name);
CodeUsing using_ver = entry.code_cast<CodeUsing>();
CodeUsing using_ver = cast(CodeUsing, entry);
CodeTypedef typedef_ver = def_typedef(using_ver->Name, using_ver->UnderlyingType);
memory.append(typedef_ver);
@ -144,7 +144,7 @@ int gen_main()
break;
case ECode::Function_Fwd:
{
CodeFn fn = entry.code_cast<CodeFn>();
CodeFn fn = cast(CodeFn, entry);
if ( fn->Name.is_equal(txt("free")) )
{
fn->Name = get_cached_string(txt("gen_free_ptr"));
@ -154,7 +154,7 @@ int gen_main()
break;
case ECode::Function:
{
CodeFn fn = entry.code_cast<CodeFn>();
CodeFn fn = cast(CodeFn, entry);
s32 constexpr_found = fn->Specs.remove( ESpecifier::Constexpr );
if (constexpr_found > -1) {
log_fmt("Found constexpr: %S\n", entry->to_string());
@ -169,7 +169,7 @@ int gen_main()
break;
case ECode::Template:
{
CodeTemplate tmpl = entry.code_cast<CodeTemplate>();
CodeTemplate tmpl = cast(CodeTemplate, entry);
if ( tmpl->Declaration->Name.contains(txt("swap")))
{
CodeBody macro_swap = parse_global_body( txt(R"(

View File

@ -8,7 +8,7 @@ using SwapContentProc = CodeBody(void);
b32 ignore_preprocess_cond_block( StrC cond_sig, Code& entry_iter, CodeBody& body )
{
b32 found = false;
CodePreprocessCond cond = entry_iter.code_cast<CodePreprocessCond>();
CodePreprocessCond cond = cast(CodePreprocessCond, entry_iter);
if ( cond->Content.contains(cond_sig) )
{
log_fmt("Preprocess cond found: %S\n", cond->Content);
@ -44,7 +44,7 @@ b32 ignore_preprocess_cond_block( StrC cond_sig, Code& entry_iter, CodeBody& bod
bool swap_pragma_region_implementation( StrC region_name, SwapContentProc* swap_content, Code& entry_iter, CodeBody& body )
{
bool found = false;
CodePragma possible_region = entry_iter.code_cast<CodePragma>();
CodePragma possible_region = cast(CodePragma, entry_iter);
String region_sig = string_fmt_buf(GlobalAllocator, "region %s", region_name.Ptr);
String endregion_sig = string_fmt_buf(GlobalAllocator, "endregion %s", region_name.Ptr);
@ -58,7 +58,7 @@ bool swap_pragma_region_implementation( StrC region_name, SwapContentProc* swap_
(entry_iter->Type) {
case ECode::Preprocess_Pragma:
{
CodePragma possible_end_region = entry_iter.code_cast<CodePragma>();
CodePragma possible_end_region = cast(CodePragma, entry_iter);
if ( possible_end_region->Content.contains(endregion_sig) ) {
// body.append(possible_end_region);
continue_for = false;