public StructDescription(AStructDecl structDecl)
        {
            Parser parser = new Parser(structDecl);

            Name = parser.Name;
            IsEnum = Name.StartsWith("enum ");
            if (IsEnum)
            {
                Name = Name.Substring(5);
                foreach (VariableDescription field in parser.Fields)
                {
                    field.PlacementPrefix = "Enum Field";
                }
            }
            Fields = parser.Fields;

            Methods = parser.Methods;
            Constructors = parser.Constructors;
            Deconstructors = parser.Deconstructors;
            LineFrom = structDecl.GetName().Line;
            LineTo = structDecl.GetEndToken().Line;
            if (structDecl.GetBase() is AGenericType)
                BaseRef = (ANamedType) ((AGenericType) structDecl.GetBase()).GetBase();
            else
                BaseRef = (ANamedType) structDecl.GetBase();
            structDecl.RemoveChild(BaseRef);
            foreach (TIdentifier identifier in structDecl.GetGenericVars())
            {
                GenericVars.Add(identifier.Text);
            }
            IsClass = structDecl.GetClassToken() != null;
            Visibility = (PVisibilityModifier)structDecl.GetVisibilityModifier().Clone();
            Position = TextPoint.FromCompilerCoords(structDecl.GetName());
        }
 public override void CaseAStructDecl(AStructDecl node)
 {
     InAStructDecl(node);
     {
         Object[] temp = new Object[node.GetLocals().Count];
         node.GetLocals().CopyTo(temp, 0);
         for (int i = temp.Length - 1; i >= 0; i--)
         {
             ((PLocalDecl)temp[i]).Apply(this);
         }
     }
     if (node.GetBase() != null)
     {
         node.GetBase().Apply(this);
     }
     {
         Object[] temp = new Object[node.GetGenericVars().Count];
         node.GetGenericVars().CopyTo(temp, 0);
         for (int i = temp.Length - 1; i >= 0; i--)
         {
             ((TIdentifier)temp[i]).Apply(this);
         }
     }
     if (node.GetName() != null)
     {
         node.GetName().Apply(this);
     }
     if (node.GetEndToken() != null)
     {
         node.GetEndToken().Apply(this);
     }
     if (node.GetIntDim() != null)
     {
         node.GetIntDim().Apply(this);
     }
     if (node.GetDimention() != null)
     {
         node.GetDimention().Apply(this);
     }
     if (node.GetClassToken() != null)
     {
         node.GetClassToken().Apply(this);
     }
     if (node.GetVisibilityModifier() != null)
     {
         node.GetVisibilityModifier().Apply(this);
     }
     OutAStructDecl(node);
 }
        public override void OutAStructDecl(AStructDecl node)
        {
            //Insert parameterless constructor
            if (
                !node.GetLocals().OfType<ADeclLocalDecl>().Select(localDecl => localDecl.GetDecl()).OfType
                     <AConstructorDecl>().Any(constructor => constructor.GetFormals().Count == 0))
            {
                PLocalDecl decl = new ADeclLocalDecl(new AConstructorDecl(new APublicVisibilityModifier(),
                                                                          new TIdentifier(node.GetName().Text),
                                                                          new ArrayList(),
                                                                          new ArrayList(),
                                                                          new AABlock(new ArrayList(), new TRBrace("}"))));
                node.GetLocals().Add(decl);
                decl.Apply(this);
            }

            //Add deconstructor if not present
            if (node.GetLocals().OfType<ADeclLocalDecl>().Select(localDecl => localDecl.GetDecl()).OfType<ADeconstructorDecl>().ToList().Count == 0)
            {
                PLocalDecl decl =
                    new ADeclLocalDecl(new ADeconstructorDecl(new APublicVisibilityModifier(),
                                                              new TIdentifier(node.GetName().Text), new ArrayList(),
                                                              new AABlock(new ArrayList(), new TRBrace("}"))));
                node.GetLocals().Add(decl);
                decl.Apply(this);
            }

            if (node.GetVisibilityModifier() is AProtectedVisibilityModifier)
                errors.Add(new ErrorCollection.Error(node.GetName(), LocRM.GetString("ErrorText201")));
        }