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

Function PrepareMemberCall

NULLC/Callbacks.cpp:3667–3714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3665}
3666
3667bool PrepareMemberCall(const char* pos, const char* funcName)
3668{
3669 TypeInfo *currentType = CodeInfo::nodeList.back()->typeInfo;
3670
3671 // Implicit conversion of type ref ref to type ref
3672 if(currentType->refLevel == 2)
3673 {
3674 CodeInfo::nodeList.push_back(new NodeDereference());
3675 currentType = currentType->subType;
3676 }
3677 // Implicit conversion from type[N] ref to type[]
3678 if(currentType->refLevel == 1 && currentType->subType->arrLevel && currentType->subType->arrSize != TypeInfo::UNSIZED_ARRAY)
3679 {
3680 CodeInfo::nodeList.push_back(new NodeDereference());
3681 currentType = CodeInfo::nodeList.back()->typeInfo;
3682 }
3683 // Implicit conversion from type to type ref
3684 if(currentType->refLevel == 0)
3685 {
3686 // And from type[] to type[] ref
3687 if(currentType->arrLevel != 0 && currentType->arrSize != TypeInfo::UNSIZED_ARRAY)
3688 ConvertArrayToUnsized(pos, CodeInfo::GetArrayType(currentType->subType, TypeInfo::UNSIZED_ARRAY));
3689
3690 AddInplaceVariable(pos);
3691 AddExtraNode();
3692 currentType = CodeInfo::nodeList.back()->typeInfo;
3693 }
3694 // Check class members, in case we have to get function pointer from class member before function call
3695 if(funcName)
3696 {
3697 // Consider that function name is actually a member name
3698 unsigned int hash = GetStringHash(funcName);
3699 TypeInfo::MemberVariable *curr = currentType->subType->firstVariable;
3700 for(; curr; curr = curr->next)
3701 if(curr->nameHash == hash)
3702 break;
3703 // If a member is found
3704 if(curr)
3705 {
3706 // Get it
3707 AddMemberAccessNode(pos, InplaceStr(funcName));
3708 // Return false to signal that this is not a member function call
3709 return false;
3710 }
3711 }
3712 // Return true to signal that this is a member function call
3713 return true;
3714}
3715
3716void SelectFunctionsForHash(unsigned funcNameHash, unsigned scope)
3717{

Callers 4

AddArrayIteratorFunction · 0.85
ParseFunctionCallFunction · 0.85
ParseCustomConstructorFunction · 0.85
ParseTerminalFunction · 0.85

Calls 7

ConvertArrayToUnsizedFunction · 0.85
AddInplaceVariableFunction · 0.85
AddExtraNodeFunction · 0.85
AddMemberAccessNodeFunction · 0.85
InplaceStrClass · 0.85
GetStringHashFunction · 0.70
push_backMethod · 0.45

Tested by

no test coverage detected