- all symbols now have a `thedef` property which is a SymbolDef object, instead of the `uniq` that we had before (pointing to the first occurrence of the name as declaration). - for undeclared symbols we still create a SymbolDef object in the toplevel scope but mark it "undeclared" - we can now call figure_out_scope after squeezing, which is useful in order not to mangle names that were dropped by the squeezer
24 lines
502 B
JavaScript
Executable File
24 lines
502 B
JavaScript
Executable File
#! /usr/bin/env node
|
|
|
|
var sys = require("util");
|
|
var fs = require("fs");
|
|
|
|
var UglifyJS = require("../tools/node");
|
|
|
|
var filename = process.argv[2];
|
|
var code = fs.readFileSync(filename, "utf8");
|
|
|
|
var ast = UglifyJS.parse(code);
|
|
ast.figure_out_scope();
|
|
ast = ast.squeeze(UglifyJS.Compressor());
|
|
|
|
ast.compute_char_frequency();
|
|
UglifyJS.base54.sort();
|
|
|
|
ast.figure_out_scope();
|
|
ast.scope_warnings();
|
|
ast.mangle_names();
|
|
|
|
sys.error(UglifyJS.base54.get());
|
|
sys.print(ast.print_to_string({ beautify: true }));
|