* </pre>
*/
SourceInfo sourceInfo = program.createSourceInfoSynthetic(
GenerateJavaScriptAST.class, "gwtOnLoad");
JsName entryName = topScope.findExistingName("$entry");
entryName.setObfuscatable(true);
JsVar entryVar = new JsVar(sourceInfo, entryName);
JsInvocation registerEntryCall = new JsInvocation(sourceInfo);
JsFunction registerEntryFunction = indexedFunctions.get("Impl.registerEntry");
registerEntryCall.setQualifier(registerEntryFunction.getName().makeRef(
sourceInfo));
entryVar.setInitExpr(registerEntryCall);
JsVars entryVars = new JsVars(sourceInfo);
entryVars.add(entryVar);
globalStmts.add(entryVars);
JsName gwtOnLoadName = topScope.declareName("gwtOnLoad");
gwtOnLoadName.setObfuscatable(false);
JsFunction gwtOnLoad = new JsFunction(sourceInfo, topScope,
gwtOnLoadName, true);
globalStmts.add(gwtOnLoad.makeStmt());
JsBlock body = new JsBlock(sourceInfo);
gwtOnLoad.setBody(body);
JsScope fnScope = gwtOnLoad.getScope();
List<JsParameter> params = gwtOnLoad.getParameters();
JsName errFn = fnScope.declareName("errFn");
JsName modName = fnScope.declareName("modName");
JsName modBase = fnScope.declareName("modBase");
params.add(new JsParameter(sourceInfo, errFn));
params.add(new JsParameter(sourceInfo, modName));
params.add(new JsParameter(sourceInfo, modBase));
JsExpression asg = createAssignment(
topScope.findExistingUnobfuscatableName("$moduleName").makeRef(
sourceInfo), modName.makeRef(sourceInfo));
body.getStatements().add(asg.makeStmt());
asg = createAssignment(topScope.findExistingUnobfuscatableName(
"$moduleBase").makeRef(sourceInfo), modBase.makeRef(sourceInfo));
body.getStatements().add(asg.makeStmt());
JsIf jsIf = new JsIf(sourceInfo);
body.getStatements().add(jsIf);
jsIf.setIfExpr(errFn.makeRef(sourceInfo));
JsTry jsTry = new JsTry(sourceInfo);