protected override StringBuilder AppendParameter(StringBuilder buf, ParameterDefinition parameter) { if (parameter.ParameterType is ByReferenceType && parameter.IsOut) { //no notion of out -> mark with attribute to distinguish in other languages buf.Append("[Runtime::InteropServices::Out] "); } if (parameter.HasCustomAttributes) { var isParams = parameter.CustomAttributes.Any(ca => ca.AttributeType.Name == "ParamArrayAttribute"); if (isParams) { buf.AppendFormat("... "); } } buf.Append(GetTypeName(parameter.ParameterType, EmptyAttributeParserContext.Empty())); if (!parameter.ParameterType.IsByReference && !parameter.ParameterType.IsPointer) { buf.Append(parameter.IsOut ? RefTypeModifier : HatModifier); } buf.Append(" "); buf.Append(parameter.Name); if (parameter.HasDefault && parameter.IsOptional && parameter.HasConstant) { buf.AppendFormat(" = {0}", new AttributeFormatter().MakeAttributesValueString(parameter.Constant, parameter.ParameterType)); } return(buf); }
protected virtual string GetTypeNameWithOptions(TypeReference type, bool appendHat, bool appendGeneric = true) { var typeName = GetTypeName(type, EmptyAttributeParserContext.Empty(), appendGeneric); var hatTypeName = !type.IsByReference && !type.IsPointer ? AppendHat(typeName, type, appendHat) : typeName; return(hatTypeName); }