this.program = program;
this.validate = validate;
}
public Node translate(JsProgramFragment fragment, InputId inputId, String source) {
Node script = IR.script();
script.putBooleanProp(Node.SYNTHETIC_BLOCK_PROP, true);
script.setInputId(inputId);
script.setStaticSourceFile(getClosureSourceFile(source));
for (JsStatement s : fragment.getGlobalBlock().getStatements()) {
script.addChildToBack(transform(s));
}
// Validate the structural integrity of the AST.
if (validate) {
new AstValidator().validateScript(script);
}