From aa2decd154dbbd17e0eac9c570841eb445c63a3f Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 8 Jun 2019 15:55:51 -0400 Subject: 1326454 - Add assertions to TokenStream::skipChars{,IgnoreEOL} verifying EOF isn't yet hit and that newlines aren't skipped, if appropriate. --- js/src/frontend/TokenStream.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'js/src') diff --git a/js/src/frontend/TokenStream.h b/js/src/frontend/TokenStream.h index a058759c6..4efc31446 100644 --- a/js/src/frontend/TokenStream.h +++ b/js/src/frontend/TokenStream.h @@ -997,13 +997,18 @@ class MOZ_STACK_CLASS TokenStream } void skipChars(uint8_t n) { - while (n-- > 0) - getChar(); + while (n-- > 0) { + MOZ_ASSERT(userbuf.hasRawChars()); + mozilla::DebugOnly c = getCharIgnoreEOL(); + MOZ_ASSERT(c != '\n'); + } } void skipCharsIgnoreEOL(uint8_t n) { - while (n-- > 0) + while (n-- > 0) { + MOZ_ASSERT(userbuf.hasRawChars()); getCharIgnoreEOL(); + } } void updateLineInfoForEOL(); -- cgit v1.2.3