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

Function AddInplaceVariable

NULLC/Callbacks.cpp:2175–2198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2173}
2174
2175void AddInplaceVariable(const char* pos, TypeInfo* targetType)
2176{
2177 char *arrName = AllocateString(16);
2178 int length = sprintf(arrName, "$temp%d", inplaceVariableNum++);
2179
2180 // Save variable creation state
2181 TypeInfo *saveCurrType = currType;
2182 bool saveVarDefined = varDefined;
2183
2184 // Set type to auto
2185 currType = targetType;
2186 // Add hidden variable
2187 VariableInfo *varInfo = AddVariable(pos, InplaceStr(arrName, length));
2188 // Set it to value on top of the stack
2189 AddDefineVariableNode(pos, varInfo, true);
2190 // Remove it from stack
2191 AddPopNode(pos);
2192 // Put pointer to hidden variable on stack
2193 AddGetAddressNode(pos, InplaceStr(arrName, length));
2194
2195 // Restore variable creation state
2196 varDefined = saveVarDefined;
2197 currType = saveCurrType;
2198}
2199
2200void ConvertArrayToUnsized(const char* pos, TypeInfo *dstType)
2201{

Callers 10

AddArrayIndexNodeFunction · 0.85
AddMemberAccessNodeFunction · 0.85
AddUnaryModifyOpNodeFunction · 0.85
AddModifyVariableNodeFunction · 0.85
ConvertArrayToUnsizedFunction · 0.85
AddArrayIteratorFunction · 0.85
PrepareConstructorCallFunction · 0.85
PrepareMemberCallFunction · 0.85
AddFunctionCallNodeFunction · 0.85
BeginSwitchFunction · 0.85

Calls 6

AllocateStringFunction · 0.85
AddVariableFunction · 0.85
InplaceStrClass · 0.85
AddDefineVariableNodeFunction · 0.85
AddPopNodeFunction · 0.85
AddGetAddressNodeFunction · 0.85

Tested by

no test coverage detected