You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2019/12/18 17:59:22 UTC
[couchdb-escodegen] reference refs/pull/285/head created (now
ec0729d)
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a change to reference refs/pull/285/head
in repository https://gitbox.apache.org/repos/asf/couchdb-escodegen.git.
at ec0729d re-added node 0.10 to testing, using object literal instead of set
This reference includes the following new commits:
new df9cd40 Fixed issue with duplicated comments
new 1064739 increased node version
new ec0729d re-added node 0.10 to testing, using object literal instead of set
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb-escodegen] 03/03: re-added node 0.10 to testing,
using object literal instead of set
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to reference refs/pull/285/head
in repository https://gitbox.apache.org/repos/asf/couchdb-escodegen.git
commit ec0729dafd0a6e57819425780c1a1720220fe742
Author: Magano <vi...@jscrambler.com>
AuthorDate: Fri Feb 5 18:20:10 2016 +0000
re-added node 0.10 to testing, using object literal instead of set
---
.travis.yml | 1 +
escodegen.js | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 44b24dd..9c8593d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,7 @@
sudo: false
language: node_js
node_js:
+ - "0.10"
- "0.12"
- iojs
- "4"
diff --git a/escodegen.js b/escodegen.js
index fe393e1..fabc2c0 100644
--- a/escodegen.js
+++ b/escodegen.js
@@ -664,7 +664,7 @@
return '/*' + comment.value + '*/';
}
- var rangesInTrailingComments = new Set();
+ var rangesInTrailingComments = {};
function addComments(stmt, result) {
var i, len, comment, save, tailingToStatement, specialBase, fragment,
@@ -681,7 +681,7 @@
} else {
commentRange = comment.range;
}
- return !rangesInTrailingComments.has(commentRange.join(','));
+ return rangesInTrailingComments[commentRange.join(',')] === undefined;
});
if (leadingComments.length > 0) {
@@ -755,7 +755,7 @@
} else {
commentRange = trailingComment.range;
}
- rangesInTrailingComments.add(commentRange.join(','));
+ rangesInTrailingComments[commentRange.join(',')] = true;
});
if (preserveBlankLines) {
[couchdb-escodegen] 02/03: increased node version
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to reference refs/pull/285/head
in repository https://gitbox.apache.org/repos/asf/couchdb-escodegen.git
commit 1064739eee7a685d0e32ee19b8de6af56f61e477
Author: Magano <vi...@jscrambler.com>
AuthorDate: Fri Feb 5 18:02:18 2016 +0000
increased node version
---
.travis.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 9c8593d..44b24dd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
sudo: false
language: node_js
node_js:
- - "0.10"
- "0.12"
- iojs
- "4"
[couchdb-escodegen] 01/03: Fixed issue with duplicated comments
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to reference refs/pull/285/head
in repository https://gitbox.apache.org/repos/asf/couchdb-escodegen.git
commit df9cd405594d05aaad5f8ea6c99cf5b81f8d886f
Author: Magano <vi...@jscrambler.com>
AuthorDate: Fri Feb 5 17:32:51 2016 +0000
Fixed issue with duplicated comments
---
escodegen.js | 120 ++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 73 insertions(+), 47 deletions(-)
diff --git a/escodegen.js b/escodegen.js
index 0360521..fe393e1 100644
--- a/escodegen.js
+++ b/escodegen.js
@@ -664,72 +664,99 @@
return '/*' + comment.value + '*/';
}
+ var rangesInTrailingComments = new Set();
+
function addComments(stmt, result) {
var i, len, comment, save, tailingToStatement, specialBase, fragment,
- extRange, range, prevRange, prefix, infix, suffix, count;
-
- if (stmt.leadingComments && stmt.leadingComments.length > 0) {
- save = result;
-
- if (preserveBlankLines) {
- comment = stmt.leadingComments[0];
- result = [];
+ extRange, range, prevRange, prefix, infix, suffix, count, leadingComments;
- extRange = comment.extendedRange;
- range = comment.range;
+ if (stmt.leadingComments) {
- prefix = sourceCode.substring(extRange[0], range[0]);
- count = (prefix.match(/\n/g) || []).length;
- if (count > 0) {
- result.push(stringRepeat('\n', count));
- result.push(addIndent(generateComment(comment)));
+ leadingComments = stmt.leadingComments.filter(function (comment) {
+ var commentRange;
+ if (typeof comment.range === 'object') {
+ commentRange = Object.keys(comment.range).map(function (key) {
+ return comment.range[key];
+ });
} else {
- result.push(prefix);
- result.push(generateComment(comment));
+ commentRange = comment.range;
}
+ return !rangesInTrailingComments.has(commentRange.join(','));
+ });
+
+ if (leadingComments.length > 0) {
+ save = result;
- prevRange = range;
+ if (preserveBlankLines) {
+ comment = leadingComments[0];
+ result = [];
- for (i = 1, len = stmt.leadingComments.length; i < len; i++) {
- comment = stmt.leadingComments[i];
+ extRange = comment.extendedRange;
range = comment.range;
- infix = sourceCode.substring(prevRange[1], range[0]);
- count = (infix.match(/\n/g) || []).length;
- result.push(stringRepeat('\n', count));
- result.push(addIndent(generateComment(comment)));
+ prefix = sourceCode.substring(extRange[0], range[0]);
+ count = (prefix.match(/\n/g) || []).length;
+ if (count > 0) {
+ result.push(stringRepeat('\n', count));
+ result.push(addIndent(generateComment(comment)));
+ } else {
+ result.push(prefix);
+ result.push(generateComment(comment));
+ }
prevRange = range;
- }
- suffix = sourceCode.substring(range[1], extRange[1]);
- count = (suffix.match(/\n/g) || []).length;
- result.push(stringRepeat('\n', count));
- } else {
- comment = stmt.leadingComments[0];
- result = [];
- if (safeConcatenation && stmt.type === Syntax.Program && stmt.body.length === 0) {
- result.push('\n');
- }
- result.push(generateComment(comment));
- if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) {
- result.push('\n');
- }
+ for (i = 1, len = leadingComments.length; i < len; i++) {
+ comment = leadingComments[i];
+ range = comment.range;
- for (i = 1, len = stmt.leadingComments.length; i < len; ++i) {
- comment = stmt.leadingComments[i];
- fragment = [generateComment(comment)];
- if (!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) {
- fragment.push('\n');
+ infix = sourceCode.substring(prevRange[1], range[0]);
+ count = (infix.match(/\n/g) || []).length;
+ result.push(stringRepeat('\n', count));
+ result.push(addIndent(generateComment(comment)));
+
+ prevRange = range;
+ }
+
+ suffix = sourceCode.substring(range[1], extRange[1]);
+ count = (suffix.match(/\n/g) || []).length;
+ result.push(stringRepeat('\n', count));
+ } else {
+ comment = leadingComments[0];
+ result = [];
+ if (safeConcatenation && stmt.type === Syntax.Program && stmt.body.length === 0) {
+ result.push('\n');
+ }
+ result.push(generateComment(comment));
+ if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) {
+ result.push('\n');
+ }
+
+ for (i = 1, len = leadingComments.length; i < len; ++i) {
+ comment = leadingComments[i];
+ fragment = [generateComment(comment)];
+ if (!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) {
+ fragment.push('\n');
+ }
+ result.push(addIndent(fragment));
}
- result.push(addIndent(fragment));
}
+ result.push(addIndent(save));
}
-
- result.push(addIndent(save));
}
if (stmt.trailingComments) {
+ stmt.trailingComments.forEach(function (trailingComment) {
+ var commentRange;
+ if (typeof trailingComment.range === 'object') {
+ commentRange = Object.keys(trailingComment.range).map(function (key) {
+ return trailingComment.range[key];
+ });
+ } else {
+ commentRange = trailingComment.range;
+ }
+ rangesInTrailingComments.add(commentRange.join(','));
+ });
if (preserveBlankLines) {
comment = stmt.trailingComments[0];
@@ -773,7 +800,6 @@
}
}
}
-
return result;
}