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());
        }
Пример #2
0
 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)
 {
     if (node.GetClassToken() != null && node.GetIntDim() == null)
         node.Parent().RemoveChild(node);
     base.OutAStructDecl(node);
 }