##Description
The CodeGen.codeGen function takes a Script object and generates the ECMAScript string representation of it.
The generated program generally parses into a Script object that is identical to the original one with two exceptions:
- if the
Scriptobject cannot passValidatortest, the behavior of code generation is undefined. - if there is an
IfStatementwithoutalternate-clause who is directly followed by analternate-clause of anIfStatement, theconsequent-clause of the latterIfStatementis wrapped by aBlockStatement, resulting in a slightly different parse tree.
import com.shapesecurity.shift.parser.Parser;
import com.shapesecurity.shift.codegen.CodeGen;
String js = "a; b;";
Script p = Parser.parse(js);
String jsPrime = CodeGen.codeGen(p);