Ejemplo n.º 1
0
 private static void GetFakeExpressions(IReadOnlyList <TypeSymbol> types, List <Expression> expressions)
 {
     foreach (var type in types)
     {
         expressions.Add(FakeExpression.Create(type));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the set of possible parameters for an argument that would follow after the specified set of existing arguments.
        /// </summary>
        public virtual void GetNextPossibleParameters(Signature signature, IReadOnlyList <Expression> arguments, List <Parameter> possibleParameters)
        {
            // default implementation asks for the layout given an additional parameter with type Unknown
            var newArguments       = s_expressionListPool.AllocateFromPool();
            var argumentParameters = s_parameterListPool.AllocateFromPool();

            try
            {
                // add fake argument w/ unknown type to end of arguments
                newArguments.AddRange(arguments);
                newArguments.Add(FakeExpression.Create(ScalarTypes.Unknown));

                // try to get parameter layout for this extended list of arguments
                GetArgumentParameters(signature, newArguments, argumentParameters);

                // use last parameter in this layout
                possibleParameters.Add(argumentParameters[argumentParameters.Count - 1]);
            }
            finally
            {
                s_expressionListPool.ReturnToPool(newArguments);
                s_parameterListPool.ReturnToPool(argumentParameters);
            }
        }