Esempio n. 1
0
        protected override void VisitVariableDecleration(VariableDeclerationNode node)
        {
            BuildString.Append(' ');
            BuildString.Append(node.DeclerationType);

            if (node.Declerations.ChildCount == 1)
            {
                SingleVariableDeclerationNode decleration = node.Declerations.First();
                BuildString.Append(' ');
                BuildString.Append(decleration.Identifier);
                if (decleration.DefaultValue != null)
                {
                    Visit(decleration.DefaultValue);
                }
            }
            else
            {
                foreach (SingleVariableDeclerationNode decleration in node.Declerations)
                {
                    Indent();
                    BuildString.Append(decleration.Identifier);

                    if (decleration.DefaultValue != null)
                    {
                        Visit(decleration.DefaultValue);
                    }
                    Dedent();
                }
            }
        }
        protected override CrawlSyntaxNode VisitSingleVariableDecleration(SingleVariableDeclerationNode singleVariableDecleration)
        {
            var          node          = (SingleVariableDeclerationNode)base.VisitSingleVariableDecleration(singleVariableDecleration);
            CrawlType    resultType    = node.DefaultValue?.ResultType ?? node.Identifier.ResultType;
            VariableNode newIdentifier = (VariableNode)node.Identifier.WithResultType(resultType);

            return(node.WithIdentifier(newIdentifier));
        }