int GetCurrentNamespace(ISymbolDocumentWriter doc) { if (namespaceStack.Count == 0) { OpenNamespace(""); } NamespaceInfo ni = (NamespaceInfo)namespaceStack.Peek(); if (ni.NamespaceID == -1) { string[] usings = (string[])ni.UsingClauses.ToArray(typeof(string)); int parentId = 0; if (namespaceStack.Count > 1) { namespaceStack.Pop(); parentId = ((NamespaceInfo)namespaceStack.Peek()).NamespaceID; namespaceStack.Push(ni); } ni.NamespaceID = msw.DefineNamespace(ni.Name, ((ICompileUnit)doc).Entry, usings, parentId); } return(ni.NamespaceID); }
public void OpenNamespace(string name) { NamespaceInfo n = new NamespaceInfo(); n.NamespaceID = -1; n.Name = name; namespaceStack.Push(n); }
public void UsingNamespace(string fullName) { if (namespaceStack.Count == 0) { OpenNamespace(""); } NamespaceInfo ni = (NamespaceInfo)namespaceStack.Peek(); if (ni.NamespaceID != -1) { NamespaceInfo old = ni; CloseNamespace(); OpenNamespace(old.Name); ni = (NamespaceInfo)namespaceStack.Peek(); ni.UsingClauses = old.UsingClauses; } ni.UsingClauses.Add(fullName); }
public void OpenNamespace (string name) { NamespaceInfo n = new NamespaceInfo (); n.NamespaceID = -1; n.Name = name; namespaceStack.Push (n); }