Fixes to serialization, reduced Define_CodeType macro

Now the execution code is generated in bootstrap/singleheader gen.
This commit is contained in:
2023-08-06 17:19:57 -04:00
parent 97750388ad
commit a4f9596d3b
5 changed files with 163 additions and 148 deletions

View File

@ -524,29 +524,15 @@ struct CodeStruct
AST_Struct* ast;
};
#define Define_CodeType( Typename ) \
struct Code##Typename \
{ \
Using_Code( Code##Typename ); \
AST* raw() \
{ \
return rcast( AST*, ast ); \
} \
operator Code() \
{ \
return * rcast( Code*, this ); \
} \
AST_##Typename* operator->() \
{ \
if ( ast == nullptr ) \
{ \
log_failure("Attempt to dereference a nullptr!"); \
return nullptr; \
} \
return ast; \
} \
AST_##Typename* ast; \
}
#define Define_CodeType( Typename ) \
struct Code##Typename \
{ \
Using_Code( Code ## Typename ); \
AST* raw(); \
operator Code(); \
AST_##Typename* operator->(); \
AST_##Typename* ast; \
}
Define_CodeType( Attributes );
Define_CodeType( Comment );