/**
* special construction for object initialization new Object(){{x = 1; y = 2; }};
*/
private JS getObjectInitializer(WriterVisitor<JS> visitor, TreeWrapper<NewClassTree, JS> tw) {
NewClassTree tree = tw.getTree();
BlockTree initBlock = getDoubleBracesBlock(tree);
if (initBlock == null && !tw.child(tree.getIdentifier()).isSyntheticType()) {
return null;
}
List<NameValue<JS>> props = new ArrayList<NameValue<JS>>();
if (initBlock != null) {
for (StatementTree stmt : initBlock.getStatements()) {
// check the right type of statements x=y is done in NewClassObjectInitCheck
AssignmentTree assign = (AssignmentTree) ((ExpressionStatementTree) stmt).getExpression();
props.add(NameValue.of(getPropertyName(assign.getVariable()), visitor.scan(assign.getExpression(), tw.getContext())));
}
}