[Pkg-javascript-commits] [node-lexical-scope] 46/83: Fix multiple functions assigned as rhs of expressions
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:45:50 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-lexical-scope.
commit a4432f5800bd30e2128d64ebc637f9b58d075e04
Author: ForbesLindesay <forbes at lindesay.co.uk>
Date: Fri May 31 11:48:56 2013 +0100
Fix multiple functions assigned as rhs of expressions
closes #13
---
index.js | 7 +------
test/argument.js | 2 +-
test/named_arg.js | 2 +-
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/index.js b/index.js
index ae5dbe0..7ee7798 100644
--- a/index.js
+++ b/index.js
@@ -89,11 +89,7 @@ module.exports = function (src) {
!isFunction(p) && p.type !== 'Program';
p = p.parent
);
- var id = idOf(node);
- if (node.type === 'VariableDeclaration') {
- // the var gets stripped off so the id needs updated
- id = id.replace(/\.init$/, '.right');
- }
+ var id = idOf(p);
if (!locals[id]) locals[id] = {};
return id;
}
@@ -109,7 +105,6 @@ function isFunction (x) {
function idOf (node) {
var id = [];
for (var n = node; n.type !== 'Program'; n = n.parent) {
- if (!isFunction(n)) continue;
var key = keyOf(n).join('.');
id.unshift(key);
}
diff --git a/test/argument.js b/test/argument.js
index 3ba102d..ddfd549 100644
--- a/test/argument.js
+++ b/test/argument.js
@@ -12,6 +12,6 @@ test('parameters from inline arguments', function (t) {
t.same(scope.locals, {
'body.0': [ 'a' ],
'': [ 'foo' ],
- 'body.0.argument': [ 'c' ]
+ 'body.0.body.body.1.argument': [ 'c' ]
});
});
diff --git a/test/named_arg.js b/test/named_arg.js
index d1d47b0..421d711 100644
--- a/test/named_arg.js
+++ b/test/named_arg.js
@@ -12,6 +12,6 @@ test('named argument parameter', function (t) {
t.same(scope.locals, {
'body.0': [ 'a', 'x' ],
'': [ 'foo' ],
- 'body.0.argument': [ 'c' ]
+ 'body.0.body.body.1.argument': [ 'c' ]
});
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-lexical-scope.git
More information about the Pkg-javascript-commits
mailing list