Value vparent;
String vindex;
DebugHint *psdhint = NULL;
+ bool free_psd = false;
+
+ if (dhint)
+ psdhint = *dhint;
if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, &psdhint)) {
if (init_dict && VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo()).IsEmpty())
VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo());
*parent = VMOps::GetField(vparent, vindex, m_DebugInfo);
+ free_psd = true;
} else {
ExpressionResult operand1 = m_Operand1->Evaluate(frame);
*parent = operand1.GetValue();
if (dhint && psdhint)
*dhint = new DebugHint(psdhint->GetChild(*index));
- delete psdhint;
+ if (free_psd)
+ delete psdhint;
return true;
}
inline void AddMessage(const String& message, const DebugInfo& di)
{
- if (!m_Hints)
- m_Hints = new Dictionary();
-
- if (!m_Messages) {
- m_Messages = new Array();
- m_Hints->Set("messages", m_Messages);
- }
-
Array::Ptr amsg = new Array();
amsg->Add(message);
amsg->Add(di.Path);
amsg->Add(di.FirstColumn);
amsg->Add(di.LastLine);
amsg->Add(di.LastColumn);
- m_Messages->Add(amsg);
+ GetMessages()->Add(amsg);
}
inline DebugHint GetChild(const String& name)
{
- if (!m_Hints)
- m_Hints = new Dictionary();
+ Dictionary::Ptr children = GetChildren();
- if (!m_Children) {
- m_Children = new Dictionary;
- m_Hints->Set("properties", m_Children);
- }
-
- Dictionary::Ptr child = m_Children->Get(name);
+ Dictionary::Ptr child = children->Get(name);
if (!child) {
child = new Dictionary();
- m_Children->Set(name, child);
+ children->Set(name, child);
}
return DebugHint(child);
private:
Dictionary::Ptr m_Hints;
- Array::Ptr m_Messages;
- Dictionary::Ptr m_Children;
+
+ Array::Ptr GetMessages(void)
+ {
+ if (!m_Hints)
+ m_Hints = new Dictionary();
+
+ Array::Ptr messages = m_Hints->Get("messages");
+
+ if (!messages) {
+ messages = new Array();
+ m_Hints->Set("messages", messages);
+ }
+
+ return messages;
+ }
+
+ Dictionary::Ptr GetChildren(void)
+ {
+ if (!m_Hints)
+ m_Hints = new Dictionary();
+
+ Dictionary::Ptr children = m_Hints->Get("properties");
+
+ if (!children) {
+ children = new Dictionary;
+ m_Hints->Set("properties", children);
+ }
+
+ return children;
+ }
};
enum CombinedSetOp