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

Function AddModifyVariableNode

NULLC/Callbacks.cpp:2145–2173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2143}
2144
2145void AddModifyVariableNode(const char* pos, CmdID cmd, const char* name)
2146{
2147 CodeInfo::lastKnownStartPos = pos;
2148
2149 // Call overloaded operator with error suppression
2150 if(AddFunctionCallNode(CodeInfo::lastKnownStartPos, name, 2, true))
2151 return;
2152
2153 NodeZeroOP *pointer = CodeInfo::nodeList[CodeInfo::nodeList.size()-2];
2154 NodeZeroOP *value = CodeInfo::nodeList.back();
2155 // Add node for variable modification
2156 CheckForImmutable(pointer->typeInfo, pos);
2157 // For indexes that aren't known at compile-time
2158 if(pointer->nodeType == typeNodeArrayIndex && !((NodeArrayIndex*)pointer)->knownShift)
2159 {
2160 // Remove value
2161 CodeInfo::nodeList.pop_back();
2162 // Create variable that will hold calculated pointer
2163 AddInplaceVariable(pos);
2164 // Get pointer from it
2165 CodeInfo::nodeList.push_back(new NodeDereference());
2166 // Restore value
2167 CodeInfo::nodeList.push_back(value);
2168 CodeInfo::nodeList.push_back(new NodeVariableModify(pointer->typeInfo, cmd));
2169 AddExtraNode();
2170 }else{
2171 CodeInfo::nodeList.push_back(new NodeVariableModify(pointer->typeInfo, cmd));
2172 }
2173}
2174
2175void AddInplaceVariable(const char* pos, TypeInfo* targetType)
2176{

Callers 1

ParseVaribleSetFunction · 0.85

Calls 7

AddFunctionCallNodeFunction · 0.85
CheckForImmutableFunction · 0.85
AddInplaceVariableFunction · 0.85
AddExtraNodeFunction · 0.85
sizeMethod · 0.45
pop_backMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected