private void readInstantiatedField(Field field, TypeInstantiation inst) { CompoundType compound = inst.getBaseType(); buffer.append(AccessorNameEmitter.getSetterName(field)); buffer.append("(new "); buffer.append(compound.getName()); buffer.append("(__in, __cc"); appendArguments(buffer, inst); buffer.append("));"); }
static void appendArguments(StringBuilder buffer, TypeInstantiation inst) { CompoundType compound = inst.getBaseType(); Iterable<Expression> arguments = inst.getArguments(); if (arguments != null) { ExpressionEmitter ee = new ExpressionEmitter(); int argIndex = 0; for (Expression arg : arguments) { buffer.append(", "); boolean cast = emitTypeCast(buffer, compound, arg, argIndex); String javaArg = ee.emit(arg); buffer.append(javaArg); if (cast) { buffer.append(")"); } argIndex++; } } }
private void setParameters(String lhs, TypeInstantiation inst) { CompoundType compound = inst.getBaseType(); Iterable<Expression> arguments = inst.getArguments(); if (arguments != null) { int argIndex = 0; for (Expression arg : arguments) { Parameter param = compound.getParameterAt(argIndex); String setter = AccessorNameEmitter.getSetterName(param); buffer.append(lhs); buffer.append("."); buffer.append(setter); buffer.append("("); boolean cast = emitTypeCast(buffer, compound, arg, argIndex); String javaArg = exprEmitter.emit(arg); buffer.append(javaArg); if (cast) { buffer.append(")"); } buffer.append(");\n "); argIndex++; } } }