more tests and fixes

This commit is contained in:
ed committed 2026-10-05 00:25:48 -04:00
1 parent 4140e7e237
commit cc7fdac795
8 files changed
+841 -21

No files matched your search

+2 -1
View File
@@ -1077,7 +1077,8 @@ struct AST_Typedef
struct
{
CodeComment InlineCmt;
char _PAD_PROPERTIES_[ sizeof(AST*) * 2 ];
CodeAttributes Attributes;
char _PAD_PROPERTIES_[ sizeof(AST*) ];
Code UnderlyingType;
char _PAD_PROPERTIES_2_[ sizeof(AST*) * 3 ];
};
+4 -1
View File
@@ -158,7 +158,7 @@ void class_to_strbuilder_def( CodeClass self, StrBuilder* result )
if ( self->ParentType )
{
Str access_level = access_spec_to_str( self->ParentAccess );
strbuilder_append_fmt( result, " : %S %SB", self->Name, access_level, typename_to_strbuilder(self->ParentType) );
strbuilder_append_fmt( result, " : %S %SB", access_level, typename_to_strbuilder(self->ParentType) );
CodeTypename interface = cast(CodeTypename, self->ParentType->Next);
if ( interface )
@@ -1021,6 +1021,9 @@ void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result )
if ( bitfield_is_set( u32, self->ModuleFlags, ModuleFlag_Export ))
strbuilder_append_str( result, txt("export ") );
if ( self->Attributes )
strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) );
strbuilder_append_str( result, txt("typedef "));
// Determines if the typedef is a function typename
+3 -2
View File
@@ -1158,7 +1158,7 @@ CodeTypename def_type( Str name, Opts_def_type opt )
return InvalidCode;
}
if ( p.array_expr && p.array_expr->Type != CT_Untyped ) {
log_failure( "gen::def_type: arrayexpr is not of untyped type - %s", code_debug_str((Code)p.array_expr) );
log_failure( "gen::def_type: arrayexpr is not of untyped type - %S", code_debug_str((Code)p.array_expr) );
GEN_DEBUG_TRAP();
return InvalidCode;
}
@@ -1218,6 +1218,7 @@ CodeTypedef def_typedef( Str name, Code type, Opts_def_typedef opt )
result = (CodeTypedef) make_code();
result->Type = CT_Typedef;
result->ModuleFlags = p.mflags;
result->Attributes = p.attributes;
result->UnderlyingType = type;
if ( name.Len <= 0 )
@@ -1271,7 +1272,7 @@ CodeUsing def_using( Str name, CodeTypename type, Opts_def_using opt )
{
Opts_def_using p = get_optional(opt);
if ( ! name_check( def_using, name ) || null_check( def_using, type ) ) {
if ( ! name_check( def_using, name ) || ! null_check( def_using, type ) ) {
GEN_DEBUG_TRAP();
return InvalidCode;
}
+8 -3
View File
@@ -541,11 +541,16 @@ void lex_found_token( LexContext* ctx )
ctx->token.Type = macrotype_to_toktype(macro->Type);
b32 is_functional = macro_is_functional(* macro);
resolved_to_macro = has_args ? is_functional : ! is_functional;
if ( ! resolved_to_macro && GEN_BUILD_DEBUG ) {
log_fmt("Info(%d, %d): %S identified as a macro but usage here does not resolve to one (interpreting as identifier)\n"
, ctx->token.Line
if ( ! resolved_to_macro && GEN_BUILD_DEBUG && ! bitfield_is_set(MacroFlags, macro->Flags, MF_Allow_As_Identifier) ) {
log_fmt("Info(%d, %d): %S identified as a macro but usage here does not resolve to one (functional=%d, has_args=%d, flags=%u, next='%.*s')\n"
, ctx->token.Line
, ctx->token.Column
, macro->Name
, is_functional
, has_args
, macro->Flags
, min(16, ctx->left)
, ctx->scanner
);
}
}
+2 -2
View File
@@ -67,9 +67,9 @@ typedef void LoggerProc(LogEntry entry);
// By default this library will either crash or exit if an error is detected while generating codes.
// Even if set to not use GEN_FATAL, GEN_FATAL will still be used for memory failures as the library is unusable when they occur.
#ifdef GEN_DONT_USE_FATAL
#define log_failure log_fmt
#define log_failure( ... ) log_fmt( __VA_ARGS__ )
#else
#define log_failure GEN_FATAL
#define log_failure( ... ) GEN_FATAL( __VA_ARGS__ )
#endif
enum AccessSpec : u32