Open CMatias opened 8 years ago
You may consider traverse all scopes recursively, starting from globalScope:
var ast = esprima.parse(code, {
loc : true
});
var globalScope = dfatool.newGlobalScope();
dfatool.buildScope(ast, globalScope);
globalScope.initialize();
globalScope.derivation()
... ...
function traverse(scope)
{
//do something with 'scope'
for(var i=0;i<scope.children.length;i++)
traverse(scope.children[i]);
}
traverse(globalScope);
There's a reference in the readme to "get a variable on a specific scope". However, in the code example there's not an example on how to traverse the scope, only a reference to function calls.