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(); }
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(); }