diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-08 15:55:51 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:18 -0400 |
commit | aa2decd154dbbd17e0eac9c570841eb445c63a3f (patch) | |
tree | 1987aa9609d0fa18a2927ed4e1bf079eaa7aa0c7 /js/src/frontend | |
parent | 0ed4cf321f276d88f80d13daf2644f9bc51b0957 (diff) | |
download | UXP-aa2decd154dbbd17e0eac9c570841eb445c63a3f.tar UXP-aa2decd154dbbd17e0eac9c570841eb445c63a3f.tar.gz UXP-aa2decd154dbbd17e0eac9c570841eb445c63a3f.tar.lz UXP-aa2decd154dbbd17e0eac9c570841eb445c63a3f.tar.xz UXP-aa2decd154dbbd17e0eac9c570841eb445c63a3f.zip |
1326454 - Add assertions to TokenStream::skipChars{,IgnoreEOL} verifying EOF isn't yet hit and that newlines aren't skipped, if appropriate.
Diffstat (limited to 'js/src/frontend')
-rw-r--r-- | js/src/frontend/TokenStream.h | 11 |
1 files changed, 8 insertions, 3 deletions
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<int32_t> c = getCharIgnoreEOL(); + MOZ_ASSERT(c != '\n'); + } } void skipCharsIgnoreEOL(uint8_t n) { - while (n-- > 0) + while (n-- > 0) { + MOZ_ASSERT(userbuf.hasRawChars()); getCharIgnoreEOL(); + } } void updateLineInfoForEOL(); |