Skip to content

Commit

Permalink
22346: Fixes issue when changing an opcode's type to an assoc where k…
Browse files Browse the repository at this point in the history
…eys would be lost and turned into empty strings (#317)
  • Loading branch information
howsohazard authored Dec 2, 2024
1 parent 1a80945 commit b287deb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/Amalgam/evaluablenode/EvaluableNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,14 +660,11 @@ void EvaluableNode::SetType(EvaluableNodeType new_type, EvaluableNodeManager *en
new_ordered.reserve(2 * mcn.size());
for(auto &[cn_id, cn] : mcn)
{
//keep the reference from when it was an assoc
new_ordered.push_back(enm->AllocNodeWithReferenceHandoff(ENT_STRING, cn_id));
EvaluableNode *key = Parser::ParseFromKeyStringId(cn_id, enm);
new_ordered.push_back(key);
new_ordered.push_back(cn);
}

//clear the mapped nodes here, because don't want to free the references
// as they were handed off to the newly allocated ordered child nodes
mcn.clear();
InitOrderedChildNodes();
//swap for efficiency
swap(GetOrderedChildNodesReference(), new_ordered);
Expand Down
1 change: 0 additions & 1 deletion src/Amalgam/evaluablenode/EvaluableNodeTreeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ EvaluableNode *GetTraversalPathListFromAToB(EvaluableNodeManager *enm, Evaluable
&& b_ancestor != a //stop if it's the target
&& nodes_visited.insert(b_ancestor_parent).second == true) //make sure not visited yet
{

//find where the node matches
if(b_ancestor_parent->IsAssociativeArray())
{
Expand Down

0 comments on commit b287deb

Please sign in to comment.