for (JField field : x.getFields()) {
assert field.isStatic() : "All fields on immortal types must be static.";
accept(field);
JsNode node = pop();
assert node instanceof JsVar;
JsVar fieldVar = (JsVar) node;
JExpression init = field.getInitializer();
if (init != null
&& field.getLiteralInitializer() == null) {
// no literal, but it could be a JavaScriptObject
if (init.getType() == program.getJavaScriptObject()) {
assert init instanceof JMethodCall;
JMethod meth = ((JMethodCall) init).getTarget();
// immortal types can only have non-primitive literal initializers of createArray,createObject
if (meth == createObjMethod) {
fieldVar.setInitExpr(new JsObjectLiteral(init.getSourceInfo()));
} else if (meth == createArrMethod) {
fieldVar.setInitExpr(new JsArrayLiteral(init.getSourceInfo()));
} else {
assert false : "Illegal initializer expression for immortal field " + field;
}
}
}