Iterator locs = field.locationIterator(); boolean first = true; while (locs.hasNext()) { Location loc = (Location) locs.next(); print("  "); if (first) { first = false; } else { print("else "); } if (locs.hasNext()) { println("if (" + buildIsAltName(type, loc.getAltId()) + "(arg)) {"); } else { println(""); } print("    return (" + field_type_name + ")"); Iterator steps = loc.stepIterator(); String type_getter = genATermToBuiltin(field.getType(), genGetterSteps(steps, "arg")); print(type_getter); println(";"); if (locs.hasNext()) { println("  }"); } }
genGetFieldBody(type, field, field_type_name);
	private void genGetField(Type type, Field field) {		String type_name = buildTypeName(type);		String field_type_name = buildTypeName(field.getType());		String decl = field_type_name + " " + buildGetterName(type, field) + "(" + type_name + " arg)";		hprintln(decl + ";");		printFoldOpen(decl);		println(decl);		println("{");		Iterator locs = field.locationIterator();		boolean first = true;		while (locs.hasNext()) {			Location loc = (Location) locs.next();			print("  ");			if (first) {				first = false;			}			else {				print("else ");			}			if (locs.hasNext()) {				println("if (" + buildIsAltName(type, loc.getAltId()) + "(arg)) {");			}			else {				println("");			}			print("    return (" + field_type_name + ")");			Iterator steps = loc.stepIterator();			String type_getter = genATermToBuiltin(field.getType(), genGetterSteps(steps, "arg"));			print(type_getter);			println(";");			if (locs.hasNext()) {				println("  }");			}		}		println("}");		printFoldClose();	}