| 2143 | } |
| 2144 | |
| 2145 | void 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 | |
| 2175 | void AddInplaceVariable(const char* pos, TypeInfo* targetType) |
| 2176 | { |
no test coverage detected