Legacy octal integer strict mode fixes

This commit is contained in:
Anthony Van de Gejuchte
2016-07-21 03:19:24 +02:00
parent e8b23c7798
commit 642273c290
3 changed files with 29 additions and 2 deletions

View File

@@ -349,6 +349,9 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
return is_alphanumeric_char(code);
});
if (prefix) num = prefix + num;
if (RE_OCT_NUMBER.test(num) && next_token.has_directive("use strict")) {
parse_error("SyntaxError: Legacy octal literals are not allowed in strict mode");
}
var valid = parse_js_number(num);
if (!isNaN(valid)) {
return token("num", valid);
@@ -392,7 +395,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
// Parse
if (ch === "0") return "\0";
if (ch.length > 0 && next_token.has_directive("use strict"))
parse_error("SyntaxError: Octal literals are not allowed in strict mode");
parse_error("SyntaxError: Legacy octal escape sequences are not allowed in strict mode");
return String.fromCharCode(parseInt(ch, 8));
}