Пример #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));
        }
Пример #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));
        }
Пример #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);
 }
Пример #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));
        }
Пример #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);
        }
Пример #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));
        }
Пример #7
0
 private static void WriteAssignmentExpression(BoundAssignmentExpression node, IndentedTextWriter writer)
 {
     writer.WriteIdentifier(node.Variable.Name);
     writer.WritePunctuation(" = ");
     node.Expression.WriteTo(writer);
 }