[Pkg-javascript-commits] [uglifyjs] 400/491: enhance `unsafe_proto` (#2733)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:51:57 UTC 2018
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.
commit 3505a3604a682138512a7e03964fb68c861b5cbd
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Sat Jan 6 06:16:51 2018 +0800
enhance `unsafe_proto` (#2733)
---
lib/compress.js | 16 ++++++++++++++++
test/compress/properties.js | 6 ++++++
2 files changed, 22 insertions(+)
diff --git a/lib/compress.js b/lib/compress.js
index 7f33b53..0f15eb7 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -5484,11 +5484,27 @@ merge(Compressor.prototype, {
elements: []
});
break;
+ case "Function":
+ self.expression = make_node(AST_Function, self.expression, {
+ argnames: [],
+ body: []
+ });
+ break;
+ case "Number":
+ self.expression = make_node(AST_Number, self.expression, {
+ value: 0
+ });
+ break;
case "Object":
self.expression = make_node(AST_Object, self.expression, {
properties: []
});
break;
+ case "RegExp":
+ self.expression = make_node(AST_RegExp, self.expression, {
+ value: /t/
+ });
+ break;
case "String":
self.expression = make_node(AST_String, self.expression, {
value: ""
diff --git a/test/compress/properties.js b/test/compress/properties.js
index 16374ef..b2ce5f6 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -567,12 +567,18 @@ native_prototype: {
}
input: {
Array.prototype.splice.apply(a, [1, 2, b, c]);
+ Function.prototype.call.apply(console.log, console, [ "foo" ]);
+ Number.prototype.toFixed.call(Math.PI, 2);
Object.prototype.hasOwnProperty.call(d, "foo");
+ RegExp.prototype.test.call(/foo/, "bar");
String.prototype.indexOf.call(e, "bar");
}
expect: {
[].splice.apply(a, [1, 2, b, c]);
+ (function() {}).call.apply(console.log, console, [ "foo" ]);
+ 0..toFixed.call(Math.PI, 2);
({}).hasOwnProperty.call(d, "foo");
+ /t/.test.call(/foo/, "bar");
"".indexOf.call(e, "bar");
}
}
--
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