Created
March 20, 2016 17:24
-
-
Save juanpicado/a17bdb5da0c83ef9f0b6 to your computer and use it in GitHub Desktop.
Esprima and Escope
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var escope = require('escope'); | |
var esprima = require('esprima'); | |
var estraverse = require('estraverse'); | |
var code = require('./ast'); | |
var ast = code.esprimaAST(); | |
var scopeManager = escope.analyze(ast); | |
var scopes = scopeManager.scopes; | |
// return an array of scopes, in our example we have 2, the global and inside of the function | |
var currentScope = scopeManager.acquire(ast); | |
// return the global scope, the current one |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment