Exemple #1
0
        private void CheckMember <T>(NamedMember <T> member, string alias) where T : MemberInfo
        {
            if (member.Member != null)
            {
                return;
            }

            if (member.AmbiguousMembers == null || member.AmbiguousMembers.Length < 2)
            {
                // Should never happen, check NamedMember instanciations.
                throw new InvalidOperationException(
                          $"{nameof(NamedMember<T>.Member)} missing and {nameof(NamedMember<T>.AmbiguousMembers)} invalid.");
            }

            throw new AmbiguousMatchException(
                      $"Unable to find adequate property or field to set on '{member.AmbiguousMembers[0].DeclaringType.Name}' for alias '{alias}', " +
                      $"many {(member.AmbiguousMembers[0] is PropertyInfo ? "properties" : "fields")} matches: " +
                      $"{string.Join(", ", member.AmbiguousMembers.Select(m => m.Name))}");
        }
 /// <summary>
 /// Named member Assignment operator.
 /// </summary>
 /// <param name="NamedMember">Named member</param>
 /// <param name="Operand">Operand.</param>
 /// <param name="Start">Start position in script expression.</param>
 /// <param name="Length">Length of expression covered by node.</param>
 /// <param name="Expression">Expression containing script.</param>
 public NamedMemberAssignment(NamedMember NamedMember, ScriptNode Operand, int Start, int Length, Expression Expression)
     : base(NamedMember.Operand, Operand, Start, Length, Expression)
 {
     this.name = NamedMember.Name;
 }