[Pkg-javascript-commits] [node-lexical-scope] 76/83: documented new implicit properties
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:45:53 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 4978381c3c56c0afd556e49f67d9afcf47cc5a3b
Author: James Halliday <mail at substack.net>
Date: Fri Sep 18 12:21:25 2015 -0700
documented new implicit properties
---
example/detect.js | 2 +-
readme.markdown | 67 +++++++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 59 insertions(+), 10 deletions(-)
diff --git a/example/detect.js b/example/detect.js
index 7b98e48..1ad4d51 100644
--- a/example/detect.js
+++ b/example/detect.js
@@ -3,4 +3,4 @@ var fs = require('fs');
var src = fs.readFileSync(__dirname + '/src.js');
var scope = detect(src);
-console.dir(scope);
+console.log(JSON.stringify(scope,null,2));
diff --git a/readme.markdown b/readme.markdown
index 258bdb8..d57c6b3 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -14,7 +14,7 @@ var fs = require('fs');
var src = fs.readFileSync(__dirname + '/src.js');
var scope = detect(src);
-console.dir(scope);
+console.log(JSON.stringify(scope,null,2));
```
input:
@@ -53,14 +53,56 @@ output:
```
$ node example/detect.js
-{ locals:
- { '': [ 'x', 'y', 'z' ],
- 'body.7.arguments.0': [ 'BAR', 'doom' ],
- 'body.7.arguments.0.body.1.arguments.0': [ 'xyz' ],
- 'body.7.arguments.0.body.2': [] },
- globals:
- { implicit: [ 'w', 'foo', 'process', 'console', 'xyz' ],
- exported: [ 'w', 'RAWR', 'BLARG', 'ZZZ' ] } }
+{
+ "locals": {
+ "": [
+ "x",
+ "y",
+ "z"
+ ],
+ "body.7.expression.body.7.arguments.0": [
+ "BAR",
+ "doom"
+ ],
+ "body.7.expression.body.7.arguments.0.body.body.1.expression.body.1.arguments.0": [
+ "xyz",
+ "ZZZZZZZZZZZZ"
+ ],
+ "body.7.expression.body.7.arguments.0.body.body.2": []
+ },
+ "globals": {
+ "implicit": [
+ "w",
+ "foo",
+ "process",
+ "console",
+ "xyz"
+ ],
+ "implicitProperties": {
+ "w": [
+ "foo"
+ ],
+ "foo": [
+ "()"
+ ],
+ "process": [
+ "nextTick"
+ ],
+ "console": [
+ "log"
+ ],
+ "xyz": [
+ "*"
+ ]
+ },
+ "exported": [
+ "w",
+ "RAWR",
+ "BLARG",
+ "ZZZ"
+ ]
+ }
+}
```
# live demo
@@ -86,6 +128,13 @@ already exist in the environment by the script.
`scope.globals.explicit` contains the global variable names that are exported by
the script.
+`scope.globals.implicitProperties` contains the properties of global variable
+names that have been used. There are two special implicit property names:
+
+* `"()"` - when an implicit variable has been called
+* `"*"` - when an implicit variable has been used in a context that is not a
+property and not a call
+
# install
With [npm](https://npmjs.org) do:
--
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