fix corner case in parsing directives (#3615)

This commit is contained in:
Alex Lam S.L
2019-11-29 18:57:29 +08:00
committed by GitHub
parent 1b61a81b5d
commit 1283d73853
5 changed files with 123 additions and 71 deletions

View File

@@ -2,10 +2,18 @@ var assert = require("assert");
var UglifyJS = require("../node");
describe("Number literals", function() {
it("Should allow legacy octal literals in non-strict mode", function() {
[
"'use strict'\n.slice()\n00",
'"use strict"\n.slice()\nvar foo = 00',
].forEach(function(input) {
UglifyJS.parse(input);
});
});
it("Should not allow legacy octal literals in strict mode", function() {
var inputs = [
'"use strict";00;',
'"use strict"; var foo = 00;'
'"use strict"; var foo = 00;',
];
var test = function(input) {
return function() {