/// <summary>
        /// Constructs a <c>FunctionCall</c> representation of creating a new array.
        /// </summary>
        /// <param name="elementType">type of array element</param>
        /// <param name="numElements">expression representing the array length</param>
        /// <param name="sample">sample instance of the created array</param>
        /// <returns></returns>
        public static FunctionCall NewArray(Type elementType, Expression numElements, Array sample)
        {
            ArrayParams    aparams;
            TypeDescriptor arrayType;

            if (sample != null)
            {
                long numElementsLong = sample.LongLength;
                aparams   = new ArrayParams(elementType, numElementsLong);
                arrayType = TypeDescriptor.GetTypeOf(sample);
            }
            else
            {
                aparams   = new ArrayParams(elementType);
                arrayType = elementType.MakeArrayType();
            }

            return(new FunctionCall()
            {
                Callee = MakeFun(
                    new IntrinsicFunction(IntrinsicFunction.EAction.NewArray, aparams),
                    arrayType),
                Arguments = new Expression[] { numElements },
                ResultType = arrayType,
                SetResultTypeClass = EResultTypeClass.ObjectReference
            });
        }
        /// <summary>
        /// Constructs a <c>FunctionCall</c> representation of creating a new array.
        /// </summary>
        /// <param name="elementType">type of array element</param>
        /// <param name="numElements">expression representing the array length</param>
        /// <param name="sample">sample instance of the created array</param>
        /// <returns></returns>
        public static FunctionCall NewArray(Type elementType, Expression numElements, Array sample)
        {
            ArrayParams aparams;
            TypeDescriptor arrayType;
            if (sample != null)
            {
                long numElementsLong = sample.LongLength;
                aparams = new ArrayParams(elementType, numElementsLong);
                arrayType = TypeDescriptor.GetTypeOf(sample);
            }
            else
            {
                aparams = new ArrayParams(elementType);
                arrayType = elementType.MakeArrayType();
            }

            return new FunctionCall()
            {
                Callee = MakeFun(
                    new IntrinsicFunction(IntrinsicFunction.EAction.NewArray, aparams),
                    arrayType),
                Arguments = new Expression[] { numElements },
                ResultType = arrayType,
                SetResultTypeClass = EResultTypeClass.ObjectReference
            };
        }