Skip to content

Commit

Permalink
dustmite: Add some assertions
Browse files Browse the repository at this point in the history
Catch bugs in splitters.
  • Loading branch information
CyberShadow committed May 2, 2023
1 parent ee1ec01 commit 5b65ade
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dustmite.d
Original file line number Diff line number Diff line change
Expand Up @@ -2633,6 +2633,7 @@ void applyNoRemoveRules(Entity root, RemoveRule[] removeRules)
return true;
auto start = s.ptr - f.contents.ptr;
auto end = start + s.length;
assert(start <= end && end <= f.contents.length, "String is not a slice of the file");
return removeChar[start .. end].all;
}

Expand Down Expand Up @@ -2766,7 +2767,8 @@ void convertRefs(Entity root)
void convertRef(ref EntityRef r)
{
assert(r.entity && !r.address);
r.address = addresses[r.entity.id];
r.address = addresses.get(r.entity.id, null);
assert(r.address, "Dependent not in tree");
r.entity = null;
}

Expand Down

0 comments on commit 5b65ade

Please sign in to comment.