com.shapesecurity.shift.scope.README.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shift Show documentation
Show all versions of shift Show documentation
Shift format ECMAScript 6 AST tooling
Shift AST Scope Analyzer
===============================
## Description
The `ScopeAnalyzer` class collects variable scoping information into a scope tree.
## Usage
```
import com.shapesecurity.shift.parser.Parser;
import com.shapesecurity.shift.ast.Program;
import com.shapesecurity.shift.scope.ScopeAnalyzer;
import com.shapesecurity.shift.scope.GlobalScope;
String source = "a; b;";
Script program = Parser.parse(source);
GlobalScope global = ScopeAnalyzer.analyze(program);
// look at the top-level variables
// list the implicit globals (global throughs)
```