コード例 #1
0
        public EXPRASSIGNMENT CreateAssignment(EXPR pLHS, EXPR pRHS)
        {
            EXPRASSIGNMENT pAssignment = new EXPRASSIGNMENT();

            pAssignment.kind  = ExpressionKind.EK_ASSIGNMENT;
            pAssignment.type  = pLHS.type;
            pAssignment.flags = EXPRFLAG.EXF_ASSGOP;
            pAssignment.SetLHS(pLHS);
            pAssignment.SetRHS(pRHS);
            return(pAssignment);
        }
コード例 #2
0
        /////////////////////////////////////////////////////////////////////////////////
        // Statement types.
        protected override EXPR VisitASSIGNMENT(EXPRASSIGNMENT assignment)
        {
            Debug.Assert(assignment != null);
            Debug.Assert(alwaysRewrite || currentAnonMeth != null);

            // For assignments, we either have a member assignment or an indexed assignment.
            //Debug.Assert(assignment.GetLHS().isPROP() || assignment.GetLHS().isFIELD() || assignment.GetLHS().isARRAYINDEX() || assignment.GetLHS().isLOCAL());
            EXPR lhs;
            if (assignment.GetLHS().isPROP())
            {
                EXPRPROP prop = assignment.GetLHS().asPROP();

                if (prop.GetOptionalArguments() == null)
                {
                    // Regular property.
                    lhs = Visit(prop);
                }
                else
                {
                    // Indexed assignment. Here we need to find the instance of the object, create the 
                    // PropInfo for the thing, and get the array of expressions that make up the index arguments.
                    //
                    // The LHS becomes Expression.Property(instance, indexerInfo, arguments).
                    EXPR instance = Visit(prop.GetMemberGroup().GetOptionalObject());
                    EXPR propInfo = GetExprFactory().CreatePropertyInfo(prop.pwtSlot.Prop(), prop.pwtSlot.Ats);
                    EXPR arguments = GenerateParamsArray(
                        GenerateArgsList(prop.GetOptionalArguments()),
                        PredefinedType.PT_EXPRESSION);

                    lhs = GenerateCall(PREDEFMETH.PM_EXPRESSION_PROPERTY, instance, propInfo, arguments);
                }
            }
            else
            {
                lhs = Visit(assignment.GetLHS());
            }

            EXPR rhs = Visit(assignment.GetRHS());
            return GenerateCall(PREDEFMETH.PM_EXPRESSION_ASSIGN, lhs, rhs);
        }
コード例 #3
0
ファイル: ExprVisitorBase.cs プロジェクト: zwy2014/corefx
 protected virtual EXPR VisitASSIGNMENT(EXPRASSIGNMENT pExpr)
 {
     return(VisitEXPR(pExpr));
 }
コード例 #4
0
ファイル: ExprVisitorBase.cs プロジェクト: noahfalk/corefx
 protected virtual EXPR VisitASSIGNMENT(EXPRASSIGNMENT pExpr)
 {
     return VisitEXPR(pExpr);
 }
コード例 #5
0
ファイル: ExprFactory.cs プロジェクト: noahfalk/corefx
 public EXPRASSIGNMENT CreateAssignment(EXPR pLHS, EXPR pRHS)
 {
     EXPRASSIGNMENT pAssignment = new EXPRASSIGNMENT();
     pAssignment.kind = ExpressionKind.EK_ASSIGNMENT;
     pAssignment.type = pLHS.type;
     pAssignment.flags = EXPRFLAG.EXF_ASSGOP;
     pAssignment.SetLHS(pLHS);
     pAssignment.SetRHS(pRHS);
     return pAssignment;
 }