protected virtual List WalkMemberChain(MemberReferenceExpression memberRef)
        {
            List chain = new List();

            while (true)
            {
                MemberReferenceExpression container = memberRef.Target as MemberReferenceExpression;
                if (null == container ||
                    (IsSpecialMemberTarget(container) &&
                     IsReadOnlyMember(container)))
                {
                    Warnings.Add(
                        CompilerWarningFactory.AssignmentToTemporary(memberRef));
                    return(null);
                }
                if (IsSpecialMemberTarget(container) &&
                    EntityType.Field != container.Entity.EntityType)
                {
                    chain.Insert(0, new ChainItem(container));
                }
                if (IsTerminalReferenceNode(container.Target))
                {
                    break;
                }
                memberRef = container;
            }
            return(chain);
        }
示例#2
0
        public override List WalkMemberChain(MemberReferenceExpression memberRef)
        {
            List list = new List();

            while (true)
            {
                MemberReferenceExpression target = memberRef.Target as MemberReferenceExpression;
                if ((target == null) || (this.IsSpecialMemberTarget(target) && this.IsReadOnlyMember(target)))
                {
                    this.Warnings.Add(CompilerWarningFactory.AssignmentToTemporary(memberRef));
                    return(null);
                }
                if (this.IsSpecialMemberTarget(target) && !this.IsFieldReference(target))
                {
                    list.Insert(0, new ProcessAssignmentsToSpecialMembers.ChainItem(target));
                }
                if ((target.Target is MethodInvocationExpression) || (target.Target is SlicingExpression))
                {
                    list.Insert(0, new ProcessAssignmentsToSpecialMembers.ChainItem(target.Target));
                    return(list);
                }
                if (this.IsTerminalReferenceNode(target.Target))
                {
                    return(list);
                }
                memberRef = target;
            }
        }