Esempio n. 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);
     }
 }
Esempio n. 2
0
        public FunctionScopeImpl Create(CodeWorkspaceImpl ws, IFunctionDefinerScope h, Action <IFunctionScope> header)
        {
            if (header == null)
            {
                throw new ArgumentNullException(nameof(header));
            }
            FunctionScopeImpl f = new FunctionScopeImpl(ws, h);

            header(f);
            f.Initialize();
            _funcs.Add(f.Name, f);
            ws.OnFunctionCreated(f);
            return(f);
        }
Esempio n. 3
0
        public FunctionScopeImpl Create(CodeWorkspaceImpl ws, IFunctionDefinerScope h, FunctionDefinition def)
        {
            if (def == null)
            {
                throw new ArgumentNullException(nameof(def));
            }
            if (_funcs.ContainsKey(def.Key))
            {
                throw new ArgumentException($"Funcion or constructor with key {def.Key} already exists.", nameof(def));
            }
            FunctionScopeImpl f = new FunctionScopeImpl(ws, h, def);

            _funcs.Add(f.Name, f);
            return(f);
        }
Esempio n. 4
0
 internal void MergeWith(FunctionScopeImpl other)
 {
     Debug.Assert(other != null);
     CodePart.MergeWith(other.CodePart);
     _funcs.MergeWith(Workspace, this, other._funcs);
 }
Esempio n. 5
0
 internal void OnFunctionCreated(FunctionScopeImpl f) => FunctionCreated?.Invoke(f);