public AssignmentExpression ConvertToInitializer(AssignmentExpression assignmentExpression, ref IList <AstNode> statements)
        {
            if (assignmentExpression == null)
            {
                throw new ArgumentNullException("assignmentExpression");
            }
            if (statements == null)
            {
                throw new ArgumentNullException("statements");
            }
            if (!(assignmentExpression.Right is ObjectCreateExpression))
            {
                throw new ArgumentException("assignmentExpression.Right must be an ObjectCreateExpression", "assignmentExpression");
            }

            if (!Initialize(assignmentExpression.Left))
            {
                return(null);
            }
            accessPaths [mainAccessPath] = assignmentExpression.Right.Clone();

            Convert(statements);
            statements = ReplacementNodeHelper.GetReplacedNodes(accessPaths [mainAccessPath]);
            return(new AssignmentExpression(new IdentifierExpression(mainAccessPath.RootName), accessPaths [mainAccessPath]));
        }
        public VariableInitializer ConvertToInitializer(VariableInitializer variableInitializer, ref IList <AstNode> statements)
        {
            if (variableInitializer == null)
            {
                throw new ArgumentNullException("variableInitializer");
            }
            if (statements == null)
            {
                throw new ArgumentNullException("statements");
            }

            if (!Initialize(variableInitializer))
            {
                return(null);
            }
            accessPaths [mainAccessPath] = variableInitializer.Initializer.Clone();

            Convert(statements);
            statements = ReplacementNodeHelper.GetReplacedNodes(accessPaths [mainAccessPath]);
            return(new VariableInitializer(mainAccessPath.RootName, accessPaths [mainAccessPath]));
        }