[gjs/wip/ptomato/mozjs52: 39/40] WIP - coverage: Drop support for legacy comprehensions
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs52: 39/40] WIP - coverage: Drop support for legacy comprehensions
- Date: Sun, 11 Jun 2017 02:49:27 +0000 (UTC)
commit 2ad258c5cbef5ab2fdde7268477428f17494d64f
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Jun 4 16:09:15 2017 -0400
WIP - coverage: Drop support for legacy comprehensions
These are now considered syntax errors by SpiderMonkey, so there is no
point supporting code coverage inside them.
FIXME: There are still some comprehensions that are supported, figure out
how those are parsed by Reflect.parse().
installed-tests/js/testCoverage.js | 25 -------------------------
modules/coverage.js | 4 ----
2 files changed, 0 insertions(+), 29 deletions(-)
---
diff --git a/installed-tests/js/testCoverage.js b/installed-tests/js/testCoverage.js
index 6d2b926..4073af4 100644
--- a/installed-tests/js/testCoverage.js
+++ b/installed-tests/js/testCoverage.js
@@ -431,31 +431,6 @@ describe('Coverage.functionsForAST', function () {
{ key: "(anonymous):1:0", line: 1, n_params: 0 }
],
],
-
- 'finds functions in an array comprehension body': [
- "let a = new Array(1);\n" +
- "let b = [function() {} for (i of a)];\n",
- [
- { key: "(anonymous):2:0", line: 2, n_params: 0 }
- ],
- ],
-
- 'finds functions in an array comprehension block': [
- "let a = new Array(1);\n" +
- "let b = [i for (i of function() {})];\n",
- [
- { key: "(anonymous):2:0", line: 2, n_params: 0 }
- ],
- ],
-
- 'finds functions in an array comprehension filter': [
- "let a = new Array(1);\n" +
- "let b = [i for (i of a)" +
- "if (function() {}())];\n",
- [
- { key: "(anonymous):2:0", line: 2, n_params: 0 }
- ],
- ],
};
Object.keys(testTable).forEach(testcase => {
diff --git a/modules/coverage.js b/modules/coverage.js
index 0ed3407..6bc304e 100644
--- a/modules/coverage.js
+++ b/modules/coverage.js
@@ -103,16 +103,12 @@ function getSubNodesForNode(node) {
case 'UpdateExpression':
subNodes.push(node.argument);
break;
- case 'ComprehensionExpression':
case 'GeneratorExpression':
subNodes.push(node.body);
Array.prototype.push.apply(subNodes, node.blocks);
if (node.filter !== null)
subNodes.push(node.filter);
break;
- case 'ComprehensionBlock':
- subNodes.push(node.right);
- break;
/* It is very possible that there might be something
* interesting in the function arguments, so we need to
* walk them too */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]