GenSymParameter() public method

public GenSymParameter ( string prefix, CodeTypeReference type ) : CodeVariableReferenceExpression
prefix string
type CodeTypeReference
return CodeVariableReferenceExpression
Exemplo n.º 1
0
        private CodeParameterDeclarationExpression GenerateFunctionParameter(Parameter ta)
        {
            CodeTypeReference parameterType;

            if (ta.tuple != null)
            {
                parameterType = GenerateTupleParameterType(ta.tuple);
                return(new CodeParameterDeclarationExpression
                {
                    ParameterType = parameterType,
                    ParameterName = stmtXlat.GenSymParameter("_tup_", parameterType).Name,
                    IsVarargs = false,
                });
            }
            else if (ta.keyarg)
            {
                parameterType = new CodeTypeReference("Hashtable");
                gen.EnsureImport("System.Collections");
            }
            else
            {
                parameterType = new CodeTypeReference(typeof(object));
            }
            return(new CodeParameterDeclarationExpression
            {
                ParameterType = parameterType,
                ParameterName = ta.Id.Name,
                IsVarargs = ta.vararg,
                DefaultValue = ta.test?.Accept(this.xlat)
            });
        }