appendCallElement(new DeferredCallElement(new DeferredCallback() {
@Override
public void doDeferred(CallWriter writer, Context context, Statement statement) {
writer.reset();
CallParameters callParameters = (parameters != null) ?
fromStatements(GenUtil.generateCallParameters(context, parameters)) : CallParameters.none();
if (!type.isInterface() && type.getBestMatchingConstructor(callParameters.getParameterTypes()) == null)
throw new UndefinedConstructorException(type, callParameters.getParameterTypes());
StringBuilder buf = new StringBuilder();
buf.append("new ").append(LoadClassReference.getClassReference(type, context, true));
if (callParameters != null) {
buf.append(callParameters.generate(Context.create(context)));
}
if (extendsBlock != null) {
for (MetaField field : type.getDeclaredFields()) {
context.addVariable(Variable.createClassMember(field.getName(), field.getType()));
}