Beispiel #1
0
        public override void TranslateArrayNew(StringBuilder sb, PType arrayType, Expression lengthExpression)
        {
            if (lengthExpression is InlineConstant)
            {
                InlineConstant ic     = (InlineConstant)lengthExpression;
                int            length = (int)ic.Value;
                switch (length)
                {
                case 0: sb.Append("[]"); return;

                case 1: sb.Append("[None]"); return;

                case 2: sb.Append("[None, None]"); return;

                default: break;
                }
            }
            TODO.UseGlobalListOfOneNoneToPreventFrequentReallocation();
            sb.Append("([None] * ");
            this.TranslateExpression(sb, lengthExpression);
            sb.Append(")");
        }