Bug 819509 - Make the tokenizer record if it sees an octal escape. r=njn
authorBenjamin Peterson <benjamin@python.org>
Wed, 12 Dec 2012 01:34:35 -0500
changeset 115800 d2c8c4d0e9c82e84c897fef80363ce3dc5f7179b
parent 115799 135f6317a5d122e35b570fadba9e2258305f8eed
child 115801 72f55526999afd5ff463b70d23f867c13e607b48
push id24028
push useremorley@mozilla.com
push dateThu, 13 Dec 2012 15:56:02 +0000
treeherderautoland@9db79b97abbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs819509
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 819509 - Make the tokenizer record if it sees an octal escape. r=njn
js/src/frontend/TokenStream.cpp
js/src/frontend/TokenStream.h
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -1688,16 +1688,17 @@ TokenStream::getTokenInternal()
                         if ('0' <= c && c < '8') {
                             int32_t val = JS7_UNDEC(c);
 
                             c = peekChar();
                             /* Strict mode code allows only \0, then a non-digit. */
                             if (val != 0 || JS7_ISDEC(c)) {
                                 if (!reportStrictModeError(JSMSG_DEPRECATED_OCTAL))
                                     goto error;
+                                flags |= TSF_OCTAL_CHAR;
                             }
                             if ('0' <= c && c < '8') {
                                 val = 8 * val + JS7_UNDEC(c);
                                 getChar();
                                 c = peekChar();
                                 if ('0' <= c && c < '8') {
                                     int32_t save = val;
                                     val = 8 * val + JS7_UNDEC(c);
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -569,16 +569,17 @@ class TokenStream
     StrictMode strictModeState() const
     {
         return strictModeGetter ? strictModeGetter->get() : StrictMode(StrictMode::NOTSTRICT);
     }
     bool isXMLTagMode() const { return !!(flags & TSF_XMLTAGMODE); }
     bool isXMLOnlyMode() const { return !!(flags & TSF_XMLONLYMODE); }
     bool isUnexpectedEOF() const { return !!(flags & TSF_UNEXPECTED_EOF); }
     bool isEOF() const { return !!(flags & TSF_EOF); }
+    bool sawOctalEscape() const { return !!(flags & TSF_OCTAL_CHAR); }
 
     // TokenStream-specific error reporters.
     bool reportError(unsigned errorNumber, ...);
     bool reportWarning(unsigned errorNumber, ...);
     bool reportStrictWarning(unsigned errorNumber, ...);
     bool reportStrictModeError(unsigned errorNumber, ...);
 
     // General-purpose error reporters.  You should avoid calling these