public override void CaseADeleteStm(ADeleteStm node)
 {
     InADeleteStm(node);
     if (node.GetExp() != null)
     {
         node.GetExp().Apply(this);
     }
     if (node.GetToken() != null)
     {
         node.GetToken().Apply(this);
     }
     OutADeleteStm(node);
 }
        public override void OutADeleteStm(ADeleteStm node)
        {
            //Child must be a pointer
            if (!(data.ExpTypes[node.GetExp()] is APointerType))
            {
                errors.Add(new ErrorCollection.Error(node.GetToken(), currentSourceFile, LocRM.GetString("ErrorText145")));
            }

            //Deconstructor must be visible
            else
            {
                APointerType pointer = (APointerType) data.ExpTypes[node.GetExp()];
                if (pointer.GetType() is ANamedType && data.StructTypeLinks.ContainsKey((ANamedType) pointer.GetType()))
                {
                    //Struct deconstructor
                    AStructDecl currentStr = Util.GetAncestor<AStructDecl>(node);
                    AStructDecl str = data.StructTypeLinks[(ANamedType) pointer.GetType()];
                    while (str != null)
                    {
                        ADeconstructorDecl deconstructor = data.StructDeconstructor[str];
                        if (deconstructor.GetVisibilityModifier() is APrivateVisibilityModifier &&
                            currentStr != str)
                        {
                            errors.Add(new ErrorCollection.Error(node.GetToken(),
                                                                 LocRM.GetString("ErrorText146"),
                                                                 false,
                                                                 new[]
                                                                     {
                                                                         new ErrorCollection.Error(
                                                                             deconstructor.GetName(), LocRM.GetString("ErrorText147"))
                                                                     }));
                        }
                        else if (deconstructor.GetVisibilityModifier() is AProtectedVisibilityModifier &&
                            !Util.Extends(str, currentStr, data))
                        {
                            errors.Add(new ErrorCollection.Error(node.GetToken(),
                                                                 LocRM.GetString("ErrorText148"),
                                                                 false,
                                                                 new[]
                                                                     {
                                                                         new ErrorCollection.Error(
                                                                             deconstructor.GetName(), LocRM.GetString("ErrorText147"))
                                                                     }));
                        }
                        if (str.GetBase() == null)
                            break;
                        str = data.StructTypeLinks[(ANamedType) str.GetBase()];
                    }
                }
                else
                {
                    //Enrichment deconstructor
                    AEnrichmentDecl currentEnrichment = Util.GetAncestor<AEnrichmentDecl>(node);
                    List<IList> visibleDecls = Util.GetVisibleDecls(node, true);
                    foreach (IList declList in visibleDecls)
                    {
                        foreach (PDecl decl in declList)
                        {
                            if (decl is AEnrichmentDecl)
                            {
                                AEnrichmentDecl enrichment = (AEnrichmentDecl)decl;
                                if (!Util.TypesEqual(pointer.GetType(), enrichment.GetType(), data))
                                    continue;
                                foreach (PDecl enrichmentDecl in enrichment.GetDecl())
                                {
                                    if (enrichmentDecl is ADeconstructorDecl)
                                    {
                                        ADeconstructorDecl deconstructor = (ADeconstructorDecl)enrichmentDecl;
                                        if (deconstructor.GetVisibilityModifier() is APrivateVisibilityModifier &&
                                            currentEnrichment != enrichment)
                                        {
                                            errors.Add(new ErrorCollection.Error(node.GetToken(),
                                                                                 LocRM.GetString("ErrorText146"),
                                                                                 false,
                                                                                 new[]
                                                                     {
                                                                         new ErrorCollection.Error(
                                                                             deconstructor.GetName(), LocRM.GetString("ErrorText147"))
                                                                     }));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            base.OutADeleteStm(node);
        }