コード例 #1
0
 public void MergeWith(CodeWorkspaceImpl ws, IFunctionDefinerScope h, FunctionDefiner other)
 {
     foreach (var kv in other._funcs)
     {
         if (!_funcs.TryGetValue(kv.Key, out var my))
         {
             my = new FunctionScopeImpl(ws, h);
             _funcs.Add(kv.Key, my);
         }
         my.MergeWith(kv.Value);
     }
 }
コード例 #2
0
        internal FunctionScopeImpl(CodeWorkspaceImpl ws, INamedScope parent)
            : base(ws, parent)
        {
            _funcs = new FunctionDefiner(true);
            INamedScope?p = parent;

            for (; ;)
            {
                if (p is ITypeScope t)
                {
                    EnclosingType = t;
                    break;
                }
                p = p.Parent;
                Debug.Assert(p != null, "We eventually reached a top level type.");
            }
        }
コード例 #3
0
        internal TypeScopeImpl(CodeWorkspaceImpl ws, INamedScope parent)
            : base(ws, parent)
        {
            UniqueId = ws.GetNextTypeScopeIdentifier();
            _funcs   = new FunctionDefiner(true);
            INamedScope?p = parent;

            for (; ;)
            {
                if (p is INamespaceScope ns)
                {
                    Namespace = ns;
                    break;
                }
                p = p.Parent;
                Debug.Assert(p != null, "We eventually reached the root namespace.");
            }
        }