summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/example/generic-identity
blob: a8364c350dc734191948e189e2d4cce1d4e580cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env node

// This script should reprint the contents of the given file without
// reusing the original source, but with identical AST structure.

var recast = require("recast");

recast.run(function(ast, callback) {
    recast.visit(ast, {
        visitNode: function(path) {
            this.traverse(path);
            path.node.original = null;
        }
    });

    callback(ast);
});