| 7310 | |
| 7311 | |
| 7312 | Var *Script::FindOrAddBuiltInVar(LPCTSTR aVarName, VarEntry *aVarEntry) |
| 7313 | { |
| 7314 | int insert_pos; |
| 7315 | if (Var *found = mVars.Find(aVarName, &insert_pos)) |
| 7316 | return found; |
| 7317 | LPTSTR name = SimpleHeap::Malloc(aVarName); |
| 7318 | if (!name) |
| 7319 | return nullptr; |
| 7320 | Var *the_new_var = new Var(name, aVarEntry, VAR_DECLARE_GLOBAL); |
| 7321 | if (!the_new_var || !mVars.Insert(the_new_var, insert_pos)) |
| 7322 | { |
| 7323 | MemoryError(); |
| 7324 | return nullptr; |
| 7325 | } |
| 7326 | return the_new_var; |
| 7327 | } |
| 7328 | |
| 7329 | |
| 7330 |
nothing calls this directly
no test coverage detected