example/generic-identity
raw| 1 | #!/usr/bin/env node |
| 2 | |
| 3 | // This script should reprint the contents of the given file without |
| 4 | // reusing the original source, but with identical AST structure. |
| 5 | |
| 6 | var recast = require("recast"); |
| 7 | |
| 8 | recast.run(function(ast, callback) { |
| 9 | recast.visit(ast, { |
| 10 | visitNode: function(path) { |
| 11 | this.traverse(path); |
| 12 | path.node.original = null; |
| 13 | } |
| 14 | }); |
| 15 | |
| 16 | callback(ast); |
| 17 | }); |