Updated readme, added def_body and AST::validate_body

Fixed meson first setup error with missing thirdparty dir (removed it since its no longer used)

Improved SOA test to use newly added funtions.
This commit is contained in:
2023-07-12 15:59:47 -04:00
parent 128b0e17fe
commit 4e61fefc55
13 changed files with 319 additions and 193 deletions

View File

@ -51,7 +51,7 @@ Code gen__buffer( StrC type, sw type_size )
Code init;
{
Code params = def_params( args(
, def_param( t_allocator_info, name(allocator))
def_param( t_allocator_info, name(allocator))
, def_param( t_sw, name(capacity))
));

View File

@ -140,7 +140,7 @@ Code gen__hashtable( StrC type )
char const* tmpl = stringize(
void (*) ( u64 key, <type> value )
);
Code value = untyped_str( token_fmt( "type", (StrC)t_type.to_string(), tmpl ) );
Code value = untyped_str( token_fmt( "type", (StrC)t_type->to_string(), tmpl ) );
using_map_proc = def_using ( name(MapProc), value);
}
@ -166,7 +166,7 @@ Code gen__hashtable( StrC type )
char const* tmpl = stringize(
void (*) ( u64 key, <type> value )
);
Code value = untyped_str( token_fmt( "type", (StrC)t_type_ptr.to_string(), tmpl ) );
Code value = untyped_str( token_fmt( "type", (StrC)t_type_ptr->to_string(), tmpl ) );
using_map_mut_proc = def_using ( name(MapMutProc), value);
}
@ -373,7 +373,7 @@ Code gen__hashtable( StrC type )
);
hashtable = def_struct( name, def_struct_body( args(
, using_entry
using_entry
, using_array_entry
, using_find_result
, using_map_proc

View File

@ -46,7 +46,7 @@ Code gen__ring( StrC type )
Code init;
{
Code params = def_params( args(
, def_param( t_allocator_info, name(allocator) )
def_param( t_allocator_info, name(allocator) )
, def_param( t_uw, name(max_size) )
));

View File

@ -3,7 +3,7 @@
using namespace gen;
u32 gen_sanity()
u32 gen_sanity_upfront()
{
Builder
gen_sanity_file;
@ -27,7 +27,8 @@ u32 gen_sanity()
Code empty_body;
{
Code cmt = def_comment( txt_StrC("Empty class body") );
Code body = def_class_body( 1, cmt );
Code body = def_class_body( args( cmt ) );
empty_body = def_class( name(TestEmptyClass), body );
}
@ -87,9 +88,7 @@ u32 gen_sanity()
// Friend
{
Code fwd = def_class( name(TestFriendFwd));
Code body = def_class_body( 1
, def_friend( fwd )
);
Code body = def_class_body( args( def_friend( fwd ) ) );
gen_sanity_file.print( def_class( name(TestFriend), body ) );
}
@ -196,7 +195,7 @@ u32 gen_sanity()
Code op_ptr = def_operator_cast( t_u8_ptr, __ );
Code op_class = def_class( name(TestOperatorCast), def_class_body( 1, op_ptr ) );
Code op_class = def_class( name(TestOperatorCast), def_class_body( args( op_ptr) ) );
gen_sanity_file.print(op_class);
}
@ -245,7 +244,7 @@ u32 gen_sanity()
{
Code fwd_fn = def_function( name(test_function_specifiers), __, __, __, spec_inline );
// TODO: Need an op overload here
// TODO : Need an op overload here
Code u8_ptr = def_type( name(u8), __, spec_ptr );
Code typedef_u8_ptr = def_typedef( name(ConstExprTest), u8_ptr );
@ -262,7 +261,7 @@ u32 gen_sanity()
Code empty_body;
{
Code cmt = def_comment( txt_StrC("Empty struct body") );
Code body = def_class_body( 1, cmt );
Code body = def_class_body( args( cmt ) );
empty_body = def_class( name(TestEmptyStruct), body );
}