public override SyntaxNode VisitIndexerDeclaration(IndexerDeclarationSyntax node)
        {
            ISymbol subst;

            if (ArrayIndexingHelper.HasArrayIndexingAttribute(semanticModel, node.AttributeLists, out subst))
            {
                return(null);
            }

            return(base.VisitIndexerDeclaration(node));
        }
        public override SyntaxNode VisitStructDeclaration(StructDeclarationSyntax node)
        {
            ISymbol subst;

            if (ArrayIndexingHelper.HasArrayIndexingAttribute(semanticModel, node.AttributeLists, out subst))
            {
                return(null);
            }

            fieldStack.Push(new FieldHolder());
            node = (StructDeclarationSyntax)base.VisitStructDeclaration(node);
            fieldStack.Pop();

            return(node);
        }
        public override SyntaxNode VisitFieldDeclaration(FieldDeclarationSyntax node)
        {
            node = (FieldDeclarationSyntax)base.VisitFieldDeclaration(node);

            foreach (VariableDeclaratorSyntax variable in node.Declaration.Variables)
            {
                ISymbol subst;
                if (ArrayIndexingHelper.HasArrayIndexingAttribute(semanticModel, node.AttributeLists, out subst))
                {
                    if (subst != null)
                    {
                        throw new ArgumentException("ArrayIndexing substution type not permitted on fields");
                    }

                    ImmutableArray <ISymbol> symbols = semanticModel.LookupSymbols(variable.Identifier.Span.Start, null, variable.Identifier.Text);
                    if (symbols.Length != 1)
                    {
                        Debug.Assert(false);
                        throw new ArgumentException(String.Format("Template contains none or multiple symbols in scope for \"{0}\" which ought to be impossible (but could happen due to template code errors)", variable.Identifier.Text));
                    }
                    ISymbol identifierSymbol = symbols[0];

                    if (CurrentFieldSymbol != null)
                    {
                        Debug.Assert(false);
                        throw new InvalidOperationException();
                    }

                    CurrentFieldSymbol = identifierSymbol;

                    node = node.Update(
                        node.AttributeLists,
                        node.Modifiers,
                        node.Declaration.Update(
                            node.Declaration.Type,
                            node.Declaration.Variables.Remove(variable)),
                        node.SemicolonToken);
                    if (node.Declaration.Variables.Count == 0)
                    {
                        return(null);
                    }
                }
            }

            return(node);
        }
        public override void VisitStructDeclaration(StructDeclarationSyntax node)
        {
            ISymbol subst;

            if (ArrayIndexingHelper.HasArrayIndexingAttribute(semanticModel, node.AttributeLists, out subst))
            {
                if (subst != null)
                {
                    ImmutableArray <ISymbol> symbols = semanticModel.LookupSymbols(node.Identifier.Span.Start, null, node.Identifier.Text);
                    if (symbols.Length != 1)
                    {
                        Debug.Assert(false);
                        throw new ArgumentException(String.Format("Template contains none or multiple symbols in scope for \"{0}\" which ought to be impossible (but could happen due to template code errors)", node.Identifier.Text));
                    }
                    ISymbol originalSymbol = symbols[0];

                    replace.Add(originalSymbol, subst);
                }
            }

            base.VisitStructDeclaration(node);
        }