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

Function AddGetVariableNode

NULLC/Callbacks.cpp:1914–1932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1912}
1913
1914void AddGetVariableNode(const char* pos, bool forceError)
1915{
1916 CodeInfo::lastKnownStartPos = pos;
1917
1918 TypeInfo *lastType = CodeInfo::nodeList.back()->typeInfo;
1919 if(!lastType)
1920 ThrowError(pos, "ERROR: variable type is unknown");
1921
1922 // If array size is known at compile time, then it's placed on stack when "array.size" is compiled, but member access usually shifts pointer, that is dereferenced now
1923 // So in this special case, dereferencing is not done. Yeah...
1924 if(CodeInfo::nodeList.back()->nodeType == typeNodeNumber && lastType == typeVoid)
1925 {
1926 CodeInfo::nodeList.back()->typeInfo = typeInt;
1927 }else if(lastType->funcType == NULL && lastType->refLevel != 0){
1928 CodeInfo::nodeList.push_back(new NodeDereference());
1929 }
1930 if(forceError && !lastType->refLevel)
1931 ThrowError(pos, "ERROR: cannot dereference type '%s' that is not a pointer", lastType->GetFullTypeName());
1932}
1933
1934void AddMemberAccessNode(const char* pos, InplaceStr varName)
1935{

Callers 14

AddGetAddressNodeFunction · 0.85
ConvertArrayToUnsizedFunction · 0.85
AddArrayIteratorFunction · 0.85
PrepareConstructorCallFunction · 0.85
AddMemberFunctionCallFunction · 0.85
AddFunctionCallNodeFunction · 0.85
TypeFinishFunction · 0.85
AddListGeneratorFunction · 0.85
ParseEnumFunction · 0.85
ParseVariableFunction · 0.85

Calls 3

ThrowErrorFunction · 0.85
GetFullTypeNameMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected