Esempio n. 1
0
        public override Func <IExtractContext, string[]> Apply(
            ITypeInformation elementType, DecodeContext decodeContext)
        {
            var siCount = decodeContext.PopStack();

            if (!(siCount.TargetType.IsInt32StackFriendlyType || siCount.TargetType.IsIntPtrStackFriendlyType))
            {
                throw new InvalidProgramSequenceException(
                          "Invalid array size type: Location={0}, StackType={1}",
                          decodeContext.CurrentCode.RawLocation,
                          siCount.TargetType.FriendlyName);
            }

            var symbol = decodeContext.PushStack(elementType.MakeArray());

            return(extractContext => new[] { string.Format(
                                                 "{0} = il2c_new_array({1}, {2})",
                                                 extractContext.GetSymbolName(symbol),
                                                 elementType.MangledName,
                                                 extractContext.GetSymbolName(siCount)) });
        }