Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 4 files changed
  • 0 comments
  • 1 contributor
4 index.js
@@ -42,7 +42,9 @@ module.exports = function (src) {
42 42 var isLeft0 = node.parent.left.type === 'MemberExpression'
43 43 && node.parent.left.object === node.name
44 44 ;
45   - var isLeft1 = node.parent.left.type === 'Identifier';
  45 + var isLeft1 = node.parent.left.type === 'Identifier'
  46 + && node.parent.left.name === node.name
  47 + ;
46 48 if (isLeft0 || isLeft1) {
47 49 exported[node.name] = keyOf(node).length;
48 50 }
2  package.json
... ... @@ -1,6 +1,6 @@
1 1 {
2 2 "name": "lexical-scope",
3   - "version": "0.0.9",
  3 + "version": "0.0.10",
4 4 "description": "detect global and local lexical identifiers from javascript source code",
5 5 "main": "index.js",
6 6 "dependencies": {
13 test/assign_implicit.js
... ... @@ -0,0 +1,13 @@
  1 +var test = require('tape');
  2 +var detect = require('../');
  3 +var fs = require('fs');
  4 +var src = fs.readFileSync(__dirname + '/files/assign_implicit.js');
  5 +
  6 +test('assign from an implicit global', function (t) {
  7 + t.plan(3);
  8 +
  9 + var scope = detect(src);
  10 + t.same(scope.globals.implicit, [ 'bar' ]);
  11 + t.same(scope.globals.exported, []);
  12 + t.same(scope.locals, { '': [ 'foo' ] });
  13 +});
2  test/files/assign_implicit.js
... ... @@ -0,0 +1,2 @@
  1 +var foo;
  2 +foo = bar;

No commit comments for this range

Something went wrong with that request. Please try again.