Ejemplo n.º 1
0
        public static BoundExpressionStatement Increment(SyntaxNode syntax, BoundVariableExpression variable)
        {
            var increment       = Add(syntax, variable, Literal(syntax, 1));
            var incrementAssign = new BoundAssignmentExpression(syntax, variable.Variable, increment);

            return(new BoundExpressionStatement(syntax, incrementAssign));
        }
Ejemplo n.º 2
0
        public static BoundExpressionStatement Increment(BoundVariableExpression variable)
        {
            var increment       = Add(variable, Literal(1));
            var incrementAssign = new BoundAssignmentExpression(variable.Variable, increment);

            return(new BoundExpressionStatement(incrementAssign));
        }
Ejemplo n.º 3
0
 private static void WriteAssignmentExpression(BoundAssignmentExpression node, IndentedTextWriter writer)
 {
     writer.WriteIdentifier(node.Variable.Name);
     writer.WriteSpace();
     writer.WritePunctuation(SyntaxKind.EqualsToken);
     writer.WriteSpace();
     node.Expression.WriteTo(writer);
 }
Ejemplo n.º 4
0
        protected virtual BoundExpression RewriteCompoundAssignmentExpression(BoundCompoundAssignmentExpression node)
        {
            var boundVariableExpression   = new BoundVariableExpression(node.Variable);
            var boundBinaryExpression     = new BoundBinaryExpression(boundVariableExpression, node.Op, node.Expression);
            var boundAssignmentExpression = new BoundAssignmentExpression(node.Variable, boundBinaryExpression);

            return(RewriteAssignmentExpression(boundAssignmentExpression));
        }
Ejemplo n.º 5
0
        protected virtual BoundExpression RewriteAssignmentExpression(BoundAssignmentExpression node)
        {
            var expression = RewriteExpression(node.Expression);
            if (expression == node.Expression)
                return node;

            return new BoundAssignmentExpression(node.Variable, expression);
        }
Ejemplo n.º 6
0
        protected virtual BoundExpression RewriteAssignmentExpression(BoundAssignmentExpression node)
        {
            var expression = RewriteExpression(node.Expression);

            if (expression == node.Expression)
            {
                return(node);
            }

            return(new BoundAssignmentExpression(node.Syntax, node.Variable, expression));
        }
Ejemplo n.º 7
0
 private static void WriteAssignmentExpression(BoundAssignmentExpression node, IndentedTextWriter writer)
 {
     writer.WriteIdentifier(node.Variable.Name);
     writer.WritePunctuation(" = ");
     node.Expression.WriteTo(writer);
 }