Fix: Dict initializer incorrectly re-initialized field that is set to an empty string

fixes #9835
This commit is contained in:
Gunnar Beutner 2015-08-05 07:45:10 +02:00
parent e9c2214837
commit f732ec3cb9
1 changed files with 6 additions and 2 deletions

View File

@ -604,8 +604,12 @@ bool IndexerExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *
psdhint = *dhint; psdhint = *dhint;
if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, &psdhint)) { if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, &psdhint)) {
if (init_dict && VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo()).IsEmpty()) if (init_dict) {
Value old_value = VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo());
if (old_value.IsEmpty() && !old_value.IsString())
VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo()); VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo());
}
*parent = VMOps::GetField(vparent, vindex, m_DebugInfo); *parent = VMOps::GetField(vparent, vindex, m_DebugInfo);
free_psd = true; free_psd = true;