Exemple #1
0
                static PropertyCSharpSubpatternMember findTopMostMember(PropertyCSharpSubpatternMember member)
                {
                    if (member.Receiver == null)
                    {
                        return(member);
                    }

                    return(findTopMostMember(member.Receiver));
                }
Exemple #2
0
        // REVIEW: The parameter order is not left-to-right compared to the language grammar.

        /// <summary>
        /// Creates a property subpattern that matches a property or field on an object.
        /// </summary>
        /// <param name="pattern">The pattern to apply to the object in the corresponding position.</param>
        /// <param name="member">The property or field to match on.</param>
        /// <param name="isLengthOrCount">A value indicating whether the member is a length or count property.</param>
        /// <returns>A <see cref="PropertyCSharpSubpattern" /> representing a property subpattern.</returns>
        public static PropertyCSharpSubpattern PropertySubpattern(CSharpPattern pattern, PropertyCSharpSubpatternMember member, bool isLengthOrCount)
        {
            RequiresNotNull(pattern, nameof(pattern));
            RequiresNotNull(member, nameof(member));

            RequiresCompatiblePatternTypes(member.Type, ref pattern);

            return(new PropertyCSharpSubpattern(pattern, member, isLengthOrCount));
        }
Exemple #3
0
 internal PropertyCSharpSubpattern(CSharpPattern pattern, PropertyCSharpSubpatternMember member, bool isLengthOrCount)
     : base(pattern)
 {
     Member          = member;
     IsLengthOrCount = isLengthOrCount;
 }
Exemple #4
0
 internal PropertyCSharpSubpatternMember(PropertyCSharpSubpatternMember receiver) => Receiver = receiver;