Exemplo n.º 1
0
        INamespaceScope DoFindOrCreateNamespace(string[] names, int idx)
        {
            var exist = _subNamespaces.FirstOrDefault(x => x.Name == names[idx]);

            if (exist == null)
            {
                exist = new NamespaceScopeImpl(Workspace, this, names[idx]);
                _subNamespaces.Add(exist);
                Workspace.OnNamespaceCreated(exist);
            }
            return(names.Length == ++idx ? exist : exist.DoFindOrCreateNamespace(names, idx));
        }
Exemplo n.º 2
0
 internal void MergeWith(NamespaceScopeImpl other)
 {
     Debug.Assert(other != null);
     _beforeNamespace.MergeWith(other._beforeNamespace);
     foreach (var u in other._usings)
     {
         DoEnsureUsing(u.Key, u.Value.Key, u.Value.Value);
     }
     CodePart.MergeWith(other.CodePart);
     MergeTypes(other);
     foreach (var oNS in other._subNamespaces)
     {
         var my = _subNamespaces.FirstOrDefault(x => x.Name == oNS.Name);
         if (my == null)
         {
             my = new NamespaceScopeImpl(Workspace, this, oNS.Name);
             _subNamespaces.Add(my);
         }
         my.MergeWith(oNS);
     }
 }
Exemplo n.º 3
0
 internal void OnNamespaceCreated(NamespaceScopeImpl n) => NamespaceCreated?.Invoke(n);
Exemplo n.º 4
0
 public CodeWorkspaceImpl()
 {
     _assemblies = new HashSet <Assembly>();
     Global      = new NamespaceScopeImpl(this, null, String.Empty);
 }