/// <summary> /// Initializes a new instance of the <see cref="ArgumentDefinition" /> class. /// </summary> /// <param name="node">The node that defines the argument.</param> /// <param name="ordinalIndex">The ordinal index where the argument exists in the list of arguments.</param> /// <exception cref="ArgumentNullException">The <paramref name="node" /> parameter is <c>null</c>.</exception> public ArgumentDefinition(AttributeArgumentSyntax node, int?ordinalIndex) : base(node) { node = node ?? throw new ArgumentNullException(nameof(node)); Declaration = node.ToFullString(); Value = node.Expression.ToString(); if (node.NameColon == null) { OrdinalIndex = ordinalIndex; ParameterName = string.Empty; Name = Value; ArgumentType = ArgumentType.Ordinal; } else { OrdinalIndex = null; ParameterName = node.NameColon.Name.ToString(); Name = ParameterName; ArgumentType = ArgumentType.Named; } }