コード例 #1
0
        public EmitArrayInitializerExpression(EmitType type, EmitArrayInitializer initializer)
        {
            Type        = type;
            Initializer = initializer;

            if (Initializer.Length == 0)
            {
                throw new EmitVerifyException("An array initiaizler expression must have at least one element.");
            }

            Rank = 0;
            var lengths = new Queue <int>();

            lengths.Enqueue(Initializer.Length);
            var current = Initializer[0];

            while (current != null)
            {
                Rank++;
                if (current is EmitArrayInitializer)
                {
                    lengths.Enqueue(current.Length);
                    current = current[0];
                }
                else
                {
                    current = null;
                }
            }
            Lengths = lengths.ToArray();
        }
コード例 #2
0
        public EmitArrayInitializerExpression(EmitType type, EmitArrayInitializer initializer)
        {
            Type = type;
            Initializer = initializer;

            if (Initializer.Length == 0)
                throw new EmitVerifyException("An array initiaizler expression must have at least one element.");

            Rank = 0;
            var lengths = new Queue<int>();
            lengths.Enqueue(Initializer.Length);
            var current = Initializer[0];
            while (current != null)
            {
                Rank++;
                if (current is EmitArrayInitializer)
                {
                    lengths.Enqueue(current.Length);
                    current = current[0];
                }
                else
                {
                    current = null;
                }
            }
            Lengths = lengths.ToArray();
        }