/** * Recursively traverses a label expression to construct the setter name for the label. We rely * on the results of the ExpressionEvaluator in assuming that the expression type is either DOT * or ID, and that an ID always resolved to a Field in the expression scope. * * @param buffer string buffer used for appending the partial result * @param expr subexpression of current label expression */ private void appendLabelSetter(StringBuilder buffer, Expression expr) { if (expr.getType() == DataScriptParserTokenTypes.DOT) { Expression op1 = expr.op1(); String symbol = op1.getText(); Field f = (Field) op1.getScope().getTypeOrSymbol(symbol); String getter = AccessorNameEmitter.getGetterName(f); buffer.append(getter); buffer.append("()."); appendLabelSetter(buffer, expr.op2()); } else { Field f = (Field) expr.getScope().getTypeOrSymbol(expr.getText()); buffer.append(AccessorNameEmitter.getSetterName(f)); } }