public NamespaceDescription(ANamespaceDecl ns)
        {
            decl = ns;
            LineFrom = decl.GetToken().Line;
            if (decl.GetEndToken() == null)
                LineTo = int.MaxValue;
            else
                LineTo = decl.GetEndToken().Line;
            SourceFileContents.Parser parser = new SourceFileContents.Parser(ns);

            //if (Structs.Count != parser.Structs.Count && Form1.Form.CurrentOpenFile != null && Form1.Form.CurrentOpenFile.OpenFile != null)
              //  Form1.Form.CurrentOpenFile.OpenFile.Editor.Restyle();

            Methods = parser.Methods;
            foreach (MethodDescription method in Methods)
            {
                method.ParentFile = this;
            }
            Fields = parser.Fields;
            foreach (VariableDescription field in Fields)
            {
                field.ParentFile = this;
            }
            Structs = parser.Structs;
            foreach (StructDescription structDescription in Structs)
            {
                foreach (MethodDescription method in structDescription.Methods)
                {
                    method.ParentFile = this;
                }
                foreach (VariableDescription field in structDescription.Fields)
                {
                    field.ParentFile = this;
                }
                structDescription.ParentFile = this;
            }
            Enrichments = parser.Enrichments;
            foreach (EnrichmentDescription structDescription in Enrichments)
            {
                structDescription.ParentFile = this;
                foreach (MethodDescription method in structDescription.Methods)
                {
                    method.ParentFile = this;
                }
                foreach (VariableDescription field in structDescription.Fields)
                {
                    field.ParentFile = this;
                }
            }
            Typedefs = parser.Typedefs;
            foreach (TypedefDescription typedef in Typedefs)
            {
                typedef.ParentFile = this;
            }
            Usings = parser.Usings;
            Namespaces = parser.Namespaces;
            foreach (NamespaceDescription namespaceDescription in Namespaces)
            {
                namespaceDescription.Parent = this;
            }
            Position = TextPoint.FromCompilerCoords(ns.GetName());
        }
Ejemplo n.º 2
0
 public override void CaseANamespaceDecl(ANamespaceDecl node)
 {
     InANamespaceDecl(node);
     if (node.GetEndToken() != null)
     {
         node.GetEndToken().Apply(this);
     }
     {
         Object[] temp = new Object[node.GetDecl().Count];
         node.GetDecl().CopyTo(temp, 0);
         for (int i = temp.Length - 1; i >= 0; i--)
         {
             ((PDecl)temp[i]).Apply(this);
         }
     }
     if (node.GetName() != null)
     {
         node.GetName().Apply(this);
     }
     if (node.GetToken() != null)
     {
         node.GetToken().Apply(this);
     }
     OutANamespaceDecl(node);
 }