[Pkg-javascript-commits] [node-lexical-scope] 02/83: function declarations now treated as locals

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:45:45 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 032fd27dd79edda062ca75d1d85462a5385c4ddb
Author: James Halliday <mail at substack.net>
Date:   Sun Feb 17 14:13:41 2013 +1000

    function declarations now treated as locals
---
 example/src.js | 3 +++
 index.js       | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/example/src.js b/example/src.js
index 03e13c2..df1213d 100644
--- a/example/src.js
+++ b/example/src.js
@@ -10,6 +10,9 @@ foo(function () {
         x += 10;
         x.zzzzzz;
     });
+    function doom () {
+    }
+
 });
 
 console.log(xyz);
diff --git a/index.js b/index.js
index 2394598..a574e31 100644
--- a/index.js
+++ b/index.js
@@ -12,6 +12,10 @@ module.exports = function (src) {
                 locals[id][d.id.name] = d;
             });
         }
+        else if (node.type === 'FunctionDeclaration') {
+            var id = getScope(node.parent);
+            locals[id][node.id.name] = node;
+        }
     });
     
     return { locals: locals, globals: globals };

-- 
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