[Pkg-mozext-commits] [tabmixplus] 09/56: Follow up bug 1255925 - Give a name to getters/setters and integer-named methods
David Prévot
taffit at moszumanska.debian.org
Mon Jun 6 00:02:32 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 33d25476edc1f815d3335060ee6f7c3fb2b4b80f
Author: onemen <tabmix.onemen at gmail.com>
Date: Thu Apr 28 16:25:29 2016 +0300
Follow up bug 1255925 - Give a name to getters/setters and integer-named methods
---
chrome/content/changecode.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/chrome/content/changecode.js b/chrome/content/changecode.js
index 20a54a7..aa463bd 100644
--- a/chrome/content/changecode.js
+++ b/chrome/content/changecode.js
@@ -106,16 +106,24 @@ Tabmix.changeCode = function(aParent, afnName, aOptions) {
let [obj, fnName] = [aObj || this.obj, aName || this.fnName];
let descriptor = {enumerable: true, configurable: true};
+ let removeSpaces = function(match, p1, p2) {
+ return p1 + p2.replace(/\s/g, '_');
+ };
+
let setDescriptor = function(type) {
let fnType = "__lookup#ter__".replace("#", type);
type = type.toLowerCase();
let code = aCode && aCode[type + "ter"] ||
this.type == fnType ? this.value : obj[fnType](fnName);
- if (typeof code == "string")
+ if (typeof code == "string") {
+ // bug 1255925 - Give a name to getters/setters add space before the function name
+ // replace function get Foo() to function get_Foo()
+ code = code.replace(/(^function\s*)(.*\()/, removeSpaces);
descriptor[type] = Tabmix._makeCode(null, code);
- else if (typeof code != "undefined")
+ } else if (typeof code != "undefined") {
descriptor[type] = code;
+ }
}.bind(this);
setDescriptor("Get");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list