error when dropping negative characters

This commit is contained in:
2024-12-12 14:14:52 -06:00
parent a54a5a0e15
commit 4ddf68e3db

View File

@@ -123,6 +123,9 @@ class Stream {
/** Every drop call should end up calling dropChars() or the position tracker and recording will be wrong. **/
public function dropChars(count:Int, taking:Bool) {
if (count < 0) {
error(this, "Can't drop negative characters");
}
for (idx in 0...count) {
switch (content.charAt(idx)) {
// newline