globalStmts.add(registerPropertyProvidersCall.makeStmt());
}
// var $entry = Impl.registerEntry();
JsName entryName = topScope.declareName("$entry");
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);
// Stub gwtOnLoad at top level so that HtmlUnit can find it.
// var gwtOnLoad = typeof gwtOnLoad === 'undefined' ? null : gwtOnLoad;
JsName gwtOnLoadName = topScope.declareName("gwtOnLoad");
gwtOnLoadName.setObfuscatable(false);
JsVar gwtOnLoadNameVar = new JsVar(sourceInfo, gwtOnLoadName);
gwtOnLoadNameVar.setInitExpr(new JsConditional(sourceInfo, new JsBinaryOperation(sourceInfo,
JsBinaryOperator.REF_EQ, new JsPrefixOperation(
sourceInfo, JsUnaryOperator.TYPEOF, gwtOnLoadName.makeRef(sourceInfo)),
new JsStringLiteral(sourceInfo, "undefined")), JsNullLiteral.INSTANCE,
gwtOnLoadName.makeRef(sourceInfo)));
JsVars gwtOnLoadNameVars = new JsVars(sourceInfo);
gwtOnLoadNameVars.add(gwtOnLoadNameVar);
globalStmts.add(gwtOnLoadNameVars);
// Create gwtOnLoad in function scope so the previousGwtOnLoad reference is preserved.
// (function() {
JsFunction createGwtOnLoadFunction = new JsFunction(sourceInfo, topScope);
JsBlock createGwtOnLoadBody = new JsBlock(sourceInfo);
createGwtOnLoadFunction.setBody(createGwtOnLoadBody);
// var previousGwtOnLoad = gwtOnLoad;
JsName previousGwtOnLoadName =
createGwtOnLoadFunction.getScope().declareName("previousGwtOnLoad");
JsVar previousGwtOnLoadNameVar = new JsVar(sourceInfo, previousGwtOnLoadName);
previousGwtOnLoadNameVar.setInitExpr(gwtOnLoadName.makeRef(sourceInfo));
JsVars previousGwtOnLoadNameVars = new JsVars(sourceInfo);
previousGwtOnLoadNameVars.add(previousGwtOnLoadNameVar);
createGwtOnLoadBody.getStatements().add(previousGwtOnLoadNameVars);
// gwtOnLoad = function(errFn, modName, modBase, softPermutationId) {