From 3a7d53f3cfa81fc8df3cd61c9adf0ce6c28ecd30 Mon Sep 17 00:00:00 2001 From: Anthony Van de Gejuchte Date: Thu, 23 Jun 2016 16:53:48 +0200 Subject: Move OctalEscapeSequence to read_escape_char This should simplify and improve implementation, make it easier to implement template strings, and keep master a bit more in sync with harmony. Previous implementation wasn't broken, though the loop gave me the impression it could read infinite numbers and annoyed me a bit. It was also slightly unnecessary because the lookup involved only 3 characters. --- test/compress/string-literal.js | 10 ++++++++++ test/mocha/string-literal.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/compress/string-literal.js (limited to 'test') diff --git a/test/compress/string-literal.js b/test/compress/string-literal.js new file mode 100644 index 00000000..8b93961c --- /dev/null +++ b/test/compress/string-literal.js @@ -0,0 +1,10 @@ +octal_escape_sequence: { + input: { + var boundaries = "\0\7\00\07\70\77\000\077\300\377"; + var border_check = "\400\700\0000\3000"; + } + expect: { + var boundaries = "\x00\x07\x00\x07\x38\x3f\x00\x3f\xc0\xff"; + var border_check = "\x20\x30\x38\x30\x00\x30\xc0\x30"; + } +} diff --git a/test/mocha/string-literal.js b/test/mocha/string-literal.js index ea984213..d427472f 100644 --- a/test/mocha/string-literal.js +++ b/test/mocha/string-literal.js @@ -49,7 +49,7 @@ describe("String literals", function() { var error = function(e) { return e instanceof UglifyJS.JS_Parse_Error && - e.message === "Octal literals are not allowed in strict mode"; + e.message === "SyntaxError: Octal literals are not allowed in strict mode"; } for (var input in inputs) { -- cgit v1.2.3