コード例 #1
0
        BoundExpression BindAssignEx(AST.AssignEx expr, BoundAccess access)
        {
            var             target = (BoundReferenceExpression)BindExpression(expr.LValue, BoundAccess.Write);
            BoundExpression value;

            // bind value (read as value or as ref)
            if (expr is AST.ValueAssignEx)
            {
                value = BindExpression(((AST.ValueAssignEx)expr).RValue, BoundAccess.Read);
            }
            else
            {
                Debug.Assert(expr is AST.RefAssignEx);
                Debug.Assert(expr.Operation == AST.Operations.AssignRef);
                target.Access = target.Access.WithWriteRef(0); // note: analysis will write the write type
                value         = BindExpression(((AST.RefAssignEx)expr).RValue, BoundAccess.ReadRef);
            }

            //
            if (expr.Operation == AST.Operations.AssignValue || expr.Operation == AST.Operations.AssignRef)
            {
                return(new BoundAssignEx(target, value).WithAccess(access));
            }
            else
            {
                target.Access = target.Access.WithRead();   // Read & Write on target

                return(new BoundCompoundAssignEx(target, value, expr.Operation));
            }
        }
コード例 #2
0
 /// <summary>
 /// Visit l-value of assignment.
 /// </summary>
 /// <param name="x"></param>
 virtual public void VisitAssignEx(AssignEx x)
 {
     VisitElement(x.LValue);
 }