ensure MD_Error node parent is filled out always; cleanup a few things

This commit is contained in:
ryanfleury
2021-06-29 22:40:07 -06:00
parent f73f643aed
commit 0dea16c4c1
3 changed files with 43 additions and 32 deletions
+7
View File
@@ -2032,6 +2032,13 @@ MD_ParseWholeString(MD_String8 filename, MD_String8 contents)
MD_Node *root = MD_MakeNode(MD_NodeKind_File, filename, contents, 0);
MD_ParseResult result = MD_ParseNodeSet(contents, 0, root, MD_ParseSetRule_Global);
result.node = result.last_node = root;
for(MD_Error *error = result.errors.first; error != 0; error = error->next)
{
if(MD_NodeIsNil(error->node->parent))
{
error->node->parent = root;
}
}
return result;
}