Example #1
0
  private void renderVariable(
      @NotNull VariableDescriptor variable, @NotNull StringBuilder builder, boolean topLevel) {
    JetType realType = variable.getType();

    JetType varargElementType =
        variable instanceof ValueParameterDescriptor
            ? ((ValueParameterDescriptor) variable).getVarargElementType()
            : null;
    JetType typeToRender = varargElementType != null ? varargElementType : realType;

    if (varargElementType != null) {
      builder.append(renderKeyword("vararg")).append(" ");
    }
    if (topLevel && !startFromName) {
      renderValVarPrefix(variable, builder);
    }

    renderName(variable, builder);
    builder.append(": ").append(escape(renderType(typeToRender)));

    if (verbose && varargElementType != null) {
      builder.append(" /*").append(escape(renderType(realType))).append("*/");
    }
  }
Example #2
0
 private void renderValVarPrefix(
     @NotNull VariableDescriptor variable, @NotNull StringBuilder builder) {
   builder.append(renderKeyword(variable.isVar() ? "var" : "val")).append(" ");
 }