Added a new AST member NextVar to be used for comma separated variable support.

Interface adding has been adjusted to use ParentType->Next.

Using the AST_Class->Next was bad since that breaks the linked list a body AST would have used for traversal.
This commit is contained in:
2023-09-06 03:06:30 -04:00
parent 2bfbef1d0c
commit d606c790ca
5 changed files with 111 additions and 40 deletions

View File

@ -67,15 +67,21 @@ Code& Code::operator ++()
void CodeClass::add_interface( CodeType type )
{
if ( ! ast->Next )
CodeType possible_slot = ast->ParentType;
if ( possible_slot.ast )
{
ast->Next = type;
ast->Last = ast->Next;
return;
// Were adding an interface to parent type, so we need to make sure the parent type is public.
ast->ParentAccess = AccessSpec::Public;
// If your planning on adding a proper parent,
// then you'll need to move this over to ParentType->next and update ParentAccess accordingly.
}
ast->Next->Next = type;
ast->Last = ast->Next->Next;
while ( possible_slot.ast != nullptr )
{
possible_slot.ast = (AST_Type*) possible_slot->Next.ast;
}
possible_slot.ast = type.ast;
}
void CodeParam::append( CodeParam other )
@ -129,14 +135,21 @@ CodeParam& CodeParam::operator ++()
void CodeStruct::add_interface( CodeType type )
{
if ( ! ast->Next )
CodeType possible_slot = ast->ParentType;
if ( possible_slot.ast )
{
ast->Next = type;
ast->Last = ast->Next;
// Were adding an interface to parent type, so we need to make sure the parent type is public.
ast->ParentAccess = AccessSpec::Public;
// If your planning on adding a proper parent,
// then you'll need to move this over to ParentType->next and update ParentAccess accordingly.
}
ast->Next->Next = type;
ast->Last = ast->Next->Next;
while ( possible_slot.ast != nullptr )
{
possible_slot.ast = (AST_Type*) possible_slot->Next.ast;
}
possible_slot.ast = type.ast;
}
CodeBody def_body( CodeT type )