12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- var _ = require('lodash');
- // perhaps a switch to print out stuff based on some sort of 'xpath' for function scopes
- // perhaps an interactive scope explorer
- module.exports = function(write) {
- var M = {
- scopes: function(scope, indent) {
- indent = indent || '';
- // console.log(scope);
- write(indent + 'Name: ' + scope.name);
- write(indent + 'Params: ' + _.pluck(scope.params, 'name').join(', '));
- write(indent + 'VarRef: ' + _.pluck(scope.varsRefd, 'name').join(', '));
- if(scope.fnDec.length) {
- write(indent + 'SubFns: ');
- scope.fnDec.map(function(s) {
- M.scopes(s, indent + ' ');
- });
- }
- write(indent);
-
- },
- }
-
-
-
- return M;
- }
|