| 2173 | } |
| 2174 | |
| 2175 | void 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 | |
| 2200 | void ConvertArrayToUnsized(const char* pos, TypeInfo *dstType) |
| 2201 | { |
no test coverage detected