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

            pAssignment.Flags = EXPRFLAG.EXF_ASSGOP;
            pAssignment.LHS   = pLHS;
            pAssignment.RHS   = pRHS;
            return(pAssignment);
        }
コード例 #2
0
ファイル: ExprFactory.cs プロジェクト: vinaykk/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.LHS   = pLHS;
            pAssignment.RHS   = pRHS;
            return(pAssignment);
        }
コード例 #3
0
        /////////////////////////////////////////////////////////////////////////////////
        // Statement types.
        protected override Expr VisitASSIGNMENT(ExprAssignment assignment)
        {
            Debug.Assert(assignment != 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.LHS is ExprProperty prop)
            {
                if (prop.OptionalArguments == 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.MemberGroup.OptionalObject);
                    Expr propInfo  = GetExprFactory().CreatePropertyInfo(prop.PropWithTypeSlot.Prop(), prop.PropWithTypeSlot.Ats);
                    Expr arguments = GenerateParamsArray(
                        GenerateArgsList(prop.OptionalArguments),
                        PredefinedType.PT_EXPRESSION);

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

            Expr rhs = Visit(assignment.RHS);

            return(GenerateCall(PREDEFMETH.PM_EXPRESSION_ASSIGN, lhs, rhs));
        }
コード例 #4
0
ファイル: ExprVisitorBase.cs プロジェクト: wenchaoli/corefx
 protected virtual Expr VisitASSIGNMENT(ExprAssignment pExpr)
 {
     return(VisitEXPR(pExpr));
 }