Treehugger.js playground
Javascript
AST
var a = 10, b; console.log(a, b, c);
Analysis code
Run
Output
var declared = {console: true}; ast.traverseTopDown( 'VarDecl(x)', function(b) { declared[b.x.value] = true; }, 'VarDeclInit(x, _)', function(b) { declared[b.x.value] = true; }, 'Var(x)', function(b) { if(!declared[b.x.value]) log("Variable " + b.x.value + " is not declared."); } );