[Pkg-javascript-commits] [uglifyjs] 42/190: Fix other operator output related to <!-- or -->
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun Aug 7 23:17:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to annotated tag upstream/2.7.0
in repository uglifyjs.
commit dff54a6552c4d6764c85ac3c11c545ad3909f997
Author: kzc <zaxxon2011 at gmail.com>
Date: Tue Oct 13 01:17:10 2015 -0400
Fix other operator output related to <!-- or -->
---
lib/output.js | 7 ++---
test/compress/html_comments.js | 60 ++++++++++++++++++++++++++++++++++++++++--
2 files changed, 62 insertions(+), 5 deletions(-)
diff --git a/lib/output.js b/lib/output.js
index 1bde822..a3b8f1a 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -1048,8 +1048,9 @@ function OutputStream(options) {
output.print(self.operator);
});
DEFPRINT(AST_Binary, function(self, output){
+ var op = self.operator;
self.left.print(output);
- if (self.operator == ">"
+ if (op[0] == ">" /* ">>" ">>>" ">" ">=" */
&& self.left instanceof AST_UnaryPostfix
&& self.left.operator == "--") {
// space is mandatory to avoid outputting -->
@@ -1058,8 +1059,8 @@ function OutputStream(options) {
// the space is optional depending on "beautify"
output.space();
}
- output.print(self.operator);
- if (self.operator == "<"
+ output.print(op);
+ if ((op == "<" || op == "<<")
&& self.right instanceof AST_UnaryPrefix
&& self.right.operator == "!"
&& self.right.expression instanceof AST_UnaryPrefix
diff --git a/test/compress/html_comments.js b/test/compress/html_comments.js
index 6141980..8495b43 100644
--- a/test/compress/html_comments.js
+++ b/test/compress/html_comments.js
@@ -5,11 +5,67 @@ html_comment_in_expression: {
expect_exact: "function f(a,b,x,y){return a< !--b&&x-- >y}";
}
+html_comment_in_less_than: {
+ input: {
+ function f(a, b) { return a < !--b; }
+ }
+ expect_exact: "function f(a,b){return a< !--b}";
+}
+
+html_comment_in_left_shift: {
+ input: {
+ function f(a, b) { return a << !--b; }
+ }
+ expect_exact: "function f(a,b){return a<< !--b}";
+}
+
+html_comment_in_right_shift: {
+ input: {
+ function f(a, b) { return a-- >> b; }
+ }
+ expect_exact: "function f(a,b){return a-- >>b}";
+}
+
+html_comment_in_zero_fill_right_shift: {
+ input: {
+ function f(a, b) { return a-- >>> b; }
+ }
+ expect_exact: "function f(a,b){return a-- >>>b}";
+}
+
+html_comment_in_greater_than: {
+ input: {
+ function f(a, b) { return a-- > b; }
+ }
+ expect_exact: "function f(a,b){return a-- >b}";
+}
+
+html_comment_in_greater_than_or_equal: {
+ input: {
+ function f(a, b) { return a-- >= b; }
+ }
+ expect_exact: "function f(a,b){return a-- >=b}";
+}
+
+html_comment_in_right_shift_assign: {
+ input: {
+ // Note: illegal javascript
+ function f(a, b) { return a-- >>= b; }
+ }
+ expect_exact: "function f(a,b){return a-- >>=b}";
+}
+
+html_comment_in_zero_fill_right_shift_assign: {
+ input: {
+ // Note: illegal javascript
+ function f(a, b) { return a-- >>>= b; }
+ }
+ expect_exact: "function f(a,b){return a-- >>>=b}";
+}
+
html_comment_in_string_literal: {
input: {
function f() { return "<!--HTML-->comment in<!--string literal-->"; }
}
expect_exact: 'function f(){return"\\x3c!--HTML--\\x3ecomment in\\x3c!--string literal--\\x3e"}';
}
-
-
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list