Пример #1
0
        public override Ust VisitVariableDeclarator(VariableDeclaratorSyntax node)
        {
            var initializer = node.Initializer != null ? (Expression)base.Visit(node.Initializer.Value) : null;

            var result = new AssignmentExpression(
                new IdToken(node.Identifier.ValueText, node.Identifier.GetTextSpan()),
                initializer,
                node.GetTextSpan()
                );

            return(result);
        }
Пример #2
0
        private Ust HandleTupleStatement(VariableDeclaratorSyntax node)
        {
            var tuple = base.Visit(node.Initializer.Value) as TupleCreateExpression;

            if (tuple == null)
            {
                return(null);
            }

            var idText     = node.Identifier.ValueText;
            var idTextSpan = node.Identifier.GetTextSpan();

            tuple.Initializers.ForEach(init =>
            {
                var assignment  = (AssignmentExpression)init;
                assignment.Left = new MemberReferenceExpression(
                    new IdToken(idText, idTextSpan), assignment.Left, assignment.Left.TextSpan);
            });

            return(new AssignmentExpression(new IdToken(idText, idTextSpan), tuple, node.GetTextSpan()));
        }