Fixes for typedef serialization of functions..

Also fix for HashTable<>::rehash_fast not having finished implemenation...

The typedef fix is a sort of hack (like how parsing the rest of the language feels like tbh...).
I might make a def_typedef_fn to make it clearer how to define function typedefs using the upfront interface.
This commit is contained in:
2023-08-07 20:16:04 -04:00
parent c4d5637a64
commit ed3246c6b0
6 changed files with 201 additions and 67 deletions

View File

@ -1221,7 +1221,6 @@ CodeTypedef def_typedef( StrC name, Code type, CodeAttributes attributes, Module
{
using namespace ECode;
name_check( def_typedef, name );
null_check( def_typedef, type );
switch ( type->Type )
@ -1260,12 +1259,28 @@ CodeTypedef def_typedef( StrC name, Code type, CodeAttributes attributes, Module
CodeTypedef
result = (CodeTypedef) make_code();
result->Name = get_cached_string( name );
result->Type = ECode::Typedef;
result->ModuleFlags = mflags;
result->UnderlyingType = type;
if ( name.Len <= 0 )
{
if (type->Type != Untyped)
{
log_failure( "gen::def_typedef: name was empty and type was not untyped (indicating its a function typedef) - %s", type.debug_str() );
return CodeInvalid;
}
result->Name = get_cached_string( type->Name );
result->IsFunction = true;
}
else
{
result->Name = get_cached_string( name );
result->IsFunction = false;
}
return result;
}