MCPcopy Create free account
hub / github.com/WheretIB/nullc / ResolveType

Function ResolveType

NULLC/Compiler.cpp:575–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573}
574
575void ResolveType(TypeInfo* info)
576{
577 if(info->hasFinished)
578 return;
579 if(info->arrLevel)
580 {
581 ResolveType(info->subType);
582 info->size = info->arrSize * info->subType->size;
583 if(info->size % 4 != 0)
584 {
585 info->paddingBytes = 4 - (info->size % 4);
586 info->size += 4 - (info->size % 4);
587 }
588 info->hasFinished = true;
589 return;
590 }
591 if(info->funcType)
592 {
593 info->hasFinished = true;
594 for(unsigned int n = 0; n < info->funcType->paramCount; n++)
595 info->funcType->paramSize += info->funcType->paramType[n]->size > 4 ? info->funcType->paramType[n]->size : 4;
596 return;
597 }
598 info->size = 0;
599 for(TypeInfo::MemberVariable *curr = info->firstVariable; curr; curr = curr->next)
600 {
601 if(curr->defaultValue)
602 continue;
603 ResolveType(curr->type);
604
605 unsigned int alignment = curr->type->alignBytes > 4 ? 4 : curr->type->alignBytes;
606 if(alignment && info->size % alignment != 0)
607 info->size += alignment - (info->size % alignment);
608 curr->offset = info->size;
609 info->size += curr->type->size;
610 }
611 if(info->type != TypeInfo::TYPE_COMPLEX)
612 info->size = stackTypeSize[info->stackType];
613 if(info->size % 4 != 0)
614 {
615 info->paddingBytes = 4 - (info->size % 4);
616 info->size += 4 - (info->size % 4);
617 }
618 info->hasFinished = true;
619 return;
620}
621
622bool Compiler::ImportModule(const char* bytecode, const char* pos, unsigned int number)
623{

Callers 1

ImportModuleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected