Last active
November 30, 2017 16:23
-
-
Save icefapper/a76b47a236c7cdd478d776342fe088d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var src = 'var a, b, l = {a, [b]: {l}} = ({A}=a) => a = ({B=b}) => b = ({L=l}=40) => l'; | |
// parse it | |
var syntaxNode = new Parser(src).parseProgram(); | |
// transform what was parsed | |
var transformer = new Transformer(); | |
transformer.renamer = renamer_minify; | |
var transformedNode = transformer.tr(syntaxNode, false); | |
// emit what was transformed | |
var emitter = new Emitter(); | |
emitter.allow.space = false; | |
emitter.allow.nl = false; | |
emitter.allow.comments.l = false; | |
emitter.allow.comments.m = false; | |
emitter.startFreshLine() | |
emitter.emitStmt(transformedNode); | |
emitter.flushCurrentLine(); // flush whatever output that is still pending | |
// the compiled code: | |
console.log(emitter.out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment