Пример #1
0
 private static IEnumerable<FunctionSymbol> Create4(
     string name, string documentation, TypeSymbol[] types,
     string parameterName1, string parameterDocumentation1,
     string parameterName2, string parameterDocumentation2,
     string parameterName3, string parameterDocumentation3,
     string parameterName4, string parameterDocumentation4,
     TypeSymbol overrideReturnType = null,
     ParameterDirection overrideParameterDirection4 = ParameterDirection.In)
 {
     return types.Select(type => new FunctionSymbol(
         name, documentation, null, overrideReturnType ?? type,
         f => new[]
         {
             new ParameterSymbol(parameterName1, parameterDocumentation1, f, type),
             new ParameterSymbol(parameterName2, parameterDocumentation2, f, type),
             new ParameterSymbol(parameterName3, parameterDocumentation3, f, type),
             new ParameterSymbol(parameterName4, parameterDocumentation4, f, type, overrideParameterDirection4)
         }));
 }
Пример #2
0
        private static IEnumerable<FunctionSymbol> Create1(
            string name, string documentation, TypeSymbol[] types, 
            string parameterName, string parameterDocumentation, 
            params TypeSymbol[] overrideReturnTypes)
        {
            if (overrideReturnTypes.Length == 0)
                overrideReturnTypes = null;
            else if (overrideReturnTypes.Length == 1)
                overrideReturnTypes = Enumerable.Repeat(overrideReturnTypes[0], types.Length).ToArray();

            return types.Select((type, i) => new FunctionSymbol(
                name, documentation, null, overrideReturnTypes?[i] ?? type,
                f => new []
                {
                    new ParameterSymbol(parameterName ?? "value", parameterDocumentation ?? "The specified value.", f, type)
                }));
        }