Пример #1
0
        public override void Visit(ArrayItemSyntax arrayItem)
        {
            _currentPath.Add(_currentArrayIndex);

            if (arrayItem.Value == null)
            {
                _diagnostics.Error(arrayItem.Span, $"The array item [{_currentArrayIndex}] must have a non null value");
            }
            base.Visit(arrayItem);
            _currentArrayIndex++;
        }
Пример #2
0
 /// <summary>
 /// Creates an instance of an <see cref="ArraySyntax"/>
 /// </summary>
 /// <param name="values">An array of string values</param>
 public ArraySyntax(string[] values) : this()
 {
     if (values == null)
     {
         throw new ArgumentNullException(nameof(values));
     }
     OpenBracket  = SyntaxFactory.Token(TokenKind.OpenBracket);
     CloseBracket = SyntaxFactory.Token(TokenKind.CloseBracket);
     for (int i = 0; i < values.Length; i++)
     {
         var item = new ArrayItemSyntax {
             Value = new StringValueSyntax(values[i])
         };
         if (i + 1 < values.Length)
         {
             item.Comma = SyntaxFactory.Token(TokenKind.Comma);
             item.Comma.AddTrailingWhitespace();
         }
         Items.Add(item);
     }
 }
Пример #3
0
 public virtual void Visit(ArrayItemSyntax arrayItem)
 {
     DefaultVisit(arrayItem);
 }