mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-30 19:01:02 -07:00
Parsing constructors passed the sanity test!
This commit is contained in:
@ -258,12 +258,9 @@ Code gen__array( StrC type, sw type_size )
|
||||
set_capacity = def_function( name(set_capacity), def_param( t_uw, name(new_capacity)), t_bool, body );
|
||||
}
|
||||
|
||||
Code op_ptr = untyped_str( code(
|
||||
operator Type*()
|
||||
{
|
||||
return Data;
|
||||
}
|
||||
));
|
||||
Code op_ptr = def_operator_cast( t_type_ptr, def_execution( code(
|
||||
return Data;
|
||||
)));
|
||||
|
||||
Code body = def_struct_body( 20
|
||||
, using_header
|
||||
@ -327,7 +324,7 @@ void gen__array_request( StrC type, sw size, StrC dep = {} )
|
||||
GenArrayRequest request = { dep, type, size };
|
||||
array_append( GenArrayRequests, request );
|
||||
}
|
||||
#define gen_array( type ) gen__array_request( { txt_n_len(type) }, sizeof(type) )
|
||||
#define gen_array( type ) gen__array_request( { txt_to_StrC(type) }, sizeof(type) )
|
||||
|
||||
u32 gen_array_file()
|
||||
{
|
||||
|
@ -172,12 +172,9 @@ Code gen__buffer( StrC type, sw type_size )
|
||||
))
|
||||
);
|
||||
|
||||
Code op_type_ptr = untyped_str( code(
|
||||
operator Type*()
|
||||
{
|
||||
return Data;
|
||||
}
|
||||
));
|
||||
Code op_type_ptr = def_operator_cast( t_type_ptr, def_execution( code(
|
||||
return Data;
|
||||
)));
|
||||
|
||||
buffer = def_struct( name, def_struct_body( 14
|
||||
, using_header
|
||||
@ -232,7 +229,7 @@ void gen__buffer_request( StrC type, sw size, StrC dep = {} )
|
||||
GenBufferRequest request = { dep, type, size};
|
||||
array_append( GenBufferRequests, request );
|
||||
}
|
||||
#define gen_buffer( type ) gen__buffer_request( { txt_n_len(type) }, sizeof( type ))
|
||||
#define gen_buffer( type ) gen__buffer_request( { txt_to_StrC(type) }, sizeof( type ))
|
||||
|
||||
u32 gen_buffer_file()
|
||||
{
|
||||
|
@ -425,7 +425,7 @@ void gen__hashtable_request( StrC type, sw size, StrC dep = {} )
|
||||
GenHashTableRequest request = { dep, type, size};
|
||||
array_append( GenHashTableRequests, request );
|
||||
}
|
||||
#define gen_hashtable( type ) gen__hashtable_request( { txt_n_len(type) }, sizeof( type ))
|
||||
#define gen_hashtable( type ) gen__hashtable_request( { txt_to_StrC(type) }, sizeof( type ))
|
||||
|
||||
u32 gen_hashtable_file()
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ void gen__ring_request( StrC type, sw size, StrC dep = {} )
|
||||
GenRingRequest request = { dep, type, size};
|
||||
array_append( GenRingRequests, request );
|
||||
}
|
||||
#define gen_ring( type ) gen__ring_request( { txt_n_len(type) }, sizeof( type ))
|
||||
#define gen_ring( type ) gen__ring_request( { txt_to_StrC(type) }, sizeof( type ))
|
||||
|
||||
u32 gen_ring_file()
|
||||
{
|
||||
|
@ -190,6 +190,19 @@ u32 gen_sanity()
|
||||
|
||||
gen_sanity_file.print_fmt("\n");
|
||||
|
||||
// Operator cast
|
||||
{
|
||||
Code t_u8_ptr = def_type( name(u8), __, spec_ptr );
|
||||
|
||||
Code op_ptr = def_operator_cast( t_u8_ptr, __ );
|
||||
|
||||
Code op_class = def_class( name(TestOperatorCast), def_class_body( 1, op_ptr ) );
|
||||
|
||||
gen_sanity_file.print(op_class);
|
||||
}
|
||||
|
||||
gen_sanity_file.print_fmt("\n");
|
||||
|
||||
// Parameters
|
||||
{
|
||||
Code fwd;
|
||||
@ -295,6 +308,21 @@ u32 gen_sanity()
|
||||
|
||||
gen_sanity_file.print_fmt("\n");
|
||||
|
||||
// Template
|
||||
{
|
||||
Code t_Type = def_type( name(Type) );
|
||||
|
||||
Code tmpl = def_template( def_param( t_class, name(Type) )
|
||||
, def_function( name(test_template), def_param( t_Type, name(a) ), __
|
||||
, def_function_body(1, def_comment( StrC::from("Empty template function body")))
|
||||
)
|
||||
);
|
||||
|
||||
gen_sanity_file.print(tmpl);
|
||||
}
|
||||
|
||||
gen_sanity_file.print_fmt("\n");
|
||||
|
||||
gen_sanity_file.print( def_comment( StrC::from(
|
||||
"End of base case tests.\n"
|
||||
)));
|
||||
|
Reference in New Issue
Block a user