| 162 | |
| 163 | |
| 164 | IObject *Var::GetRef() |
| 165 | { |
| 166 | auto target_var = this; |
| 167 | if (mType == VAR_ALIAS) |
| 168 | { |
| 169 | if (mAttrib & VAR_ATTRIB_IS_OBJECT) |
| 170 | { |
| 171 | mObject->AddRef(); |
| 172 | return mObject; |
| 173 | } |
| 174 | target_var = mAliasFor; |
| 175 | } |
| 176 | auto ref = new VarRef(); |
| 177 | if (!target_var->MoveToNewFreeVar(*ref)) |
| 178 | { |
| 179 | ref->Release(); |
| 180 | return nullptr; |
| 181 | } |
| 182 | if (mType == VAR_ALIAS) |
| 183 | target_var->UpdateAlias(ref); |
| 184 | UpdateAlias(ref); |
| 185 | return ref; |
| 186 | } |
| 187 | |
| 188 | |
| 189 |
no test coverage detected